id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
3,800
all-3801
[ "WithTimeout", "adds", "the", "timeout", "to", "the", "post", "apps", "app", "routes", "params" ]
[ "func", "(", "o", "*", "PostAppsAppRoutesParams", ")", "WithTimeout", "(", "timeout", "<mask>", ".", "Duration", ")", "*", "PostAppsAppRoutesParams", "{", "o", ".", "SetTimeout", "(", "timeout", ")", "\n", "return", "o", "\n", "}" ]
3,801
all-3802
[ "SecurityGroupRuleLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "SecurityGroupRuleLocator", "(", "href", "<mask>", ")", "*", "SecurityGroupRuleLocator", "{", "return", "&", "SecurityGroupRuleLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
3,802
all-3803
[ "Reverse", "returns", "items", "in", "the", "opposite", "order", "it", "encountered", "them", "in", "." ]
[ "func", "(", "iter", "Enumerator", ")", "Reverse", "(", ")", "Enumerator", "{", "cache", ":=", "NewStack", "(", ")", "\n", "for", "entry", ":=", "range", "iter", "{", "cache", ".", "Push", "(", "entry", ")", "\n", "}", "\n\n", "retval", ":=", "<mask>", "(", "chan", "interface", "{", "}", ")", "\n\n", "go", "func", "(", ")", "{", "for", "!", "cache", ".", "IsEmpty", "(", ")", "{", "val", ",", "_", ":=", "cache", ".", "Pop", "(", ")", "\n", "retval", "<-", "val", "\n", "}", "\n", "close", "(", "retval", ")", "\n", "}", "(", ")", "\n", "return", "retval", "\n", "}" ]
3,803
all-3804
[ "Handler", "is", "the", "main", "HTTP", "handler", "for", "the", "Messenger", "service", ".", "It", "MUST", "be", "attached", "to", "some", "web", "server", "in", "order", "to", "receive", "messages" ]
[ "func", "(", "m", "*", "Messenger", ")", "Handler", "(", "rw", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "if", "req", ".", "Method", "==", "\"", "\"", "{", "query", ":=", "req", ".", "URL", ".", "<mask>", "(", ")", "\n", "if", "query", ".", "Get", "(", "\"", "\"", ")", "!=", "m", ".", "VerifyToken", "{", "rw", ".", "WriteHeader", "(", "http", ".", "StatusUnauthorized", ")", "\n", "return", "\n", "}", "\n", "rw", ".", "WriteHeader", "(", "http", ".", "StatusOK", ")", "\n", "rw", ".", "Write", "(", "[", "]", "byte", "(", "query", ".", "Get", "(", "\"", "\"", ")", ")", ")", "\n", "}", "else", "if", "req", ".", "Method", "==", "\"", "\"", "{", "m", ".", "handlePOST", "(", "rw", ",", "req", ")", "\n", "}", "else", "{", "rw", ".", "WriteHeader", "(", "http", ".", "StatusMethodNotAllowed", ")", "\n", "}", "\n", "}" ]
3,804
all-3805
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetResponseBodyForInterceptionReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork30", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
3,805
all-3806
[ "Must", "returns", "a", "config", "object", "that", "must", "compile", ".", "If", "there", "are", "any", "errors", "this", "function", "will", "panic", ".", "This", "is", "most", "useful", "in", "testing", "or", "constants", "." ]
[ "func", "Must", "(", "s", "string", ")", "*", "Config", "{", "c", ",", "err", ":=", "Parse", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "<mask>", ".", "Fatal", "(", "err", ")", "\n", "}", "\n", "return", "c", "\n", "}" ]
3,806
all-3807
[ "Do", "executes", "Animation", ".", "seekAnimations", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SeekAnimationsParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSeekAnimations", ",", "p", ",", "nil", ")", "\n", "}" ]
3,807
all-3808
[ "loadTheme", "loads", "the", "theme", "if", "it", "is", "not", "in", "the", "cache", "already", ".", "If", "theme", "is", "in", "the", "cache", "loadTheme", "does", "nothing" ]
[ "func", "(", "s", "*", "ThemeManager", ")", "loadTheme", "(", "name", "string", ")", "{", "thememtx", ".", "Lock", "(", ")", "\n", "defer", "thememtx", ".", "Unlock", "(", ")", "\n\n", "if", "_", ",", "ok", ":=", "s", ".", "themes", "[", "name", "]", ";", "ok", "{", "return", "\n", "}", "\n\n", "theme", ":=", "theme", "{", "parent", ":", "defaultTheme", ",", "title", ":", "\"", "\"", ",", "author", ":", "\"", "\"", "}", "\n", "theme", ".", "colors", "=", "make", "(", "map", "[", "string", "]", "term", ".", "Attribute", ",", "0", ")", "\n", "theme", ".", "objects", "=", "make", "(", "map", "[", "string", "]", "string", ",", "0", ")", "\n\n", "file", ",", "err", ":=", "os", ".", "Open", "(", "s", ".", "themePath", "+", "string", "(", "os", ".", "PathSeparator", ")", "+", "name", "+", "themeSuffix", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "name", "+", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "file", ")", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "line", ":=", "scanner", ".", "Text", "(", ")", "\n", "line", "=", "strings", ".", "TrimSpace", "(", "line", ")", "\n\n", "// skip comments", "if", "strings", ".", "HasPrefix", "(", "line", ",", "\"", "\"", ")", "||", "strings", ".", "HasPrefix", "(", "line", ",", "\"", "\"", ")", "{", "continue", "\n", "}", "\n\n", "// skip invalid lines", "if", "!", "strings", ".", "Contains", "(", "line", ",", "\"", "\"", ")", "{", "continue", "\n", "}", "\n\n", "parts", ":=", "strings", ".", "SplitN", "(", "line", ",", "\"", "\"", ",", "2", ")", "\n", "key", ":=", "strings", ".", "TrimSpace", "(", "parts", "[", "0", "]", ")", "\n", "value", ":=", "strings", ".", "TrimSpace", "(", "parts", "[", "1", "]", ")", "\n\n", "if", "(", "strings", ".", "HasPrefix", "(", "value", ",", "\"", "\"", ")", "&&", "strings", ".", "HasSuffix", "(", "value", ",", "\"", "\"", ")", ")", "||", "(", "strings", ".", "HasPrefix", "(", "<mask>", ",", "\"", "\\\"", "\"", ")", "&&", "strings", ".", "HasSuffix", "(", "value", ",", "\"", "\\\"", "\"", ")", ")", "{", "toTrim", ",", "_", ":=", "utf8", ".", "DecodeRuneInString", "(", "value", ")", "\n", "value", "=", "strings", ".", "Trim", "(", "value", ",", "string", "(", "toTrim", ")", ")", "\n", "}", "\n\n", "low", ":=", "strings", ".", "ToLower", "(", "key", ")", "\n", "if", "low", "==", "\"", "\"", "{", "theme", ".", "parent", "=", "value", "\n", "}", "else", "if", "low", "==", "\"", "\"", "{", "theme", ".", "author", "=", "value", "\n", "}", "else", "if", "low", "==", "\"", "\"", "||", "low", "==", "\"", "\"", "{", "theme", ".", "title", "=", "value", "\n", "}", "else", "if", "low", "==", "\"", "\"", "{", "theme", ".", "version", "=", "value", "\n", "}", "else", "if", "strings", ".", "HasSuffix", "(", "key", ",", "\"", "\"", ")", "||", "strings", ".", "HasSuffix", "(", "key", ",", "\"", "\"", ")", "{", "// the first case is a reference to existing color (of this or parent theme)", "// the second is the real color", "if", "strings", ".", "HasSuffix", "(", "value", ",", "\"", "\"", ")", "||", "strings", ".", "HasSuffix", "(", "value", ",", "\"", "\"", ")", "{", "clr", ",", "ok", ":=", "theme", ".", "colors", "[", "value", "]", "\n", "if", "!", "ok", "{", "v", ":=", "value", "\n", "// if color starts with 'parent.' it means the parent color", "// must be used always. It may be useful to load inversed", "// text and background colors of parent theme", "if", "strings", ".", "HasPrefix", "(", "v", ",", "\"", "\"", ")", "{", "v", "=", "strings", ".", "TrimPrefix", "(", "v", ",", "\"", "\"", ")", "\n", "}", "\n", "sch", ",", "schOk", ":=", "s", ".", "themes", "[", "theme", ".", "parent", "]", "\n", "if", "schOk", "{", "clr", ",", "ok", "=", "sch", ".", "colors", "[", "v", "]", "\n", "}", "else", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "theme", ".", "parent", ")", ")", "\n", "}", "\n", "}", "\n", "if", "ok", "{", "theme", ".", "colors", "[", "key", "]", "=", "clr", "\n", "}", "else", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "value", ")", ")", "\n", "}", "\n", "}", "else", "{", "c", ":=", "StringToColor", "(", "value", ")", "\n", "if", "c", "%", "32", "==", "0", "{", "panic", "(", "\"", "\"", "+", "value", ")", "\n", "}", "\n", "theme", ".", "colors", "[", "key", "]", "=", "c", "\n", "}", "\n", "}", "else", "{", "theme", ".", "objects", "[", "key", "]", "=", "value", "\n", "}", "\n", "}", "\n\n", "s", ".", "themes", "[", "name", "]", "=", "theme", "\n", "}" ]
3,808
all-3809
[ "ListenAndServeUNIX", "serves", "HTTP", "requests", "from", "the", "given", "UNIX", "addr", ".", "The", "function", "deletes", "existing", "file", "at", "addr", "before", "starting", "serving", ".", "The", "server", "sets", "the", "given", "file", "mode", "for", "the", "UNIX", "addr", "." ]
[ "func", "(", "s", "*", "Server", ")", "ListenAndServeUNIX", "(", "addr", "string", ",", "mode", "os", ".", "FileMode", ")", "error", "{", "if", "err", ":=", "os", ".", "Remove", "(", "addr", ")", ";", "err", "!=", "nil", "&&", "!", "<mask>", ".", "IsNotExist", "(", "err", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "addr", ",", "err", ")", "\n", "}", "\n", "ln", ",", "err", ":=", "net", ".", "Listen", "(", "\"", "\"", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", "=", "os", ".", "Chmod", "(", "addr", ",", "mode", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "mode", ",", "addr", ",", "err", ")", "\n", "}", "\n", "return", "s", ".", "Serve", "(", "ln", ")", "\n", "}" ]
3,809
all-3810
[ "NewStreamDecoder", "returns", "a", "new", "JSON", "stream", "decoder", "that", "parses", "values", "from", "r", "." ]
[ "func", "NewStreamDecoder", "(", "r", "<mask>", ".", "Reader", ")", "*", "objconv", ".", "StreamDecoder", "{", "return", "objconv", ".", "NewStreamDecoder", "(", "NewParser", "(", "r", ")", ")", "\n", "}" ]
3,810
all-3811
[ "NumRanges", "returns", "the", "number", "of", "discreet", "sets", "of", "ranges", "that", "were", "appended", "." ]
[ "func", "(", "l", "*", "InclusiveRanges", ")", "numRanges", "(", ")", "int", "{", "if", "l", ".", "blocks", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "len", "(", "l", ".", "<mask>", ")", "\n", "}" ]
3,811
all-3812
[ "newPkgDot", "returns", "an", "ast", ".", "Expr", "referring", "to", "pkg", ".", "name", "at", "position", "pos", "." ]
[ "func", "newPkgDot", "(", "pos", "token", ".", "Pos", ",", "pkg", ",", "name", "string", ")", "ast", ".", "Expr", "{", "return", "&", "ast", ".", "SelectorExpr", "{", "X", ":", "&", "ast", ".", "Ident", "{", "NamePos", ":", "pos", ",", "Name", ":", "pkg", ",", "}", ",", "Sel", ":", "&", "ast", ".", "Ident", "{", "NamePos", ":", "pos", ",", "Name", ":", "<mask>", ",", "}", ",", "}", "\n", "}" ]
3,812
all-3813
[ "resourceVSphereDatastoreClusterApplyCreate", "processes", "the", "creation", "part", "of", "resourceVSphereDatastoreClusterCreate", "." ]
[ "func", "resourceVSphereDatastoreClusterApplyCreate", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "(", "*", "object", ".", "StoragePod", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ")", "\n", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "if", "err", ":=", "viapi", ".", "ValidateVirtualCenter", "(", "client", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "dc", ",", "err", ":=", "datacenterFromID", "(", "client", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Find the folder based off the path to the datacenter. This is where we", "// create the datastore cluster.", "f", ",", "err", ":=", "<mask>", ".", "FromPath", "(", "client", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ",", "folder", ".", "VSphereFolderTypeDatastore", ",", "dc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Create the storage pod (datastore cluster).", "pod", ",", "err", ":=", "storagepod", ".", "Create", "(", "f", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Set the ID now before proceeding with tags, custom attributes, and DRS.", "// This ensures that we can recover from a problem with any of these", "// operations.", "d", ".", "SetId", "(", "pod", ".", "Reference", "(", ")", ".", "Value", ")", "\n\n", "return", "pod", ",", "nil", "\n", "}" ]
3,813
all-3814
[ "FullConsoleUrl", "returns", "the", "console", "url", "for", "the", "server", "with", "the", "token", "in", "the", "query", "string", ".", "Server", "needs", "a", "ConsoleUrl", "and", "ConsoleToken", "retrieved", "using", "ActivateConsoleForServer" ]
[ "func", "(", "s", "*", "Server", ")", "FullConsoleUrl", "(", ")", "string", "{", "if", "s", ".", "ConsoleUrl", "==", "\"", "\"", "||", "s", ".", "ConsoleToken", "==", "\"", "\"", "{", "return", "s", ".", "ConsoleUrl", "\n", "}", "\n", "u", ",", "err", ":=", "url", ".", "Parse", "(", "s", ".", "ConsoleUrl", ")", "\n", "if", "u", "==", "nil", "||", "err", "!=", "nil", "{", "return", "s", ".", "ConsoleUrl", "\n", "}", "\n", "values", ":=", "u", ".", "Query", "(", ")", "\n", "if", "values", ".", "Get", "(", "\"", "\"", ")", "!=", "\"", "\"", "{", "return", "s", ".", "ConsoleUrl", "\n", "}", "\n", "values", ".", "<mask>", "(", "\"", "\"", ",", "s", ".", "ConsoleToken", ")", "\n", "u", ".", "RawQuery", "=", "values", ".", "Encode", "(", ")", "\n", "return", "u", ".", "String", "(", ")", "\n", "}" ]
3,814
all-3815
[ "Validate", "checks", "that", "the", "minimum", "fields", "are", "provided", ".", "Deprecated", ":", "This", "map", "be", "deleted", "after", "the", "native", "library", "replaces", "Ruby", "deps", "and", "should", "not", "be", "used", "outside", "of", "this", "library", "." ]
[ "func", "(", "p", "*", "PublishRequest", ")", "Validate", "(", ")", "error", "{", "p", ".", "Args", "=", "[", "]", "string", "{", "}", "\n\n", "if", "len", "(", "p", ".", "PactURLs", ")", "!=", "0", "{", "p", ".", "Args", "=", "append", "(", "p", ".", "Args", ",", "p", ".", "PactURLs", "...", ")", "\n", "}", "else", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "p", ".", "BrokerUsername", "!=", "\"", "\"", "{", "p", ".", "Args", "=", "append", "(", "p", ".", "Args", ",", "\"", "\"", ",", "p", ".", "BrokerUsername", ")", "\n", "}", "\n\n", "if", "p", ".", "BrokerPassword", "!=", "\"", "\"", "{", "p", ".", "Args", "=", "append", "(", "p", ".", "Args", ",", "\"", "\"", ",", "p", ".", "BrokerPassword", ")", "\n", "}", "\n\n", "if", "p", ".", "PactBroker", "!=", "\"", "\"", "&&", "(", "(", "p", ".", "BrokerUsername", "==", "\"", "\"", "&&", "p", ".", "BrokerPassword", "!=", "\"", "\"", ")", "||", "(", "p", ".", "BrokerUsername", "!=", "\"", "\"", "&&", "p", ".", "BrokerPassword", "==", "\"", "\"", ")", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "p", ".", "PactBroker", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ".", "Args", "=", "append", "(", "p", ".", "Args", ",", "\"", "\"", ",", "p", ".", "PactBroker", ")", "\n\n", "if", "p", ".", "BrokerToken", "!=", "\"", "\"", "{", "p", ".", "Args", "=", "append", "(", "p", ".", "Args", ",", "\"", "\"", ",", "p", ".", "BrokerToken", ")", "\n", "}", "\n\n", "if", "p", ".", "ConsumerVersion", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ".", "Args", "=", "append", "(", "p", ".", "Args", ",", "\"", "\"", ",", "p", ".", "ConsumerVersion", ")", "\n\n", "if", "len", "(", "p", ".", "Tags", ")", ">", "0", "{", "for", "_", ",", "t", ":=", "range", "p", ".", "Tags", "{", "p", ".", "Args", "=", "append", "(", "p", ".", "Args", ",", "\"", "\"", ",", "t", ")", "\n", "}", "\n", "}", "\n\n", "if", "p", ".", "Verbose", "{", "p", ".", "Args", "=", "<mask>", "(", "p", ".", "Args", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
3,815
all-3816
[ "getOpenBlockNumber", "extracts", "the", "Open_block_number", "field", "of", "a", "given", "channel", "-", "related", "EthLog", ".", "Returns", "false", "in", "case", "it", "failed", "i", ".", "e", ".", "the", "event", "has", "no", "such", "field", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "getOpenBlockNumber", "(", "el", "*", "data", ".", "JobEthLog", ")", "(", "block", "uint32", ",", "ok", "bool", ",", "err", "error", ")", "{", "var", "event", "string", "\n", "switch", "el", ".", "Topics", "[", "0", "]", "{", "<mask>", "eth", ".", "ServiceChannelToppedUp", ":", "event", "=", "logChannelToppedUp", "\n", "case", "eth", ".", "ServiceChannelCloseRequested", ":", "event", "=", "logChannelCloseRequested", "\n", "case", "eth", ".", "ServiceCooperativeChannelClose", ":", "event", "=", "logCooperativeChannelClose", "\n", "case", "eth", ".", "ServiceUnCooperativeChannelClose", ":", "event", "=", "logUnCooperativeChannelClose", "\n", "default", ":", "return", "\n", "}", "\n\n", "if", "event", "!=", "\"", "\"", "{", "block", ",", "err", "=", "m", ".", "blockNumber", "(", "el", ".", "Data", ",", "logChannelToppedUp", ")", "\n", "ok", "=", "true", "\n", "}", "\n", "return", "\n", "}" ]
3,816
all-3817
[ "------------------------------------------------------------", "Mutator", "implementations", "------------------------------------------------------------", "MutateTransaction", "for", "AccountMergeBuilder", "causes", "the", "underylying", "Destination", "to", "be", "added", "to", "the", "operation", "list", "for", "the", "provided", "transaction" ]
[ "func", "(", "m", "AccountMergeBuilder", ")", "MutateTransaction", "(", "o", "*", "TransactionBuilder", ")", "error", "{", "if", "m", ".", "Err", "!=", "nil", "{", "return", "m", ".", "Err", "\n", "}", "\n\n", "m", ".", "O", ".", "Body", ",", "m", ".", "Err", "=", "xdr", ".", "NewOperationBody", "(", "xdr", ".", "OperationTypeAccountMerge", ",", "m", ".", "Destination", ")", "\n", "o", ".", "TX", ".", "Operations", "=", "<mask>", "(", "o", ".", "TX", ".", "Operations", ",", "m", ".", "O", ")", "\n", "return", "m", ".", "Err", "\n", "}" ]
3,817
all-3818
[ "GetTxSet", "retrieves", "the", "TxSet", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "StellarMessage", ")", "GetTxSet", "(", ")", "(", "result", "TransactionSet", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "<mask>", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "TxSet", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
3,818
all-3819
[ "Set", "adds", "a", "string", "to", "r" ]
[ "func", "(", "r", "*", "RepeatedStringArg", ")", "Set", "(", "s", "string", ")", "error", "{", "*", "r", "=", "<mask>", "(", "*", "r", ",", "s", ")", "\n", "return", "nil", "\n", "}" ]
3,819
all-3820
[ "Infof", "logs", "at", "the", "INFO", "log", "level", "using", "a", "standard", "printf", "format", "string" ]
[ "func", "Infof", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "if", "Log", "!=", "nil", "{", "<mask>", ".", "Info", "(", "fmt", ".", "Sprintf", "(", "format", ",", "args", "...", ")", ")", "\n", "}", "\n", "}" ]
3,820
all-3821
[ "SetFilter", "is", "a", "wrapper", "around", "gtk_file_chooser_set_filter", "()", "." ]
[ "func", "(", "v", "*", "FileChooser", ")", "SetFilter", "(", "filter", "*", "FileFilter", ")", "{", "C", ".", "gtk_file_chooser_set_filter", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
3,821
all-3822
[ "RouteHelpers", "returns", "a", "map", "of", "BuildPathHelper", "()", "for", "each", "route", "available", "in", "the", "app", "." ]
[ "func", "(", "a", "*", "App", ")", "RouteHelpers", "(", ")", "map", "[", "string", "]", "RouteHelperFunc", "{", "rh", ":=", "map", "[", "string", "]", "RouteHelperFunc", "{", "}", "\n", "for", "_", ",", "<mask>", ":=", "range", "a", ".", "Routes", "(", ")", "{", "cRoute", ":=", "route", "\n", "rh", "[", "cRoute", ".", "PathName", "]", "=", "cRoute", ".", "BuildPathHelper", "(", ")", "\n", "}", "\n", "return", "rh", "\n", "}" ]
3,822
all-3823
[ "NewTemplate", "creates", "and", "parses", "a", "new", "Consul", "Template", "template", "at", "the", "given", "path", ".", "If", "the", "template", "does", "not", "exist", "an", "error", "is", "returned", ".", "During", "initialization", "the", "template", "is", "read", "and", "is", "parsed", "for", "dependencies", ".", "Any", "errors", "that", "occur", "are", "returned", "." ]
[ "func", "NewTemplate", "(", "i", "*", "NewTemplateInput", ")", "(", "*", "Template", ",", "error", ")", "{", "if", "i", "==", "nil", "{", "i", "=", "&", "NewTemplateInput", "{", "}", "\n", "}", "\n\n", "// Validate that we are either given the path or the explicit contents", "if", "i", ".", "Source", "!=", "\"", "\"", "&&", "i", ".", "Contents", "!=", "\"", "\"", "{", "return", "nil", ",", "ErrTemplateContentsAndSource", "\n", "}", "else", "if", "i", ".", "<mask>", "==", "\"", "\"", "&&", "i", ".", "Contents", "==", "\"", "\"", "{", "return", "nil", ",", "ErrTemplateMissingContentsAndSource", "\n", "}", "\n\n", "var", "t", "Template", "\n", "t", ".", "source", "=", "i", ".", "Source", "\n", "t", ".", "contents", "=", "i", ".", "Contents", "\n", "t", ".", "leftDelim", "=", "i", ".", "LeftDelim", "\n", "t", ".", "rightDelim", "=", "i", ".", "RightDelim", "\n", "t", ".", "errMissingKey", "=", "i", ".", "ErrMissingKey", "\n\n", "if", "i", ".", "Source", "!=", "\"", "\"", "{", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "i", ".", "Source", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "t", ".", "contents", "=", "string", "(", "contents", ")", "\n", "}", "\n\n", "// Compute the MD5, encode as hex", "hash", ":=", "md5", ".", "Sum", "(", "[", "]", "byte", "(", "t", ".", "contents", ")", ")", "\n", "t", ".", "hexMD5", "=", "hex", ".", "EncodeToString", "(", "hash", "[", ":", "]", ")", "\n\n", "return", "&", "t", ",", "nil", "\n", "}" ]
3,823
all-3824
[ "place", "a", "marker", "in", "the", "feedback", "buffer" ]
[ "func", "PassThrough", "(", "token", "float32", ")", "{", "syscall", ".", "Syscall", "(", "gpPassThrough", ",", "1", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "<mask>", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
3,824
all-3825
[ "WithNamespace", "adds", "a", "namespace", "to", "the", "logging", "context" ]
[ "func", "WithNamespace", "(", "namespace", "string", ",", "ctx", "<mask>", ".", "Interface", ")", "log", ".", "Interface", "{", "return", "ctx", ".", "WithField", "(", "NamespaceKey", ",", "namespace", ")", "\n", "}" ]
3,825
all-3826
[ "GetProject", "retrieves", "and", "returns", "the", "named", "project", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "GetProject", "(", "name", "string", ")", "(", "*", "Project", ",", "error", ")", "{", "p", ":=", "&", "Project", "{", "}", "\n", "err", ":=", "c", ".", "get", "(", "[", "]", "string", "{", "\"", "\"", ",", "name", "}", ",", "nil", ",", "p", ")", "\n", "return", "p", ",", "err", "\n", "}" ]
3,826
all-3827
[ "Push", "pushes", "a", "new", "item", "on", "top", "of", "the", "stack", "." ]
[ "func", "(", "s", "*", "VecStack", ")", "Push", "(", "value", "*", "Vec", ")", "{", "s", ".", "top", "=", "&", "item", "{", "<mask>", ",", "s", ".", "top", "}", "\n", "s", ".", "size", "++", "\n", "}" ]
3,827
all-3828
[ "Command", "calls", "exec", ".", "Command", "." ]
[ "func", "(", "g", "GitOS", ")", "Command", "(", "name", "string", ",", "args", "...", "string", ")", "Cmd", "{", "return", "&", "gitCmd", "{", "<mask>", ".", "Command", "(", "name", ",", "args", "...", ")", "}", "\n", "}" ]
3,828
all-3829
[ "fileHistory", "calls", "f", "with", "FileInfos", "for", "the", "file", "starting", "with", "how", "it", "looked", "at", "the", "referenced", "commit", "and", "then", "all", "past", "versions", "that", "are", "different", "." ]
[ "func", "(", "d", "*", "<mask>", ")", "fileHistory", "(", "pachClient", "*", "client", ".", "APIClient", ",", "file", "*", "pfs", ".", "File", ",", "history", "int64", ",", "f", "func", "(", "*", "pfs", ".", "FileInfo", ")", "error", ")", "error", "{", "var", "fi", "*", "pfs", ".", "FileInfo", "\n", "for", "{", "_fi", ",", "err", ":=", "d", ".", "inspectFile", "(", "pachClient", ",", "file", ")", "\n", "if", "err", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "pfsserver", ".", "ErrFileNotFound", ")", ";", "ok", "{", "return", "f", "(", "fi", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "if", "fi", "!=", "nil", "&&", "bytes", ".", "Compare", "(", "fi", ".", "Hash", ",", "_fi", ".", "Hash", ")", "!=", "0", "{", "if", "err", ":=", "f", "(", "fi", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "history", ">", "0", "{", "history", "--", "\n", "if", "history", "==", "0", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "}", "\n", "fi", "=", "_fi", "\n", "ci", ",", "err", ":=", "d", ".", "inspectCommit", "(", "pachClient", ",", "file", ".", "Commit", ",", "pfs", ".", "CommitState_STARTED", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "ci", ".", "ParentCommit", "==", "nil", "{", "return", "f", "(", "fi", ")", "\n", "}", "\n", "file", ".", "Commit", "=", "ci", ".", "ParentCommit", "\n", "}", "\n", "}" ]
3,829
all-3830
[ "newGPGMEContext", "returns", "a", "new", "*", "gpgme", ".", "Context", "using", "optionalDir", "if", "not", "empty", "." ]
[ "func", "newGPGMEContext", "(", "optionalDir", "string", ")", "(", "*", "gpgme", ".", "Context", ",", "error", ")", "{", "ctx", ",", "err", ":=", "gpgme", ".", "New", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", "=", "ctx", ".", "SetProtocol", "(", "gpgme", ".", "ProtocolOpenPGP", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "optionalDir", "!=", "\"", "\"", "{", "err", ":=", "ctx", ".", "SetEngineInfo", "(", "gpgme", ".", "ProtocolOpenPGP", ",", "\"", "\"", ",", "optionalDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "ctx", ".", "SetArmor", "(", "false", ")", "\n", "ctx", ".", "SetTextMode", "(", "<mask>", ")", "\n", "return", "ctx", ",", "nil", "\n", "}" ]
3,830
all-3831
[ "getResponse", "executes", "the", "specified", "controller", "s", "method", "using", "reflection", "and", "returns", "the", "response", "object" ]
[ "func", "(", "handler", "ControllerHandler", ")", "getResponse", "(", "r", "*", "http", ".", "Request", ")", "Response", "{", "controller", ":=", "handler", ".", "factory", "(", ")", "\n", "controller", ".", "SetRequest", "(", "r", ")", "\n", "controller", ".", "Init", "(", ")", "\n", "rController", ":=", "reflect", ".", "ValueOf", "(", "controller", ")", "\n", "method", ":=", "rController", ".", "MethodByName", "(", "handler", ".", "methodName", ")", "\n\n", "// get args from gorilla mux", "var", "args", "[", "]", "reflect", ".", "Value", "\n", "for", "_", ",", "val", ":=", "range", "mux", ".", "Vars", "(", "r", ")", "{", "args", "=", "append", "(", "args", ",", "reflect", ".", "ValueOf", "(", "val", ")", ")", "\n", "}", "\n\n", "// make sure number of args matches the controller method", "expected", ":=", "len", "(", "args", ")", "\n", "actual", ":=", "method", ".", "<mask>", "(", ")", ".", "NumIn", "(", ")", "\n", "if", "expected", "!=", "actual", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "handler", ".", "methodName", ",", "actual", ",", "expected", ")", ")", "\n", "}", "\n\n", "out", ":=", "method", ".", "Call", "(", "args", ")", "\n", "if", "out", "[", "0", "]", ".", "IsNil", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "resp", ":=", "out", "[", "0", "]", ".", "Interface", "(", ")", ".", "(", "Response", ")", "\n", "if", "resp", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "controller", ".", "Session", "(", ")", ".", "WriteToResponse", "(", "resp", ")", "\n", "return", "resp", "\n", "}" ]
3,831
all-3832
[ "resourceVSphereComputeClusterGetClusterFromPath", "gets", "the", "ComputeClusterResource", "from", "a", "supplied", "path", ".", "If", "no", "datacenter", "is", "supplied", "the", "path", "must", "be", "a", "full", "path", "." ]
[ "func", "resourceVSphereComputeClusterGetClusterFromPath", "(", "meta", "interface", "{", "}", ",", "path", "string", ",", "dcID", "string", ",", ")", "(", "*", "object", ".", "ClusterComputeResource", ",", "error", ")", "{", "client", ",", "err", ":=", "resourceVSphereComputeClusterClient", "(", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "dc", "*", "object", ".", "Datacenter", "\n", "if", "dcID", "!=", "\"", "\"", "{", "var", "err", "error", "\n", "dc", ",", "err", "=", "datacenterFromID", "(", "client", ",", "dcID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "<mask>", ",", "dc", ".", "InventoryPath", ")", "\n", "}", "else", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "path", ")", "\n", "}", "\n\n", "return", "clustercomputeresource", ".", "FromPath", "(", "client", ",", "path", ",", "dc", ")", "\n", "}" ]
3,832
all-3833
[ "HasMetricQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryValueRequest", ")", "HasMetricQuery", "(", ")", "bool", "{", "if", "q", "!=", "nil", "&&", "q", ".", "MetricQuery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
3,833
all-3834
[ "GetShowResourceList", "returns", "the", "ShowResourceList", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "GetShowResourceList", "(", ")", "bool", "{", "if", "t", "==", "nil", "||", "t", ".", "ShowResourceList", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "ShowResourceList", "\n", "}" ]
3,834
all-3835
[ "OptImportBatchSize", "is", "the", "number", "of", "records", "read", "before", "importing", "them", "." ]
[ "func", "OptImportBatchSize", "(", "batchSize", "int", ")", "ImportOption", "{", "return", "func", "(", "<mask>", "*", "ImportOptions", ")", "error", "{", "options", ".", "batchSize", "=", "batchSize", "\n", "return", "nil", "\n", "}", "\n", "}" ]
3,835
all-3836
[ "CancelPopup", "cancels", "an", "alert", "confirm", "or", "prompt", "popup", "." ]
[ "func", "(", "p", "*", "Page", ")", "CancelPopup", "(", ")", "error", "{", "if", "err", ":=", "p", ".", "<mask>", ".", "DismissAlert", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,836
all-3837
[ "MustParse", "is", "like", "Parse", "but", "panics", "if", "the", "string", "cannot", "be", "parsed", ".", "It", "simplifies", "safe", "initialization", "of", "global", "variables", "holding", "compiled", "UUIDs", "." ]
[ "func", "MustParse", "(", "s", "string", ")", "UUID", "{", "uuid", ",", "err", ":=", "Parse", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "`uuid: Parse(`", "+", "s", "+", "`): `", "+", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "return", "uuid", "\n", "}" ]
3,837
all-3838
[ "GetPalette", "returns", "the", "Palette", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "h", "*", "HostmapStyle", ")", "GetPalette", "(", ")", "<mask>", "{", "if", "h", "==", "nil", "||", "h", ".", "Palette", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "h", ".", "Palette", "\n", "}" ]
3,838
all-3839
[ "Backup", "creates", "a", "backup", "of", "the", "named", "file", ".", "The", "schema", "used", "for", "the", "new", "name", "is", ":", "{", "name", "}", "\\", "+", "[", "1", "-", "9", "]", "~", "name", ":", "The", "original", "file", "name", ".", "+", ":", "Character", "used", "to", "separate", "the", "file", "name", "from", "rest", ".", "number", ":", "A", "number", "from", "1", "to", "9", "using", "rotation", ".", "~", ":", "To", "indicate", "that", "it", "is", "a", "backup", "just", "like", "it", "is", "used", "in", "Unix", "systems", "." ]
[ "func", "Backup", "(", "filename", "string", ")", "error", "{", "// Check if it is empty", "info", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "if", "<mask>", ".", "IsNotExist", "(", "err", ")", "{", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "if", "info", ".", "Size", "(", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "files", ",", "err", ":=", "filepath", ".", "Glob", "(", "filename", "+", "_BACKUP_SUFFIX", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Number rotation", "numBackup", ":=", "byte", "(", "1", ")", "\n\n", "if", "len", "(", "files", ")", "!=", "0", "{", "lastFile", ":=", "files", "[", "len", "(", "files", ")", "-", "1", "]", "\n", "numBackup", "=", "lastFile", "[", "len", "(", "lastFile", ")", "-", "2", "]", "+", "1", "// next number", "\n\n", "if", "numBackup", ">", "'9'", "{", "numBackup", "=", "'1'", "\n", "}", "\n", "}", "else", "{", "numBackup", "=", "'1'", "\n", "}", "\n\n", "return", "Copy", "(", "filename", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "filename", ",", "string", "(", "numBackup", ")", ")", ")", "\n", "}" ]
3,839
all-3840
[ "Push", "adds", "an", "entry", "to", "the", "top", "of", "the", "Stack", "." ]
[ "func", "(", "stack", "*", "Stack", ")", "Push", "(", "entry", "interface", "{", "}", ")", "{", "stack", ".", "key", ".", "Lock", "(", ")", "\n", "defer", "stack", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "if", "nil", "==", "stack", ".", "underlyer", "{", "stack", ".", "underlyer", "=", "NewLinkedList", "(", ")", "\n", "}", "\n", "stack", ".", "underlyer", ".", "AddFront", "(", "entry", ")", "\n", "}" ]
3,840
all-3841
[ "BitCrush", "reduces", "the", "resolution", "of", "the", "sample", "to", "the", "target", "bit", "depth", "Note", "that", "bit", "crusher", "effects", "are", "usually", "made", "of", "this", "feature", "+", "a", "decimator" ]
[ "func", "BitCrush", "(", "buf", "*", "audio", ".", "FloatBuffer", ",", "factor", "float64", ")", "{", "stepSize", ":=", "crusherStepSize", "*", "<mask>", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "buf", ".", "Data", ")", ";", "i", "++", "{", "frac", ",", "exp", ":=", "math", ".", "Frexp", "(", "buf", ".", "Data", "[", "i", "]", ")", "\n", "frac", "=", "signum", "(", "frac", ")", "*", "math", ".", "Floor", "(", "math", ".", "Abs", "(", "frac", ")", "/", "stepSize", "+", "0.5", ")", "*", "stepSize", "\n", "buf", ".", "Data", "[", "i", "]", "=", "math", ".", "Ldexp", "(", "frac", ",", "exp", ")", "\n", "}", "\n", "}" ]
3,841
all-3842
[ "ComputePrivateKey", "returns", "the", "private", "key", "using", "the", "master", "mprivHex", "and", "chainCodeHex", "for", "the", "given", "path", "and", "index", "." ]
[ "func", "ComputePrivateKey", "(", "mprivHex", "string", ",", "chainHex", "string", ",", "path", "string", ",", "index", "int32", ")", "string", "{", "privKeyBytes", ":=", "DerivePrivateKeyForPath", "(", "HexDecode", "(", "mprivHex", ")", ",", "HexDecode", "(", "chainHex", ")", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "path", ",", "<mask>", ")", ",", ")", "\n", "return", "HexEncode", "(", "privKeyBytes", ")", "\n", "}" ]
3,842
all-3843
[ "FetchAlerts", "retrieves", "all", "alerts", "available", "to", "the", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchAlerts", "(", ")", "(", "*", "[", "]", "Alert", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "a", ".", "Get", "(", "config", ".", "AlertPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "alerts", "[", "]", "Alert", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "alerts", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "alerts", ",", "nil", "\n", "}" ]
3,843
all-3844
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ClearDataForOriginParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,844
all-3845
[ "RemoveUnknownVisibilites", "-", "will", "remove", "any", "service", "plan", "visiblities", "that", "are", "not", "known", "by", "cf", "-", "mgmt" ]
[ "func", "(", "m", "*", "Manager", ")", "RemoveUnknownVisibilites", "(", "serviceInfo", "*", "ServiceInfo", ")", "error", "{", "for", "servicePlanName", ",", "servicePlan", ":=", "range", "serviceInfo", ".", "AllPlans", "(", ")", "{", "for", "_", ",", "plan", ":=", "range", "servicePlan", "{", "for", "_", ",", "visibility", ":=", "range", "plan", ".", "ListVisibilities", "(", ")", "{", "if", "m", ".", "Peek", "{", "lo", ".", "G", ".", "Infof", "(", "\"", "\"", ",", "plan", ".", "<mask>", ",", "servicePlanName", ",", "visibility", ".", "OrganizationGuid", ")", "\n", "continue", "\n", "}", "\n", "lo", ".", "G", ".", "Infof", "(", "\"", "\"", ",", "plan", ".", "Name", ",", "servicePlanName", ",", "visibility", ".", "OrganizationGuid", ")", "\n", "err", ":=", "m", ".", "Client", ".", "DeleteServicePlanVisibilityByPlanAndOrg", "(", "visibility", ".", "ServicePlanGuid", ",", "visibility", ".", "OrganizationGuid", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,845
all-3846
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventBreakpointResolved", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger41", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
3,846
all-3847
[ "Do", "executes", "DOM", ".", "getFlattenedDocument", "against", "the", "provided", "context", ".", "returns", ":", "nodes", "-", "Resulting", "node", "." ]
[ "func", "(", "p", "*", "GetFlattenedDocumentParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "nodes", "[", "]", "*", "cdp", ".", "Node", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetFlattenedDocumentReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetFlattenedDocument", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "Nodes", ",", "nil", "\n", "}" ]
3,847
all-3848
[ "Find", "returns", "a", "filter", "that", "produces", "matching", "nodes", "under", "a", "filesystem", "directory", ".", "The", "items", "yielded", "by", "the", "filter", "will", "be", "prefixed", "by", "dir", ".", "E", ".", "g", ".", "if", "dir", "contains", "subdir", "/", "file", "the", "filter", "will", "yield", "dir", "/", "subdir", "/", "file", ".", "By", "default", "the", "filter", "matches", "all", "types", "of", "files", "(", "regular", "files", "directories", "symbolic", "links", "etc", ".", ")", ".", "This", "behavior", "can", "be", "adjusted", "by", "calling", "FindFilter", "methods", "before", "executing", "the", "filter", "." ]
[ "func", "Find", "(", "dir", "string", ")", "*", "FindFilter", "{", "return", "&", "FindFilter", "{", "dir", ":", "dir", ",", "ifmode", ":", "func", "(", "<mask>", ".", "FileMode", ")", "bool", "{", "return", "true", "}", ",", "skipdirif", ":", "func", "(", "d", "string", ")", "bool", "{", "return", "false", "}", ",", "}", "\n", "}" ]
3,848
all-3849
[ "StoragePoolNodeJoinCeph", "updates", "internal", "state", "to", "reflect", "that", "nodeID", "is", "joining", "a", "cluster", "where", "poolID", "is", "a", "ceph", "pool", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "StoragePoolNodeJoinCeph", "(", "poolID", ",", "nodeID", "int64", ")", "error", "{", "// Get the IDs of the other nodes (they should be all linked to", "// the pool).", "stmt", ":=", "\"", "\"", "\n", "nodeIDs", ",", "err", ":=", "query", ".", "SelectIntegers", "(", "c", ".", "tx", ",", "stmt", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "nodeIDs", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "otherNodeID", ":=", "nodeIDs", "[", "0", "]", "\n\n", "// Create entries of all the ceph volumes for the new node.", "_", ",", "err", "=", "c", ".", "tx", ".", "Exec", "(", "`\nINSERT INTO storage_volumes(name, storage_pool_id, node_id, type, description, project_id)\n SELECT name, storage_pool_id, ?, type, description, 1\n FROM storage_volumes WHERE storage_pool_id=? AND node_id=?\n`", ",", "nodeID", ",", "poolID", ",", "otherNodeID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Create entries of all the ceph volumes configs for the new node.", "stmt", "=", "`\nSELECT id FROM storage_volumes WHERE storage_pool_id=? AND node_id=?\n ORDER BY name, type\n`", "\n", "volumeIDs", ",", "err", ":=", "query", ".", "SelectIntegers", "(", "c", ".", "tx", ",", "stmt", ",", "poolID", ",", "nodeID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "otherVolumeIDs", ",", "err", ":=", "query", ".", "SelectIntegers", "(", "c", ".", "tx", ",", "stmt", ",", "poolID", ",", "otherNodeID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "volumeIDs", ")", "!=", "len", "(", "otherVolumeIDs", ")", "{", "// Sanity check", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "for", "i", ",", "otherVolumeID", ":=", "range", "otherVolumeIDs", "{", "config", ",", "err", ":=", "query", ".", "SelectConfig", "(", "c", ".", "tx", ",", "\"", "\"", ",", "\"", "\"", ",", "otherVolumeID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "for", "key", ",", "value", ":=", "range", "config", "{", "_", ",", "err", ":=", "c", ".", "tx", ".", "Exec", "(", "`\nINSERT INTO storage_volumes_config(storage_volume_id, key, value) VALUES(?, ?, ?)\n`", ",", "volumeIDs", "[", "i", "]", ",", "key", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
3,849
all-3850
[ "ProfileURIs", "returns", "all", "available", "profile", "URIs", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProfileURIs", "(", "filter", "ProfileFilter", ")", "(", "[", "]", "string", ",", "error", ")", "{", "// Check which filter criteria are active.", "criteria", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n", "if", "filter", ".", "Project", "!=", "\"", "\"", "{", "criteria", "[", "\"", "\"", "]", "=", "filter", ".", "Project", "\n", "}", "\n", "if", "filter", ".", "Name", "!=", "\"", "\"", "{", "criteria", "[", "\"", "\"", "]", "=", "filter", ".", "Name", "\n", "}", "\n\n", "// Pick the prepared statement and arguments to use based on active criteria.", "var", "stmt", "*", "sql", ".", "Stmt", "\n", "var", "args", "[", "]", "interface", "{", "}", "\n\n", "if", "criteria", "[", "\"", "\"", "]", "!=", "nil", "&&", "criteria", "[", "\"", "\"", "]", "!=", "nil", "{", "stmt", "=", "c", ".", "stmt", "(", "profileNamesByProjectAndName", ")", "\n", "args", "=", "[", "]", "<mask>", "{", "}", "{", "filter", ".", "Project", ",", "filter", ".", "Name", ",", "}", "\n", "}", "else", "if", "criteria", "[", "\"", "\"", "]", "!=", "nil", "{", "stmt", "=", "c", ".", "stmt", "(", "profileNamesByProject", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "filter", ".", "Project", ",", "}", "\n", "}", "else", "{", "stmt", "=", "c", ".", "stmt", "(", "profileNames", ")", "\n", "args", "=", "[", "]", "interface", "{", "}", "{", "}", "\n", "}", "\n\n", "code", ":=", "cluster", ".", "EntityTypes", "[", "\"", "\"", "]", "\n", "formatter", ":=", "cluster", ".", "EntityFormatURIs", "[", "code", "]", "\n\n", "return", "query", ".", "SelectURIs", "(", "stmt", ",", "formatter", ",", "args", "...", ")", "\n", "}" ]
3,850
all-3851
[ "availableFilename", "returns", "a", "filename", "that", "is", "valid", "as", "a", "new", "file", "or", "directory", "." ]
[ "func", "availableFilename", "(", "prefix", ",", "postfix", "string", ")", "(", "string", ",", "error", ")", "{", "const", "datetimeFormat", "=", "\"", "\"", "\n\n", "now", ":=", "time", ".", "Now", "(", ")", "\n", "name", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "prefix", ",", "now", ".", "Format", "(", "datetimeFormat", ")", ",", "postfix", ")", "\n", "for", "i", ":=", "1", ";", ";", "i", "++", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "name", ")", ";", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "break", "\n", "}", "\n", "if", "!", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "\n", "name", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ",", "now", ".", "Format", "(", "datetimeFormat", ")", ",", "i", ",", "postfix", ")", "\n", "}", "\n", "return", "name", ",", "nil", "\n", "}" ]
3,851
all-3852
[ "Initialize", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockGPUManager", ")", "Initialize", "(", ")", "error", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "error", ")", "\n", "return", "ret0", "\n", "}" ]
3,852
all-3853
[ "OrderBy", "adds", "ORDER", "BY", "clause", "to", "the", "Condition", "and", "returns", "it", "for", "method", "chain", "." ]
[ "func", "(", "c", "*", "Condition", ")", "OrderBy", "(", "table", ",", "col", "interface", "{", "}", ",", "order", "...", "interface", "{", "}", ")", "*", "Condition", "{", "order", "=", "append", "(", "[", "]", "interface", "{", "}", "{", "table", ",", "col", "}", ",", "order", "...", ")", "\n", "orderbys", ":=", "make", "(", "[", "]", "orderBy", ",", "0", ",", "1", ")", "\n", "for", "len", "(", "order", ")", ">", "0", "{", "o", ",", "rest", ":=", "order", "[", "0", "]", ",", "order", "[", "1", ":", "]", "\n", "if", "_", ",", "ok", ":=", "o", ".", "(", "string", ")", ";", "ok", "{", "if", "len", "(", "rest", ")", "<", "1", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "// OrderBy(\"column\", genmai.DESC)", "orderbys", "=", "append", "(", "orderbys", ",", "c", ".", "orderBy", "(", "nil", ",", "o", ",", "rest", "[", "0", "]", ")", ")", "\n", "<mask>", "=", "rest", "[", "1", ":", "]", "\n", "continue", "\n", "}", "\n", "if", "len", "(", "rest", ")", "<", "2", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "// OrderBy(tbl{}, \"column\", genmai.DESC)", "orderbys", "=", "append", "(", "orderbys", ",", "c", ".", "orderBy", "(", "o", ",", "rest", "[", "0", "]", ",", "rest", "[", "1", "]", ")", ")", "\n", "order", "=", "rest", "[", "2", ":", "]", "\n", "}", "\n", "return", "c", ".", "appendQuery", "(", "300", ",", "OrderBy", ",", "orderbys", ")", "\n", "}" ]
3,853
all-3854
[ "Stop", "stops", "a", "running", "PushCenter", "." ]
[ "func", "(", "p", "*", "PushCenter", ")", "Stop", "(", ")", "error", "{", "if", "!", "p", ".", "isRunning", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "p", ".", "stop", "<-", "<mask>", "\n", "p", ".", "isRunning", "=", "false", "\n\n", "return", "nil", "\n", "}" ]
3,854
all-3855
[ "newTokenBucket", "returns", "a", "bucket", "containing", "capacity", "tokens", "refilled", "at", "a", "rate", "of", "one", "token", "per", "tokenInterval", "." ]
[ "func", "newTokenBucket", "(", "capacity", "int64", ",", "tokenInterval", "time", ".", "Duration", ")", "*", "tokenBucket", "{", "tb", ":=", "tokenBucket", "{", "capacity", ":", "capacity", ",", "tokenInterval", ":", "tokenInterval", ",", "refillDuration", ":", "tokenInterval", "*", "<mask>", ".", "Duration", "(", "capacity", ")", "}", "\n\n", "tb", ".", "earliestUnspentToken", "=", "tb", ".", "capacityToken", "(", ")", "\n\n", "return", "&", "tb", "\n", "}" ]
3,855
all-3856
[ "Repaints", "everything", "on", "the", "screen" ]
[ "func", "RefreshScreen", "(", ")", "{", "comp", ".", "BeginUpdate", "(", ")", "\n", "term", ".", "Clear", "(", "ColorWhite", ",", "ColorBlack", ")", "\n", "comp", ".", "EndUpdate", "(", ")", "\n\n", "windows", ":=", "comp", ".", "getWindowList", "(", ")", "\n", "for", "_", ",", "wnd", ":=", "range", "windows", "{", "v", ":=", "wnd", ".", "(", "*", "Window", ")", "\n", "if", "v", ".", "Visible", "(", ")", "{", "wnd", ".", "Draw", "(", ")", "\n\n", "WindowManager", "(", ")", ".", "BeginUpdate", "(", ")", "\n", "PushAttributes", "(", ")", "\n", "term", ".", "Flush", "(", ")", "\n", "PopAttributes", "(", ")", "\n", "WindowManager", "(", ")", ".", "EndUpdate", "(", ")", "\n\n", "}", "\n", "}", "\n\n", "comp", ".", "BeginUpdate", "(", ")", "\n", "<mask>", ".", "Flush", "(", ")", "\n", "comp", ".", "EndUpdate", "(", ")", "\n", "}" ]
3,856
all-3857
[ "send", "sends", "an", "event", "on", "the", "event", "channel", "aborting", "if", "either", "the", "passed", "or", "the", "internal", "context", "expire", "." ]
[ "func", "(", "e", "*", "eventChannel", ")", "send", "(", "ctx", "context", ".", "<mask>", ",", "ev", "*", "QueryEvent", ")", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "// Closed.", "if", "e", ".", "ch", "==", "nil", "{", "e", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "\n", "}", "\n", "// in case the passed context is unrelated, wait on both.", "select", "{", "case", "e", ".", "ch", "<-", "ev", ":", "case", "<-", "e", ".", "ctx", ".", "Done", "(", ")", ":", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "}", "\n", "e", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
3,857
all-3858
[ "IsExported", "returns", "true", "if", "the", "function", "is", "exported", "." ]
[ "func", "(", "f", "*", "Func", ")", "IsExported", "(", ")", "bool", "{", "name", ":=", "f", ".", "Name", "(", ")", "\n", "parts", ":=", "strings", ".", "Split", "(", "name", ",", "\"", "\"", ")", "\n", "r", ",", "_", ":=", "utf8", ".", "DecodeRuneInString", "(", "parts", "[", "len", "(", "parts", ")", "-", "1", "]", ")", "\n", "if", "unicode", ".", "ToUpper", "(", "r", ")", "==", "r", "{", "return", "true", "\n", "}", "\n", "return", "f", ".", "PkgName", "(", ")", "==", "\"", "\"", "&&", "<mask>", "==", "\"", "\"", "\n", "}" ]
3,858
all-3859
[ "RegisterPlugin", "registers", "a", "plugin", "by", "name", ".", "This", "is", "expected", "to", "happen", "during", "app", "startup", "." ]
[ "func", "RegisterProvider", "(", "name", "string", ",", "factory", "ProvidersFactory", ")", "{", "providersMutex", ".", "Lock", "(", ")", "\n", "defer", "providersMutex", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "found", ":=", "providers", "[", "name", "]", ";", "found", "{", "logger", ".", "Get", "(", ")", ".", "Critical", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "providers", "[", "<mask>", "]", "=", "factory", "\n", "}" ]
3,859
all-3860
[ "Alloc", "opens", "a", "DB", "if", "not", "openned", "yet", ".", "It", "adds", "a", "reference", "if", "already", "openned", "." ]
[ "func", "(", "b", "*", "RefCountBox", ")", "Alloc", "(", ")", "(", "DB", ",", "error", ")", "{", "b", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "Unlock", "(", ")", "\n\n", "if", "b", ".", "db", ".", "DB", "==", "nil", "{", "if", "b", ".", "DataPath", "==", "nil", "{", "return", "DB", "{", "}", ",", "errorsp", ".", "WithStacks", "(", "ErrBoxDataPathNotSpecified", ")", "\n", "}", "\n", "var", "db", "<mask>", "\n", "var", "err", "error", "\n", "if", "b", ".", "OpenFunc", "==", "nil", "{", "db", ",", "err", "=", "Open", "(", "b", ".", "DataPath", "(", ")", ",", "0644", ",", "nil", ")", "\n", "}", "else", "{", "db", ",", "err", "=", "b", ".", "OpenFunc", "(", "b", ".", "DataPath", "(", ")", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "DB", "{", "}", ",", "errorsp", ".", "WithStacks", "(", "err", ")", "\n", "}", "\n", "b", ".", "db", ",", "b", ".", "count", "=", "db", ",", "0", "\n", "}", "\n", "b", ".", "count", "++", "\n", "return", "b", ".", "db", ",", "nil", "\n", "}" ]
3,860
all-3861
[ "WithRequireLeader", "requires", "client", "requests", "to", "only", "succeed", "when", "the", "cluster", "has", "a", "leader", "." ]
[ "func", "WithRequireLeader", "(", "ctx", "context", ".", "Context", ")", "context", ".", "Context", "{", "<mask>", ":=", "metadata", ".", "Pairs", "(", "rpctypes", ".", "MetadataRequireLeaderKey", ",", "rpctypes", ".", "MetadataHasLeader", ")", "\n", "return", "metadata", ".", "NewOutgoingContext", "(", "ctx", ",", "md", ")", "\n", "}" ]
3,861
all-3862
[ "Errf", "is", "a", "short", "-", "hand", "version", "of", "Errorf" ]
[ "func", "(", "b", "*", "Base", ")", "Errf", "(", "msg", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "b", ".", "Errorf", "(", "<mask>", ",", "a", "...", ")", "\n", "}" ]
3,862
all-3863
[ "GetCopyright", "is", "a", "wrapper", "around", "gtk_about_dialog_get_copyright", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "GetCopyright", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_about_dialog_get_copyright", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
3,863
all-3864
[ "SetAttributesAsText", "sets", "attributes", "on", "element", "with", "given", "id", ".", "This", "method", "is", "useful", "when", "user", "edits", "some", "existing", "attribute", "value", "and", "types", "in", "several", "attribute", "name", "/", "value", "pairs", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "DOM#method", "-", "setAttributesAsText", "parameters", ":", "nodeID", "-", "Id", "of", "the", "element", "to", "set", "attributes", "for", ".", "text", "-", "Text", "with", "a", "number", "of", "attributes", ".", "Will", "parse", "this", "text", "using", "HTML", "parser", "." ]
[ "func", "SetAttributesAsText", "(", "nodeID", "cdp", ".", "NodeID", ",", "text", "string", ")", "*", "SetAttributesAsTextParams", "{", "return", "&", "SetAttributesAsTextParams", "{", "NodeID", ":", "nodeID", ",", "<mask>", ":", "text", ",", "}", "\n", "}" ]
3,864
all-3865
[ "StoragePoolNodeVolumesGetType", "returns", "all", "storage", "volumes", "attached", "to", "a", "given", "storage", "pool", "of", "a", "given", "volume", "type", "on", "the", "current", "node", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolNodeVolumesGetType", "(", "volumeType", "int", ",", "poolID", "int64", ")", "(", "[", "]", "string", ",", "<mask>", ")", "{", "return", "c", ".", "StoragePoolVolumesGetType", "(", "\"", "\"", ",", "volumeType", ",", "poolID", ",", "c", ".", "nodeID", ")", "\n", "}" ]
3,865
all-3866
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "Info", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
3,866
all-3867
[ "query", "the", "fragment", "color", "index", "of", "a", "named", "variable", "within", "a", "program" ]
[ "func", "GetProgramResourceLocationIndex", "(", "<mask>", "uint32", ",", "programInterface", "uint32", ",", "name", "*", "uint8", ")", "int32", "{", "ret", ":=", "C", ".", "glowGetProgramResourceLocationIndex", "(", "gpGetProgramResourceLocationIndex", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLenum", ")", "(", "programInterface", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "return", "(", "int32", ")", "(", "ret", ")", "\n", "}" ]
3,867
all-3868
[ "newRevision", "creates", "a", "new", "instance", "of", "Revisonal", "compactor", "that", "purges", "the", "log", "older", "than", "retention", "revisions", "from", "the", "current", "revision", "." ]
[ "func", "newRevision", "(", "lg", "*", "zap", ".", "Logger", ",", "clock", "clockwork", ".", "Clock", ",", "retention", "int64", ",", "rg", "RevGetter", ",", "c", "Compactable", ")", "*", "Revision", "{", "rc", ":=", "&", "Revision", "{", "lg", ":", "lg", ",", "clock", ":", "<mask>", ",", "retention", ":", "retention", ",", "rg", ":", "rg", ",", "c", ":", "c", ",", "}", "\n", "rc", ".", "ctx", ",", "rc", ".", "cancel", "=", "context", ".", "WithCancel", "(", "context", ".", "Background", "(", ")", ")", "\n", "return", "rc", "\n", "}" ]
3,868
all-3869
[ "HasAcceptEncodingBytes", "returns", "true", "if", "the", "header", "contains", "the", "given", "Accept", "-", "Encoding", "value", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "HasAcceptEncodingBytes", "(", "acceptEncoding", "[", "]", "byte", ")", "bool", "{", "ae", ":=", "h", ".", "peek", "(", "strAcceptEncoding", ")", "\n", "n", ":=", "bytes", ".", "<mask>", "(", "ae", ",", "acceptEncoding", ")", "\n", "if", "n", "<", "0", "{", "return", "false", "\n", "}", "\n", "b", ":=", "ae", "[", "n", "+", "len", "(", "acceptEncoding", ")", ":", "]", "\n", "if", "len", "(", "b", ")", ">", "0", "&&", "b", "[", "0", "]", "!=", "','", "{", "return", "false", "\n", "}", "\n", "if", "n", "==", "0", "{", "return", "true", "\n", "}", "\n", "return", "ae", "[", "n", "-", "1", "]", "==", "' '", "\n", "}" ]
3,869
all-3870
[ "fixBackupStoragePool", "changes", "the", "pool", "information", "in", "the", "backup", ".", "yaml", ".", "This", "is", "done", "only", "if", "the", "provided", "pool", "doesn", "t", "exist", ".", "In", "this", "case", "the", "pool", "of", "the", "default", "profile", "will", "be", "used", "." ]
[ "func", "backupFixStoragePool", "(", "c", "*", "db", ".", "Cluster", ",", "b", "backupInfo", ",", "useDefaultPool", "bool", ")", "error", "{", "var", "poolName", "string", "\n\n", "if", "useDefaultPool", "{", "// Get the default profile", "_", ",", "profile", ",", "err", ":=", "c", ".", "ProfileGet", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "_", ",", "v", ",", "err", ":=", "shared", ".", "GetRootDiskDevice", "(", "profile", ".", "Devices", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "poolName", "=", "v", "[", "\"", "\"", "]", "\n", "}", "else", "{", "poolName", "=", "b", ".", "Pool", "\n", "}", "\n\n", "// Get the default's profile pool", "_", ",", "pool", ",", "err", ":=", "c", ".", "StoragePoolGet", "(", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "f", ":=", "func", "(", "path", "string", ")", "error", "{", "// Read in the backup.yaml file.", "backup", ",", "err", ":=", "slurpBackupFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "rootDiskDeviceFound", ":=", "false", "\n\n", "// Change the pool in the backup.yaml", "backup", ".", "Pool", "=", "pool", "\n", "if", "backup", ".", "Container", ".", "Devices", "!=", "nil", "{", "devName", ",", "_", ",", "err", ":=", "shared", ".", "GetRootDiskDevice", "(", "backup", ".", "Container", ".", "Devices", ")", "\n", "if", "err", "==", "nil", "{", "backup", ".", "Container", ".", "Devices", "[", "devName", "]", "[", "\"", "\"", "]", "=", "poolName", "\n", "rootDiskDeviceFound", "=", "true", "\n", "}", "\n", "}", "\n\n", "if", "backup", ".", "Container", ".", "ExpandedDevices", "!=", "nil", "{", "devName", ",", "_", ",", "err", ":=", "shared", ".", "GetRootDiskDevice", "(", "backup", ".", "Container", ".", "ExpandedDevices", ")", "\n", "if", "err", "==", "nil", "{", "backup", ".", "Container", ".", "ExpandedDevices", "[", "devName", "]", "[", "\"", "\"", "]", "=", "poolName", "\n", "rootDiskDeviceFound", "=", "true", "\n", "}", "\n", "}", "\n\n", "if", "!", "rootDiskDeviceFound", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "file", ",", "err", ":=", "os", ".", "Create", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n\n", "<mask>", ",", "err", ":=", "yaml", ".", "Marshal", "(", "&", "backup", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "_", ",", "err", "=", "file", ".", "Write", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}", "\n\n", "err", "=", "f", "(", "shared", ".", "VarPath", "(", "\"", "\"", ",", "pool", ".", "Name", ",", "\"", "\"", ",", "b", ".", "Name", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "_", ",", "snap", ":=", "range", "b", ".", "Snapshots", "{", "err", "=", "f", "(", "shared", ".", "VarPath", "(", "\"", "\"", ",", "pool", ".", "Name", ",", "\"", "\"", ",", "b", ".", "Name", ",", "snap", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,870
all-3871
[ "UpdateTeamMembership", "adds", "the", "user", "to", "the", "team", "and", "/", "or", "updates", "their", "role", "in", "that", "team", ".", "If", "the", "user", "is", "not", "a", "member", "of", "the", "org", "GitHub", "will", "invite", "them", "to", "become", "an", "outside", "collaborator", "setting", "their", "status", "to", "pending", ".", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "teams", "/", "members", "/", "#add", "-", "or", "-", "update", "-", "team", "-", "membership" ]
[ "func", "(", "c", "*", "Client", ")", "UpdateTeamMembership", "(", "id", "int", ",", "user", "string", ",", "maintainer", "bool", ")", "(", "*", "TeamMembership", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "id", ",", "user", ",", "maintainer", ")", "\n", "if", "c", ".", "fake", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "tm", ":=", "TeamMembership", "{", "}", "\n", "if", "maintainer", "{", "tm", ".", "Role", "=", "RoleMaintainer", "\n", "}", "else", "{", "tm", ".", "<mask>", "=", "RoleMember", "\n", "}", "\n\n", "if", "c", ".", "dry", "{", "return", "&", "tm", ",", "nil", "\n", "}", "\n\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPut", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "id", ",", "user", ")", ",", "requestBody", ":", "&", "tm", ",", "exitCodes", ":", "[", "]", "int", "{", "200", "}", ",", "}", ",", "&", "tm", ")", "\n", "return", "&", "tm", ",", "err", "\n", "}" ]
3,871
all-3872
[ "retrieveSSMSecretValuesByRegion", "reads", "secret", "values", "from", "cache", "first", "if", "not", "exists", "batches", "secrets", "based", "on", "field", "valueFrom", "and", "call", "retrieveSSMSecretValues", "to", "retrieve", "values", "from", "SSM" ]
[ "func", "(", "secret", "*", "SSMSecretResource", ")", "retrieveSSMSecretValuesByRegion", "(", "region", "string", ",", "secrets", "[", "]", "apicontainer", ".", "Secret", ",", "iamCredentials", "credentials", ".", "IAMRoleCredentials", ",", "wg", "*", "sync", ".", "WaitGroup", ",", "errorEvents", "chan", "error", ")", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "<mask>", ",", "secret", ".", "taskARN", ")", "\n", "defer", "wg", ".", "Done", "(", ")", "\n\n", "var", "wgPerRegion", "sync", ".", "WaitGroup", "\n", "var", "secretNames", "[", "]", "string", "\n\n", "for", "_", ",", "s", ":=", "range", "secrets", "{", "secretKey", ":=", "s", ".", "GetSecretResourceCacheKey", "(", ")", "\n", "if", "_", ",", "ok", ":=", "secret", ".", "GetCachedSecretValue", "(", "secretKey", ")", ";", "ok", "{", "continue", "\n", "}", "\n", "secretNames", "=", "append", "(", "secretNames", ",", "s", ".", "ValueFrom", ")", "\n", "if", "len", "(", "secretNames", ")", "==", "MaxBatchNum", "{", "secretNamesTmp", ":=", "make", "(", "[", "]", "string", ",", "MaxBatchNum", ")", "\n", "copy", "(", "secretNamesTmp", ",", "secretNames", ")", "\n", "wgPerRegion", ".", "Add", "(", "1", ")", "\n", "go", "secret", ".", "retrieveSSMSecretValues", "(", "region", ",", "secretNamesTmp", ",", "iamCredentials", ",", "&", "wgPerRegion", ",", "errorEvents", ")", "\n", "secretNames", "=", "[", "]", "string", "{", "}", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "secretNames", ")", ">", "0", "{", "wgPerRegion", ".", "Add", "(", "1", ")", "\n", "go", "secret", ".", "retrieveSSMSecretValues", "(", "region", ",", "secretNames", ",", "iamCredentials", ",", "&", "wgPerRegion", ",", "errorEvents", ")", "\n", "}", "\n", "wgPerRegion", ".", "Wait", "(", ")", "\n", "}" ]
3,872
all-3873
[ "DeleteText", "()", "is", "a", "wrapper", "around", "gtk_entry_buffer_delete_text", "()", "." ]
[ "func", "(", "v", "*", "EntryBuffer", ")", "DeleteText", "(", "<mask>", "uint", ",", "nChars", "int", ")", "uint", "{", "c", ":=", "C", ".", "gtk_entry_buffer_delete_text", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "position", ")", ",", "C", ".", "gint", "(", "nChars", ")", ")", "\n", "return", "uint", "(", "c", ")", "\n", "}" ]
3,873
all-3874
[ "Create", "wraps", "the", "creation", "of", "a", "virtual", "machine", "and", "the", "subsequent", "waiting", "of", "the", "task", ".", "A", "higher", "-", "level", "virtual", "machine", "object", "is", "returned", "." ]
[ "func", "Create", "(", "c", "*", "govmomi", ".", "Client", ",", "f", "*", "object", ".", "Folder", ",", "s", "types", ".", "VirtualMachineConfigSpec", ",", "p", "*", "object", ".", "ResourcePool", ",", "h", "*", "object", ".", "HostSystem", ")", "(", "*", "object", ".", "VirtualMachine", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "InventoryPath", ",", "s", ".", "Name", ")", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "var", "task", "*", "object", ".", "Task", "\n", "// Check to see if the resource pool is a vApp", "vc", ",", "err", ":=", "vappcontainer", ".", "FromID", "(", "c", ",", "p", ".", "Reference", "(", ")", ".", "Value", ")", "\n", "if", "err", "!=", "nil", "{", "if", "!", "viapi", ".", "IsManagedObjectNotFoundError", "(", "err", ")", "{", "return", "nil", ",", "err", "\n", "}", "\n", "task", ",", "err", "=", "f", ".", "CreateVM", "(", "ctx", ",", "s", ",", "p", ",", "h", ")", "\n", "}", "else", "{", "task", ",", "err", "=", "vc", ".", "CreateChildVM", "(", "ctx", ",", "s", ",", "h", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "tctx", ",", "tcancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "tcancel", "(", ")", "\n", "result", ",", "err", ":=", "task", ".", "WaitForResult", "(", "tctx", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "InventoryPath", ",", "s", ".", "Name", ")", ",", "result", ".", "Result", ".", "(", "types", ".", "ManagedObjectReference", ")", ".", "Value", ")", "\n", "return", "FromMOID", "(", "c", ",", "result", ".", "Result", ".", "(", "<mask>", ".", "ManagedObjectReference", ")", ".", "Value", ")", "\n", "}" ]
3,874
all-3875
[ "Handler", "returns", "a", "handler", "that", "is", "registered", "under", "the", "provided", "code", "." ]
[ "func", "(", "r", "MapErrorRegistry", ")", "Handler", "(", "<mask>", "int", ")", "func", "(", "body", "[", "]", "byte", ")", "error", "{", "return", "r", ".", "handlers", "[", "code", "]", "\n", "}" ]
3,875
all-3876
[ "CharAtF", "is", "the", "filter", "form", "of", "CharAt", "." ]
[ "func", "CharAtF", "(", "index", "int", ")", "func", "(", "string", ")", "string", "{", "return", "func", "(", "s", "string", ")", "string", "{", "return", "CharAt", "(", "s", ",", "<mask>", ")", "\n", "}", "\n", "}" ]
3,876
all-3877
[ "SplitRelativeFolder", "is", "a", "convenience", "method", "that", "returns", "the", "parent", "folder", "for", "the", "result", "of", "SplitRelative", "on", "the", "supplied", "path", ".", "This", "is", "generally", "useful", "to", "get", "the", "folder", "for", "a", "managed", "entity", "versus", "getting", "a", "full", "relative", "path", ".", "If", "you", "want", "that", "use", "SplitRelative", "instead", "." ]
[ "func", "(", "p", "RootPathParticle", ")", "SplitRelativeFolder", "(", "inventoryPath", "string", ")", "(", "string", ",", "error", ")", "{", "relative", ",", "err", ":=", "p", ".", "SplitRelative", "(", "inventoryPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "inventoryPath", ",", "err", "\n", "}", "\n", "return", "path", ".", "Dir", "(", "<mask>", ")", ",", "nil", "\n", "}" ]
3,877
all-3878
[ "MenuItemNewSubmenu", "is", "a", "wrapper", "around", "g_menu_item_new_submenu", "()", "." ]
[ "func", "MenuItemNewSubmenu", "(", "label", "string", ",", "submenu", "*", "MenuModel", ")", "*", "MenuItem", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "<mask>", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "c", ":=", "C", ".", "g_menu_item_new_submenu", "(", "cstr1", ",", "submenu", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "wrapMenuItem", "(", "wrapObject", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", "\n", "}" ]
3,878
all-3879
[ "GetNthPage", "is", "a", "wrapper", "around", "gtk_assistant_get_nth_page", "()", "." ]
[ "func", "(", "v", "*", "Assistant", ")", "GetNthPage", "(", "pageNum", "int", ")", "(", "*", "Widget", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_assistant_get_nth_page", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "pageNum", ")", ")", "\n", "if", "c", "==", "nil", "{", "<mask>", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pageNum", ")", "\n", "}", "\n\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapWidget", "(", "obj", ")", ",", "nil", "\n", "}" ]
3,879
all-3880
[ "GetValue", "returns", "the", "Value", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefMarker", ")", "GetValue", "(", ")", "string", "{", "if", "t", "==", "nil", "||", "t", ".", "Value", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "<mask>", "\n", "}" ]
3,880
all-3881
[ "SetCookieBytesK", "sets", "key", ":", "value", "cookies", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "SetCookieBytesK", "(", "key", "[", "]", "byte", ",", "value", "string", ")", "{", "h", ".", "SetCookie", "(", "b2s", "(", "key", ")", ",", "<mask>", ")", "\n", "}" ]
3,881
all-3882
[ "dwarfSize", "is", "used", "to", "compute", "the", "size", "of", "a", "DWARF", "type", ".", "dt", ".", "Size", "()", "is", "wrong", "when", "it", "returns", "a", "negative", "number", ".", "This", "function", "implements", "just", "enough", "to", "correct", "the", "bad", "behavior", "." ]
[ "func", "dwarfSize", "(", "dt", "dwarf", ".", "Type", ",", "ptrSize", "int64", ")", "int64", "{", "s", ":=", "dt", ".", "Size", "(", ")", "\n", "if", "s", ">=", "0", "{", "return", "s", "\n", "}", "\n", "<mask>", "x", ":=", "dt", ".", "(", "type", ")", "{", "case", "*", "dwarf", ".", "FuncType", ":", "return", "ptrSize", "// Fix for issue 21097.", "\n", "case", "*", "dwarf", ".", "ArrayType", ":", "return", "x", ".", "Count", "*", "dwarfSize", "(", "x", ".", "Type", ",", "ptrSize", ")", "\n", "case", "*", "dwarf", ".", "TypedefType", ":", "return", "dwarfSize", "(", "x", ".", "Type", ",", "ptrSize", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "x", ",", "x", ")", ")", "\n", "}", "\n", "}" ]
3,882
all-3883
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetShowViewportSizeOnResizeParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
3,883
all-3884
[ "Close", "shuts", "down", "port", "forwarding", "." ]
[ "func", "(", "f", "*", "PortForwarder", ")", "Close", "(", ")", "{", "defer", "f", ".", "logger", ".", "Close", "(", ")", "\n\n", "f", ".", "stopChansLock", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "stopChansLock", ".", "Unlock", "(", ")", "\n\n", "if", "f", ".", "shutdown", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "f", ".", "shutdown", "=", "true", "\n\n", "for", "_", ",", "stopChan", ":=", "<mask>", "f", ".", "stopChans", "{", "close", "(", "stopChan", ")", "\n", "}", "\n", "}" ]
3,884
all-3885
[ "Return", "a", "slice", "of", "w", ".", "RS", "allowing", "the", "start", "and", "stop", "to", "be", "out", "of", "bounds", "." ]
[ "func", "(", "w", "*", "SnowballWord", ")", "slice", "(", "start", ",", "stop", "int", ")", "[", "]", "rune", "{", "startMin", ":=", "0", "\n", "if", "start", "<", "startMin", "{", "start", "=", "startMin", "\n", "}", "\n", "max", ":=", "len", "(", "w", ".", "RS", ")", "-", "1", "\n", "if", "start", ">", "max", "{", "<mask>", "=", "max", "\n", "}", "\n", "if", "stop", ">", "max", "{", "stop", "=", "max", "\n", "}", "\n", "return", "w", ".", "RS", "[", "start", ":", "stop", "]", "\n", "}" ]
3,885
all-3886
[ "HashPassword", "computes", "encoded", "hash", "of", "the", "password", "." ]
[ "func", "HashPassword", "(", "<mask>", ",", "salt", "string", ")", "(", "Base64String", ",", "error", ")", "{", "salted", ":=", "[", "]", "byte", "(", "password", "+", "salt", ")", "\n", "passwordHash", ",", "err", ":=", "bcrypt", ".", "GenerateFromPassword", "(", "salted", ",", "bcrypt", ".", "DefaultCost", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "FromBytes", "(", "passwordHash", ")", ",", "nil", "\n", "}" ]
3,886
all-3887
[ "ChangeContactSvcNotificationTimeperiod", "creates", "a", "new", "CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD", "Nagios", "command", ".", "Changes", "the", "service", "notification", "timeperiod", "for", "a", "particular", "contact", "to", "what", "is", "specified", "by", "the", "notification_timeperiod", "option", ".", "The", "notification_timeperiod", "option", "should", "be", "the", "short", "name", "of", "the", "timeperiod", "that", "is", "to", "be", "used", "as", "the", "contact", "s", "service", "notification", "timeperiod", ".", "The", "timeperiod", "must", "have", "been", "configured", "in", "Nagios", "before", "it", "was", "last", "(", "re", ")", "started", "." ]
[ "func", "ChangeContactSvcNotificationTimeperiod", "(", "contact_name", "string", ",", "notification_timeperiod", "string", ",", ")", "*", "livestatus", ".", "Command", "{", "<mask>", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "contact_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "notification_timeperiod", ")", ",", ")", "\n", "}" ]
3,887
all-3888
[ "Float64", "defines", "a", "float64", "flag", "with", "specified", "name", "default", "value", "and", "usage", "string", ".", "The", "return", "value", "is", "the", "address", "of", "a", "float64", "variable", "that", "stores", "the", "value", "of", "the", "flag", "." ]
[ "func", "Float64", "(", "name", "string", ",", "value", "float64", ",", "usage", "string", ")", "*", "float64", "{", "return", "EnvironmentFlags", ".", "Float64", "(", "<mask>", ",", "value", ",", "usage", ")", "\n", "}" ]
3,888
all-3889
[ "Delete", "removes", "a", "relayItem", "completely", "(", "without", "leaving", "a", "tombstone", ")", ".", "It", "returns", "the", "deleted", "item", "along", "with", "a", "bool", "indicating", "whether", "we", "completed", "a", "relayed", "call", "." ]
[ "func", "(", "r", "*", "relayItems", ")", "Delete", "(", "id", "uint32", ")", "(", "relayItem", ",", "bool", ")", "{", "r", ".", "Lock", "(", ")", "\n", "item", ",", "ok", ":=", "r", ".", "items", "[", "id", "]", "\n", "if", "!", "ok", "{", "r", ".", "Unlock", "(", ")", "\n", "r", ".", "logger", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "id", "}", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "item", ",", "false", "\n", "}", "\n", "delete", "(", "r", ".", "items", ",", "<mask>", ")", "\n", "if", "item", ".", "tomb", "{", "r", ".", "tombs", "--", "\n", "}", "\n", "r", ".", "Unlock", "(", ")", "\n\n", "item", ".", "timeout", ".", "Stop", "(", ")", "\n", "item", ".", "timeout", ".", "Release", "(", ")", "\n", "return", "item", ",", "!", "item", ".", "tomb", "\n", "}" ]
3,889
all-3890
[ "Value", "that", "has", "previously", "stored", "on", "the", "context", "." ]
[ "func", "(", "d", "*", "DefaultContext", ")", "<mask>", "(", "key", "interface", "{", "}", ")", "interface", "{", "}", "{", "if", "k", ",", "ok", ":=", "key", ".", "(", "string", ")", ";", "ok", "{", "d", ".", "moot", ".", "RLock", "(", ")", "\n", "defer", "d", ".", "moot", ".", "RUnlock", "(", ")", "\n", "if", "v", ",", "ok", ":=", "d", ".", "data", "[", "k", "]", ";", "ok", "{", "return", "v", "\n", "}", "\n", "}", "\n", "return", "d", ".", "Context", ".", "Value", "(", "key", ")", "\n", "}" ]
3,890
all-3891
[ "ReadTail", "reads", "the", "last", "n", "bytes", "from", "a", "file", "in", "GCS" ]
[ "func", "(", "a", "*", "GCSArtifact", ")", "ReadTail", "(", "n", "int64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "gzipped", ",", "err", ":=", "a", ".", "gzipped", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "gzipped", "{", "return", "nil", ",", "lenses", ".", "ErrGzipOffsetRead", "\n", "}", "\n", "size", ",", "err", ":=", "a", ".", "Size", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "var", "offset", "int64", "\n", "if", "n", ">=", "size", "{", "offset", "=", "0", "\n", "}", "else", "{", "offset", "=", "size", "-", "n", "\n", "}", "\n", "reader", ",", "err", ":=", "a", ".", "handle", ".", "NewRangeReader", "(", "a", ".", "ctx", ",", "offset", ",", "-", "1", ")", "\n", "defer", "reader", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "&&", "err", "!=", "<mask>", ".", "EOF", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "read", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "reader", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "read", ",", "nil", "\n", "}" ]
3,891
all-3892
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform3f", "(", "<mask>", "int32", ",", "v0", "float32", ",", "v1", "float32", ",", "v2", "float32", ")", "{", "C", ".", "glowUniform3f", "(", "gpUniform3f", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v0", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v1", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v2", ")", ")", "\n", "}" ]
3,892
all-3893
[ "HasTitleSize", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "HasTitleSize", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "TitleSize", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
3,893
all-3894
[ "ensure", "will", "ensure", "binary", "is", "on", "path", "or", "return", "an", "error", "with", "install", "message", "." ]
[ "func", "ensure", "(", "binary", ",", "install", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "exec", ".", "LookPath", "(", "binary", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "binary", ",", "<mask>", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
3,894
all-3895
[ "Pad", "pads", "string", "s", "on", "both", "sides", "with", "c", "until", "it", "has", "length", "of", "n", "." ]
[ "func", "Pad", "(", "s", ",", "c", "string", ",", "n", "int", ")", "string", "{", "L", ":=", "len", "(", "s", ")", "\n", "if", "L", ">=", "n", "{", "return", "s", "\n", "}", "\n", "n", "-=", "L", "\n\n", "left", ":=", "strings", ".", "Repeat", "(", "c", ",", "int", "(", "math", ".", "Ceil", "(", "float64", "(", "n", ")", "/", "2", ")", ")", ")", "\n", "<mask>", ":=", "strings", ".", "Repeat", "(", "c", ",", "int", "(", "math", ".", "Floor", "(", "float64", "(", "n", ")", "/", "2", ")", ")", ")", "\n", "return", "left", "+", "s", "+", "right", "\n", "}" ]
3,895
all-3896
[ "Between", "extracts", "a", "string", "between", "left", "and", "right", "strings", "." ]
[ "func", "Between", "(", "s", ",", "left", ",", "right", "string", ")", "string", "{", "l", ":=", "len", "(", "left", ")", "\n", "startPos", ":=", "strings", ".", "<mask>", "(", "s", ",", "left", ")", "\n", "if", "startPos", "<", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "endPos", ":=", "IndexOf", "(", "s", ",", "right", ",", "startPos", "+", "l", ")", "\n", "//log.Printf(\"%s: left %s right %s start %d end %d\", s, left, right, startPos+l, endPos)", "if", "endPos", "<", "0", "{", "return", "\"", "\"", "\n", "}", "else", "if", "right", "==", "\"", "\"", "{", "return", "s", "[", "endPos", ":", "]", "\n", "}", "else", "{", "return", "s", "[", "startPos", "+", "l", ":", "endPos", "]", "\n", "}", "\n", "}" ]
3,896
all-3897
[ "Produce", "makes", "ProducerFunc", "fit", "the", "Producer", "interface", "." ]
[ "func", "(", "fn", "ProducerFunc", ")", "Produce", "(", "ctx", "telnet", ".", "<mask>", ",", "name", "string", ",", "args", "...", "string", ")", "Handler", "{", "return", "fn", "(", "ctx", ",", "name", ",", "args", "...", ")", "\n", "}" ]
3,897
all-3898
[ "ListCmd", "represents", "the", "list", "command" ]
[ "func", "ListCmd", "(", ")", "*", "cobra", ".", "Command", "{", "var", "lo", "=", "&", "cli", ".", "ListOptions", "{", "}", "\n", "var", "cmd", "=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Long", ":", "`List the states available in the _state directory`", ",", "Run", ":", "func", "(", "cmd", "*", "cobra", ".", "Command", ",", "args", "[", "]", "string", ")", "{", "if", "err", ":=", "runList", "(", "lo", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Critical", "(", "err", ".", "Error", "(", ")", ")", "\n", "<mask>", ".", "Exit", "(", "1", ")", "\n", "}", "\n", "}", ",", "}", "\n\n", "fs", ":=", "cmd", ".", "Flags", "(", ")", "\n\n", "bindCommonStateStoreFlags", "(", "&", "lo", ".", "StateStoreOptions", ",", "fs", ")", "\n", "bindCommonAwsFlags", "(", "&", "lo", ".", "AwsOptions", ",", "fs", ")", "\n\n", "fs", ".", "BoolVarP", "(", "&", "noHeaders", ",", "keyNoHeaders", ",", "\"", "\"", ",", "viper", ".", "GetBool", "(", "keyNoHeaders", ")", ",", "desNoHeaders", ")", "\n\n", "return", "cmd", "\n", "}" ]
3,898
all-3899
[ "Close", "closes", "pipe", "connections", "." ]
[ "func", "(", "pc", "*", "PipeConns", ")", "Close", "(", ")", "error", "{", "pc", ".", "stopChLock", ".", "Lock", "(", ")", "\n", "select", "{", "case", "<-", "pc", ".", "stopCh", ":", "<mask>", ":", "close", "(", "pc", ".", "stopCh", ")", "\n", "}", "\n", "pc", ".", "stopChLock", ".", "Unlock", "(", ")", "\n\n", "return", "nil", "\n", "}" ]
3,899
all-3900
[ "StoragePoolVolumesGet", "returns", "all", "storage", "volumes", "attached", "to", "a", "given", "storage", "pool", "on", "any", "node", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolVolumesGet", "(", "project", "string", ",", "poolID", "int64", ",", "volumeTypes", "[", "]", "int", ")", "(", "[", "]", "*", "api", ".", "StorageVolume", ",", "error", ")", "{", "var", "nodeIDs", "[", "]", "int", "\n\n", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "var", "err", "error", "\n", "nodeIDs", ",", "err", "=", "<mask>", ".", "SelectIntegers", "(", "tx", ".", "tx", ",", "`\nSELECT DISTINCT node_id\n FROM storage_volumes\n JOIN projects ON projects.id = storage_volumes.project_id\n WHERE (projects.name=? OR storage_volumes.type=?) AND storage_pool_id=?\n`", ",", "project", ",", "StoragePoolVolumeTypeCustom", ",", "poolID", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "volumes", ":=", "[", "]", "*", "api", ".", "StorageVolume", "{", "}", "\n\n", "for", "_", ",", "nodeID", ":=", "range", "nodeIDs", "{", "nodeVolumes", ",", "err", ":=", "c", ".", "storagePoolVolumesGet", "(", "project", ",", "poolID", ",", "int64", "(", "nodeID", ")", ",", "volumeTypes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "volumes", "=", "append", "(", "volumes", ",", "nodeVolumes", "...", ")", "\n", "}", "\n", "return", "volumes", ",", "nil", "\n", "}" ]