id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
18,700
all-18701
[ "GetTabLabelText", "()", "is", "a", "wrapper", "around", "gtk_notebook_get_tab_label_text", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "GetTabLabelText", "(", "child", "IWidget", ")", "(", "string", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_notebook_get_tab_label_text", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "goString", "(", "c", ")", ",", "nil", "\n", "}" ]
18,701
all-18702
[ "Setup", "RBAC" ]
[ "func", "(", "d", "*", "Daemon", ")", "setupRBACServer", "(", "rbacURL", "string", ",", "rbacKey", "string", ",", "rbacExpiry", "int64", ",", "rbacAgentURL", "string", ",", "rbacAgentUsername", "string", ",", "rbacAgentPrivateKey", "string", ",", "rbacAgentPublicKey", "string", ")", "error", "{", "if", "d", ".", "rbac", "!=", "nil", "||", "rbacURL", "==", "\"", "\"", "||", "rbacAgentURL", "==", "\"", "\"", "||", "rbacAgentUsername", "==", "\"", "\"", "||", "rbacAgentPrivateKey", "==", "\"", "\"", "||", "rbacAgentPublicKey", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "// Get a new server struct", "server", ",", "err", ":=", "rbac", ".", "NewServer", "(", "rbacURL", ",", "rbacKey", ",", "rbacAgentURL", ",", "rbacAgentUsername", ",", "rbacAgentPrivateKey", ",", "rbacAgentPublicKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Set projects helper", "server", ".", "ProjectsFunc", "=", "func", "(", ")", "(", "map", "[", "int64", "]", "string", ",", "error", ")", "{", "var", "result", "map", "[", "int64", "]", "string", "\n", "err", ":=", "d", ".", "cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "var", "err", "error", "\n", "result", ",", "err", "=", "tx", ".", "ProjectMap", "(", ")", "\n", "return", "err", "\n", "}", ")", "\n\n", "return", "result", ",", "err", "\n", "}", "\n\n", "// Perform full sync", "err", "=", "server", ".", "SyncProjects", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "server", ".", "StartStatusCheck", "(", ")", "\n\n", "d", ".", "rbac", "=", "<mask>", "\n\n", "// Enable candid authentication", "err", "=", "d", ".", "setupExternalAuthentication", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rbacURL", ")", ",", "rbacKey", ",", "rbacExpiry", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,702
all-18703
[ "Wrap", "returns", "a", "wrapped", "version", "of", "w", "that", "provides", "the", "exact", "same", "interface", "as", "w", ".", "Specifically", "if", "w", "implements", "any", "combination", "of", ":", "-", "http", ".", "Flusher", "-", "http", ".", "CloseNotifier", "-", "http", ".", "Hijacker", "-", "io", ".", "ReaderFrom", "-", "http", ".", "Pusher", "The", "wrapped", "version", "will", "implement", "the", "exact", "same", "combination", ".", "If", "no", "hooks", "are", "set", "the", "wrapped", "version", "also", "behaves", "exactly", "as", "w", ".", "Hooks", "targeting", "methods", "not", "supported", "by", "w", "are", "ignored", ".", "Any", "other", "hooks", "will", "intercept", "the", "method", "they", "target", "and", "may", "modify", "the", "call", "s", "arguments", "and", "/", "or", "return", "values", ".", "The", "CaptureMetrics", "implementation", "serves", "as", "a", "working", "example", "for", "how", "the", "hooks", "can", "be", "used", "." ]
[ "func", "Wrap", "(", "w", "http", ".", "ResponseWriter", ",", "hooks", "Hooks", ")", "http", ".", "ResponseWriter", "{", "rw", ":=", "&", "rw", "{", "w", ":", "w", ",", "h", ":", "hooks", "}", "\n", "_", ",", "i0", ":=", "w", ".", "(", "http", ".", "Flusher", ")", "\n", "_", ",", "i1", ":=", "w", ".", "(", "http", ".", "CloseNotifier", ")", "\n", "_", ",", "i2", ":=", "w", ".", "(", "http", ".", "Hijacker", ")", "\n", "_", ",", "i3", ":=", "w", ".", "(", "io", ".", "ReaderFrom", ")", "\n", "_", ",", "i4", ":=", "w", ".", "(", "http", ".", "Pusher", ")", "\n", "switch", "{", "// combination 1/32", "<mask>", "!", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "}", "{", "rw", "}", "\n", "// combination 2/32", "case", "!", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", "}", "\n", "// combination 3/32", "case", "!", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", "}", "\n", "// combination 4/32", "case", "!", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 5/32", "case", "!", "i0", "&&", "!", "i1", "&&", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Hijacker", "\n", "}", "{", "rw", ",", "rw", "}", "\n", "// combination 6/32", "case", "!", "i0", "&&", "!", "i1", "&&", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Hijacker", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 7/32", "case", "!", "i0", "&&", "!", "i1", "&&", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 8/32", "case", "!", "i0", "&&", "!", "i1", "&&", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 9/32", "case", "!", "i0", "&&", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "}", "{", "rw", ",", "rw", "}", "\n", "// combination 10/32", "case", "!", "i0", "&&", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 11/32", "case", "!", "i0", "&&", "i1", "&&", "!", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 12/32", "case", "!", "i0", "&&", "i1", "&&", "!", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 13/32", "case", "!", "i0", "&&", "i1", "&&", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 14/32", "case", "!", "i0", "&&", "i1", "&&", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 15/32", "case", "!", "i0", "&&", "i1", "&&", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 16/32", "case", "!", "i0", "&&", "i1", "&&", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 17/32", "case", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "}", "{", "rw", ",", "rw", "}", "\n", "// combination 18/32", "case", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 19/32", "case", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 20/32", "case", "i0", "&&", "!", "i1", "&&", "!", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 21/32", "case", "i0", "&&", "!", "i1", "&&", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "Hijacker", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 22/32", "case", "i0", "&&", "!", "i1", "&&", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "Hijacker", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 23/32", "case", "i0", "&&", "!", "i1", "&&", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 24/32", "case", "i0", "&&", "!", "i1", "&&", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 25/32", "case", "i0", "&&", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "}", "{", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 26/32", "case", "i0", "&&", "i1", "&&", "!", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 27/32", "case", "i0", "&&", "i1", "&&", "!", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 28/32", "case", "i0", "&&", "i1", "&&", "!", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 29/32", "case", "i0", "&&", "i1", "&&", "i2", "&&", "!", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 30/32", "case", "i0", "&&", "i1", "&&", "i2", "&&", "!", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 31/32", "case", "i0", "&&", "i1", "&&", "i2", "&&", "i3", "&&", "!", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "// combination 32/32", "case", "i0", "&&", "i1", "&&", "i2", "&&", "i3", "&&", "i4", ":", "return", "struct", "{", "http", ".", "ResponseWriter", "\n", "http", ".", "Flusher", "\n", "http", ".", "CloseNotifier", "\n", "http", ".", "Hijacker", "\n", "io", ".", "ReaderFrom", "\n", "http", ".", "Pusher", "\n", "}", "{", "rw", ",", "rw", ",", "rw", ",", "rw", ",", "rw", ",", "rw", "}", "\n", "}", "\n", "panic", "(", "\"", "\"", ")", "\n", "}" ]
18,703
all-18704
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "DiscardConsoleEntriesParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime41", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,704
all-18705
[ "protoToItem", "converts", "a", "protocol", "buffer", "item", "to", "a", "Go", "struct", "." ]
[ "func", "protoToItem", "(", "p", "*", "pb", ".", "MemcacheGetResponse_Item", ")", "*", "Item", "{", "return", "&", "Item", "{", "Key", ":", "string", "(", "p", ".", "<mask>", ")", ",", "Value", ":", "p", ".", "Value", ",", "Flags", ":", "p", ".", "GetFlags", "(", ")", ",", "casID", ":", "p", ".", "GetCasId", "(", ")", ",", "}", "\n", "}" ]
18,705
all-18706
[ "GetEventType", "returns", "the", "EventType", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "GetEventType", "(", ")", "string", "{", "if", "e", "==", "nil", "||", "e", ".", "EventType", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "e", ".", "EventType", "\n", "}" ]
18,706
all-18707
[ "NewPDNSProvider", "initializes", "a", "new", "PowerDNS", "based", "Provider", "." ]
[ "func", "NewPDNSProvider", "(", "config", "PDNSConfig", ")", "(", "*", "PDNSProvider", ",", "error", ")", "{", "// Do some input validation", "if", "config", ".", "APIKey", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// We do not support dry running, exit safely instead of surprising the user", "// TODO: Add Dry Run support", "if", "config", ".", "DryRun", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "config", ".", "Server", "==", "\"", "\"", "{", "log", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "pdnsClientConfig", ":=", "pgo", ".", "NewConfiguration", "(", ")", "\n", "pdnsClientConfig", ".", "BasePath", "=", "config", ".", "Server", "+", "apiBase", "\n", "if", "err", ":=", "config", ".", "TLSConfig", ".", "setHTTPClient", "(", "pdnsClientConfig", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "provider", ":=", "&", "PDNSProvider", "{", "client", ":", "&", "PDNSAPIClient", "{", "dryRun", ":", "config", ".", "DryRun", ",", "authCtx", ":", "context", ".", "WithValue", "(", "<mask>", ".", "TODO", "(", ")", ",", "pgo", ".", "ContextAPIKey", ",", "pgo", ".", "APIKey", "{", "Key", ":", "config", ".", "APIKey", "}", ")", ",", "client", ":", "pgo", ".", "NewAPIClient", "(", "pdnsClientConfig", ")", ",", "domainFilter", ":", "config", ".", "DomainFilter", ",", "}", ",", "}", "\n\n", "return", "provider", ",", "nil", "\n", "}" ]
18,707
all-18708
[ "NewClientWriter", "is", "the", "client", "writer", "factory", "." ]
[ "func", "NewClientWriter", "(", ")", "(", "*", "ClientWriter", ",", "error", ")", "{", "funcMap", ":=", "template", ".", "FuncMap", "{", "\"", "\"", ":", "comment", ",", "\"", "\"", ":", "commandLine", ",", "\"", "\"", ":", "parameters", ",", "\"", "\"", ":", "paramsInitializer", ",", "\"", "\"", ":", "blankCondition", ",", "\"", "\"", ":", "stripStar", ",", "}", "\n", "headerT", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "funcMap", ")", ".", "Parse", "(", "headerTmpl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "resourceT", ",", "err", ":=", "<mask>", ".", "New", "(", "\"", "\"", ")", ".", "Funcs", "(", "funcMap", ")", ".", "Parse", "(", "resourceTmpl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "ClientWriter", "{", "headerTmpl", ":", "headerT", ",", "resourceTmpl", ":", "resourceT", ",", "}", ",", "nil", "\n", "}" ]
18,708
all-18709
[ "setParamValue", "will", "ignore", "empty", "values" ]
[ "func", "setParamValue", "(", "p", "<mask>", "[", "string", "]", "string", ",", "k", ",", "v", "string", ")", "{", "if", "v", "!=", "\"", "\"", "{", "p", "[", "k", "]", "=", "v", "\n", "}", "\n", "}" ]
18,709
all-18710
[ "GetIdOk", "returns", "a", "tuple", "with", "the", "Id", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DashboardList", ")", "GetIdOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "Id", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "d", ".", "Id", ",", "<mask>", "\n", "}" ]
18,710
all-18711
[ "GetDocumenters", "is", "a", "wrapper", "around", "gtk_about_dialog_get_documenters", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "GetDocumenters", "(", ")", "[", "]", "string", "{", "var", "documenters", "[", "]", "string", "\n", "cdocumenters", ":=", "C", ".", "gtk_about_dialog_get_documenters", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "cdocumenters", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "for", "{", "if", "*", "cdocumenters", "==", "nil", "{", "<mask>", "\n", "}", "\n", "documenters", "=", "append", "(", "documenters", ",", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "*", "cdocumenters", ")", ")", ")", "\n", "cdocumenters", "=", "C", ".", "next_gcharptr", "(", "cdocumenters", ")", "\n", "}", "\n", "return", "documenters", "\n", "}" ]
18,711
all-18712
[ "NewWatcher", "watches", "a", "given", "etcd", "prefix", "for", "events", "." ]
[ "func", "NewWatcher", "(", "ctx", "context", ".", "Context", ",", "client", "*", "etcd", ".", "Client", ",", "trimPrefix", ",", "prefix", "string", ",", "template", "proto", ".", "Message", ",", "opts", "...", "OpOption", ")", "(", "Watcher", ",", "error", ")", "{", "eventCh", ":=", "make", "(", "chan", "*", "Event", ")", "\n", "done", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "// First list the collection to get the current items", "// Sort by mod revision--how the items would have been returned if we watched", "// them from the beginning.", "resp", ",", "err", ":=", "client", ".", "Get", "(", "ctx", ",", "prefix", ",", "etcd", ".", "WithPrefix", "(", ")", ",", "etcd", ".", "WithSort", "(", "etcd", ".", "SortByModRevision", ",", "etcd", ".", "SortAscend", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "nextRevision", ":=", "resp", ".", "Header", ".", "Revision", "+", "1", "\n", "etcdWatcher", ":=", "etcd", ".", "NewWatcher", "(", "client", ")", "\n", "// Issue a watch that uses the revision timestamp returned by the", "// Get request earlier. That way even if some items are added between", "// when we list the collection and when we start watching the collection,", "// we won't miss any items.", "options", ":=", "[", "]", "etcd", ".", "OpOption", "{", "etcd", ".", "WithPrefix", "(", ")", ",", "etcd", ".", "WithRev", "(", "nextRevision", ")", "}", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "options", "=", "append", "(", "options", ",", "etcd", ".", "OpOption", "(", "opt", ")", ")", "\n", "}", "\n", "rch", ":=", "etcdWatcher", ".", "Watch", "(", "ctx", ",", "prefix", ",", "<mask>", "...", ")", "\n\n", "go", "func", "(", ")", "(", "retErr", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "retErr", "!=", "nil", "{", "select", "{", "case", "eventCh", "<-", "&", "Event", "{", "Err", ":", "retErr", ",", "Type", ":", "EventError", ",", "}", ":", "case", "<-", "done", ":", "}", "\n", "}", "\n", "close", "(", "eventCh", ")", "\n", "etcdWatcher", ".", "Close", "(", ")", "\n", "}", "(", ")", "\n", "for", "_", ",", "etcdKv", ":=", "range", "resp", ".", "Kvs", "{", "eventCh", "<-", "&", "Event", "{", "Key", ":", "bytes", ".", "TrimPrefix", "(", "etcdKv", ".", "Key", ",", "[", "]", "byte", "(", "trimPrefix", ")", ")", ",", "Value", ":", "etcdKv", ".", "Value", ",", "Type", ":", "EventPut", ",", "Rev", ":", "etcdKv", ".", "ModRevision", ",", "Template", ":", "template", ",", "}", "\n", "}", "\n", "for", "{", "var", "resp", "etcd", ".", "WatchResponse", "\n", "var", "ok", "bool", "\n", "select", "{", "case", "resp", ",", "ok", "=", "<-", "rch", ":", "case", "<-", "done", ":", "return", "nil", "\n", "}", "\n", "if", "!", "ok", "{", "if", "err", ":=", "etcdWatcher", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "etcdWatcher", "=", "etcd", ".", "NewWatcher", "(", "client", ")", "\n", "rch", "=", "etcdWatcher", ".", "Watch", "(", "ctx", ",", "prefix", ",", "etcd", ".", "WithPrefix", "(", ")", ",", "etcd", ".", "WithRev", "(", "nextRevision", ")", ")", "\n", "continue", "\n", "}", "\n", "if", "err", ":=", "resp", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "etcdEv", ":=", "range", "resp", ".", "Events", "{", "ev", ":=", "&", "Event", "{", "Key", ":", "bytes", ".", "TrimPrefix", "(", "etcdEv", ".", "Kv", ".", "Key", ",", "[", "]", "byte", "(", "trimPrefix", ")", ")", ",", "Value", ":", "etcdEv", ".", "Kv", ".", "Value", ",", "Rev", ":", "etcdEv", ".", "Kv", ".", "ModRevision", ",", "Template", ":", "template", ",", "}", "\n", "if", "etcdEv", ".", "PrevKv", "!=", "nil", "{", "ev", ".", "PrevKey", "=", "bytes", ".", "TrimPrefix", "(", "etcdEv", ".", "PrevKv", ".", "Key", ",", "[", "]", "byte", "(", "trimPrefix", ")", ")", "\n", "ev", ".", "PrevValue", "=", "etcdEv", ".", "PrevKv", ".", "Value", "\n", "}", "\n", "if", "etcdEv", ".", "Type", "==", "etcd", ".", "EventTypePut", "{", "ev", ".", "Type", "=", "EventPut", "\n", "}", "else", "{", "ev", ".", "Type", "=", "EventDelete", "\n", "}", "\n", "select", "{", "case", "eventCh", "<-", "ev", ":", "case", "<-", "done", ":", "return", "nil", "\n", "}", "\n", "}", "\n", "nextRevision", "=", "resp", ".", "Header", ".", "Revision", "+", "1", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "&", "watcher", "{", "eventCh", ":", "eventCh", ",", "done", ":", "done", ",", "}", ",", "nil", "\n", "}" ]
18,712
all-18713
[ "Format", "is", "the", "public", "-", "facing", "interface", "that", "takes", "a", "list", "of", "strings", "and", "returns", "nicely", "aligned", "column", "-", "formatted", "text", "." ]
[ "func", "Format", "(", "lines", "[", "]", "string", ",", "config", "*", "Config", ")", "string", "{", "conf", ":=", "MergeConfig", "(", "DefaultConfig", "(", ")", ",", "config", ")", "\n", "widths", ":=", "widthsFromLines", "(", "conf", ",", "lines", ")", "\n\n", "// Estimate the buffer size", "glueSize", ":=", "len", "(", "conf", ".", "Glue", ")", "\n", "var", "size", "int", "\n", "for", "_", ",", "w", ":=", "range", "widths", "{", "size", "+=", "w", "+", "glueSize", "\n", "}", "\n", "size", "*=", "len", "(", "lines", ")", "\n\n", "// Create the buffer", "buf", ":=", "bytes", ".", "NewBuffer", "(", "make", "(", "[", "]", "byte", ",", "0", ",", "size", ")", ")", "\n\n", "// Create a cache for the string formats", "fmtCache", ":=", "make", "(", "map", "[", "int", "]", "string", ",", "16", ")", "\n\n", "// Create the formatted output using the format string", "for", "_", ",", "line", ":=", "range", "lines", "{", "elems", ":=", "elementsFromLine", "(", "conf", ",", "line", ")", "\n\n", "// Get the string format using cache", "numElems", ":=", "len", "(", "elems", ")", "\n", "stringfmt", ",", "ok", ":=", "fmtCache", "[", "numElems", "]", "\n", "if", "!", "ok", "{", "stringfmt", "=", "stringFormat", "(", "conf", ",", "widths", ",", "numElems", ")", "\n", "fmtCache", "[", "numElems", "]", "=", "stringfmt", "\n", "}", "\n\n", "fmt", ".", "Fprintf", "(", "buf", ",", "stringfmt", ",", "elems", "...", ")", "\n", "}", "\n\n", "// Get the string result", "result", ":=", "buf", ".", "String", "(", ")", "\n\n", "// Remove trailing newline without removing leading/trailing space", "if", "n", ":=", "len", "(", "result", ")", ";", "n", ">", "0", "&&", "<mask>", "[", "n", "-", "1", "]", "==", "'\\n'", "{", "result", "=", "result", "[", ":", "n", "-", "1", "]", "\n", "}", "\n\n", "return", "result", "\n", "}" ]
18,713
all-18714
[ "SuccessString", "sets", "response", "Content", "-", "Type", "and", "body", "to", "the", "given", "values", "." ]
[ "func", "(", "ctx", "*", "RequestCtx", ")", "SuccessString", "(", "contentType", ",", "body", "string", ")", "{", "ctx", ".", "SetContentType", "(", "contentType", ")", "\n", "ctx", ".", "SetBodyString", "(", "<mask>", ")", "\n", "}" ]
18,714
all-18715
[ "DeleteSecretRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "DeleteSecretRequest", "(", "arg0", "*", "secretsmanager", ".", "DeleteSecretInput", ")", "(", "*", "request", ".", "<mask>", ",", "*", "secretsmanager", ".", "DeleteSecretOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "request", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "DeleteSecretOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
18,715
all-18716
[ "Parse", "parses", "the", "input", "and", "reports", "the", "message", "text", "and", "the", "list", "of", "key", "/", "value", "pairs", ".", "The", "text", "slice", "if", "non", "-", "nil", "points", "to", "the", "same", "backing", "array", "as", "input", "." ]
[ "func", "Parse", "(", "input", "[", "]", "byte", ")", "(", "text", "[", "]", "byte", ",", "<mask>", "List", ")", "{", "m", ":=", "parse", ".", "Bytes", "(", "input", ")", "\n", "text", "=", "m", ".", "Text", "\n", "if", "len", "(", "m", ".", "List", ")", ">", "0", "{", "list", "=", "make", "(", "List", ",", "len", "(", "m", ".", "List", ")", ")", "\n", "for", "i", ",", "v", ":=", "range", "m", ".", "List", "{", "list", "[", "i", "]", "=", "string", "(", "v", ")", "\n", "}", "\n", "}", "\n", "m", ".", "Release", "(", ")", "\n", "return", "text", ",", "list", "\n", "}" ]
18,716
all-18717
[ "SliceFilter", "lifts", "the", "filter", "to", "also", "work", "on", "slices", ".", "It", "loses", "the", "type", "information", "of", "the", "slice", "elements" ]
[ "func", "SliceFilter", "(", "filter", "Filter", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "k", "string", ",", "v", "interface", "{", "}", ")", "interface", "{", "}", "{", "r", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n", "if", "r", ".", "Kind", "(", ")", "==", "reflect", ".", "Slice", "{", "<mask>", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "0", ",", "r", ".", "Len", "(", ")", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "r", ".", "Len", "(", ")", ";", "i", "++", "{", "el", ":=", "r", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", "\n", "res", "=", "append", "(", "res", ",", "filter", ".", "Filter", "(", "k", ",", "el", ")", ")", "\n", "}", "\n\n", "return", "res", "\n", "}", "\n\n", "return", "filter", ".", "Filter", "(", "k", ",", "v", ")", "\n", "}", ")", "\n", "}" ]
18,717
all-18718
[ "Receives", "a", "FQDN", ";", "looks", "up", "and", "supplies", "the", "A", "record", "." ]
[ "func", "(", "ds", "*", "DNSServer", ")", "GetA", "(", "fqdn", "string", ")", "*", "dns", ".", "A", "{", "ds", ".", "aMutex", ".", "RLock", "(", ")", "\n", "defer", "ds", ".", "aMutex", ".", "RUnlock", "(", ")", "\n", "val", ",", "ok", ":=", "<mask>", ".", "aRecords", "[", "fqdn", "]", "\n\n", "if", "ok", "{", "return", "&", "dns", ".", "A", "{", "Hdr", ":", "dns", ".", "RR_Header", "{", "Name", ":", "fqdn", ",", "Rrtype", ":", "dns", ".", "TypeA", ",", "Class", ":", "dns", ".", "ClassINET", ",", "// 0 TTL results in UB for DNS resolvers and generally causes problems.", "Ttl", ":", "1", ",", "}", ",", "A", ":", "val", ",", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,718
all-18719
[ "Close", "closes", "the", "WriteCloser", "contained", "in", "b", "." ]
[ "func", "(", "b", "*", "BackoffWriteCloser", ")", "Close", "(", ")", "error", "{", "span", ",", "_", ":=", "tracing", ".", "AddSpanToAnyExisting", "(", "b", ".", "ctx", ",", "\"", "\"", ")", "\n", "defer", "tracing", ".", "FinishAnySpan", "(", "span", ")", "\n", "err", ":=", "b", ".", "<mask>", ".", "Close", "(", ")", "\n", "if", "b", ".", "client", ".", "IsIgnorable", "(", "err", ")", "{", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}" ]
18,719
all-18720
[ "ListTeamRepos", "gets", "a", "list", "of", "team", "repos", "for", "the", "given", "team", "id", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "teams", "/", "#list", "-", "team", "-", "repos" ]
[ "func", "(", "c", "*", "Client", ")", "ListTeamRepos", "(", "id", "int", ")", "(", "[", "]", "Repo", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "id", ")", "\n", "if", "c", ".", "fake", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "var", "repos", "[", "]", "Repo", "\n", "err", ":=", "c", ".", "readPaginatedResultsWithValues", "(", "path", ",", "url", ".", "Values", "{", "\"", "\"", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "}", ",", "// This accept header enables the nested teams preview.", "// https://developer.github.com/changes/2017-08-30-preview-nested-teams/", "\"", "\"", ",", "func", "(", ")", "interface", "{", "}", "{", "return", "&", "[", "]", "Repo", "{", "}", "\n", "}", ",", "func", "(", "obj", "interface", "{", "}", ")", "{", "repos", "=", "append", "(", "repos", ",", "*", "(", "obj", ".", "(", "*", "[", "]", "Repo", ")", ")", "...", ")", "\n", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "repos", ",", "nil", "\n", "}" ]
18,720
all-18721
[ "HandleMetricsHealth", "registers", "metrics", "and", "health", "handlers", "." ]
[ "func", "HandleMetricsHealth", "(", "mux", "*", "<mask>", ".", "ServeMux", ",", "srv", "etcdserver", ".", "ServerV2", ")", "{", "mux", ".", "Handle", "(", "PathMetrics", ",", "promhttp", ".", "Handler", "(", ")", ")", "\n", "mux", ".", "Handle", "(", "PathHealth", ",", "NewHealthHandler", "(", "func", "(", ")", "Health", "{", "return", "checkHealth", "(", "srv", ")", "}", ")", ")", "\n", "}" ]
18,721
all-18722
[ "CreateNamedType", "returns", "a", "new", "type", "given", "a", "name", "the", "name", "must", "be", "unique", "." ]
[ "func", "(", "reg", "*", "TypeRegistry", ")", "CreateNamedType", "(", "name", "string", ")", "*", "<mask>", ".", "ObjectDataType", "{", "goName", ":=", "toGoTypeName", "(", "name", ")", "\n", "obj", ":=", "gen", ".", "ObjectDataType", "{", "TypeName", ":", "goName", "}", "\n", "if", "_", ",", "ok", ":=", "reg", ".", "NamedTypes", "[", "goName", "]", ";", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "reg", ".", "NamedTypes", "[", "goName", "]", "=", "&", "obj", "\n", "return", "&", "obj", "\n", "}" ]
18,722
all-18723
[ "IsHostWhitelisted", "returns", "true", "if", "the", "host", "is", "whitelisted", ".", "If", "whitelist", "is", "empty", "allow", "all", "." ]
[ "func", "(", "ac", "*", "AccessController", ")", "IsHostWhitelisted", "(", "<mask>", "string", ")", "bool", "{", "ac", ".", "hostWhitelistMu", ".", "RLock", "(", ")", "\n", "defer", "ac", ".", "hostWhitelistMu", ".", "RUnlock", "(", ")", "\n", "if", "len", "(", "ac", ".", "HostWhitelist", ")", "==", "0", "{", "// allow all", "return", "true", "\n", "}", "\n", "_", ",", "ok", ":=", "ac", ".", "HostWhitelist", "[", "\"", "\"", "]", "\n", "if", "ok", "{", "return", "true", "\n", "}", "\n", "_", ",", "ok", "=", "ac", ".", "HostWhitelist", "[", "host", "]", "\n", "return", "ok", "\n", "}" ]
18,723
all-18724
[ "Exists", "implements", "the", "corresponding", "method", "in", "the", "Client", "interface" ]
[ "func", "(", "o", "*", "tracingObjClient", ")", "Exists", "(", "ctx", "context", ".", "<mask>", ",", "name", "string", ")", "bool", "{", "span", ",", "ctx", ":=", "tracing", ".", "AddSpanToAnyExisting", "(", "ctx", ",", "o", ".", "provider", "+", "\"", "\"", ",", "\"", "\"", ",", "name", ")", "\n", "defer", "tracing", ".", "FinishAnySpan", "(", "span", ")", "\n", "return", "o", ".", "Client", ".", "Exists", "(", "ctx", ",", "name", ")", "\n", "}" ]
18,724
all-18725
[ "getStringField", "extracts", "key", "from", "req", "and", "either", "returns", "the", "value", "as", "a", "string", "or", "an", "error", "response", "(", "vault", "path", "handlers", "seem", "to", "return", "ErrorResponse", "rather", "than", "actual", "errors", "for", "malformed", "requests", ")" ]
[ "func", "getStringField", "(", "data", "*", "framework", ".", "FieldData", ",", "key", "string", ")", "(", "string", ",", "*", "logical", ".", "Response", ")", "{", "valueIface", ",", "ok", ",", "err", ":=", "data", ".", "GetOkErr", "(", "key", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "logical", ".", "ErrorResponse", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ",", "key", ")", ")", "\n", "}", "\n", "// the convention (in e.g. https://github.com/hashicorp/vault/blob/8142b42d951119a73ce46daa3331921b5e21cdee/builtin/logical/aws/path_config_lease.go", "// seems to be to return logical.ErrorResponse for invalid requests, and error for internal errors)", "if", "!", "ok", "{", "return", "\"", "\"", ",", "errMissingField", "(", "key", ")", "\n", "}", "\n", "value", ",", "ok", ":=", "valueIface", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", ",", "logical", ".", "ErrorResponse", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ",", "valueIface", ")", ")", "\n", "}", "\n", "return", "value", ",", "nil", "\n", "}" ]
18,725
all-18726
[ "Flush", "flushes", "all", "managed", "senders", ".", "Used", "for", "testing", "." ]
[ "func", "(", "gs", "*", "gossipSenders", ")", "Flush", "(", ")", "bool", "{", "sent", ":=", "false", "\n", "gs", ".", "Lock", "(", ")", "\n", "defer", "gs", ".", "Unlock", "(", ")", "\n", "for", "_", ",", "sender", ":=", "<mask>", "gs", ".", "senders", "{", "sent", "=", "sender", ".", "Flush", "(", ")", "||", "sent", "\n", "}", "\n", "return", "sent", "\n", "}" ]
18,726
all-18727
[ "NewSignalHandler", "creates", "a", "new", "Handler", "using", "given", "properties", "." ]
[ "func", "NewSignalHandler", "(", "timeoutSeconds", "int", ")", "*", "Handler", "{", "signals", ":=", "make", "(", "chan", "os", ".", "Signal", ")", "\n", "signal", ".", "Notify", "(", "signals", ",", "os", ".", "Interrupt", ",", "os", ".", "Kill", ")", "\n", "return", "&", "<mask>", "{", "timeoutSeconds", ":", "timeoutSeconds", ",", "signals", ":", "signals", ",", "signalReceived", ":", "0", ",", "}", "\n", "}" ]
18,727
all-18728
[ "Encode", "encodes", "the", "header", "." ]
[ "func", "(", "h", "header", ")", "Encode", "(", "b", "[", "]", "<mask>", ")", "{", "binary", ".", "BigEndian", ".", "PutUint16", "(", "b", "[", "0", ":", "2", "]", ",", "h", ".", "plen", ")", "\n", "binary", ".", "BigEndian", ".", "PutUint16", "(", "b", "[", "2", ":", "4", "]", ",", "h", ".", "klen", ")", "\n", "binary", ".", "BigEndian", ".", "PutUint16", "(", "b", "[", "4", ":", "6", "]", ",", "h", ".", "vlen", ")", "\n", "binary", ".", "BigEndian", ".", "PutUint32", "(", "b", "[", "6", ":", "10", "]", ",", "h", ".", "prev", ")", "\n", "}" ]
18,728
all-18729
[ "Fuzz", "the", "metric", "parser", ".", "Note", "that", "his", "is", "not", "the", "parser", "for", "the", "text", "-", "based", "exposition", "-", "format", ";", "that", "lives", "in", "github", ".", "com", "/", "prometheus", "/", "client_golang", "/", "text", "." ]
[ "func", "FuzzParseMetric", "(", "in", "[", "]", "<mask>", ")", "int", "{", "p", ":=", "textparse", ".", "New", "(", "in", ")", "\n", "for", "p", ".", "Next", "(", ")", "{", "}", "\n\n", "if", "p", ".", "Err", "(", ")", "==", "nil", "{", "return", "fuzzInteresting", "\n", "}", "\n\n", "return", "fuzzMeh", "\n", "}" ]
18,729
all-18730
[ "Change", "the", "vowels", "áéíóú", "into", "aeiou", "." ]
[ "func", "removeAccuteAccents", "(", "word", "*", "snowballword", ".", "SnowballWord", ")", "(", "didReplacement", "bool", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "word", ".", "RS", ")", ";", "i", "++", "{", "switch", "word", ".", "RS", "[", "i", "]", "{", "case", "225", ":", "// á -> a", "word", ".", "RS", "[", "i", "]", "=", "97", "\n", "didReplacement", "=", "true", "\n", "case", "233", ":", "// é -> e", "word", ".", "RS", "[", "i", "]", "=", "101", "\n", "didReplacement", "=", "true", "\n", "case", "237", ":", "// í -> i", "word", ".", "RS", "[", "i", "]", "=", "105", "\n", "didReplacement", "=", "true", "\n", "case", "243", ":", "// ó -> o", "<mask>", ".", "RS", "[", "i", "]", "=", "111", "\n", "didReplacement", "=", "true", "\n", "case", "250", ":", "// ú -> u", "word", ".", "RS", "[", "i", "]", "=", "117", "\n", "didReplacement", "=", "true", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
18,730
all-18731
[ "Path", "returns", "URI", "path", "i", ".", "e", ".", "/", "foo", "/", "bar", "of", "http", ":", "//", "aaa", ".", "com", "/", "foo", "/", "bar?baz", "=", "123#qwe", ".", "The", "returned", "path", "is", "always", "urldecoded", "and", "normalized", "i", ".", "e", ".", "//", "f%20obar", "/", "baz", "/", "..", "/", "zzz", "becomes", "/", "f", "obar", "/", "zzz", ".", "The", "returned", "value", "is", "valid", "until", "the", "next", "URI", "method", "call", "." ]
[ "func", "(", "u", "*", "URI", ")", "Path", "(", ")", "[", "]", "byte", "{", "path", ":=", "u", ".", "<mask>", "\n", "if", "len", "(", "path", ")", "==", "0", "{", "path", "=", "strSlash", "\n", "}", "\n", "return", "path", "\n", "}" ]
18,731
all-18732
[ "HasCertAuth", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernetes", "/", "pkg", "/", "client", "/", "transport", ".", "Config", ".", "HasCertAuth", ".", "HasCertAuth", "returns", "whether", "the", "configuration", "has", "certificate", "authentication", "or", "not", "." ]
[ "func", "(", "c", "*", "restConfig", ")", "HasCertAuth", "(", ")", "bool", "{", "<mask>", "len", "(", "c", ".", "CertData", ")", "!=", "0", "||", "len", "(", "c", ".", "CertFile", ")", "!=", "0", "\n", "}" ]
18,732
all-18733
[ "releaseNoteNoteFromParentPR", "gets", "the", "release", "note", "from", "the", "parent", "PR", "and", "formats", "it", "as", "per", "the", "PR", "template", "so", "that", "it", "can", "be", "copied", "to", "the", "cherry", "-", "pick", "PR", "." ]
[ "func", "releaseNoteFromParentPR", "(", "<mask>", "string", ")", "string", "{", "potentialMatch", ":=", "releaseNoteRe", ".", "FindStringSubmatch", "(", "body", ")", "\n", "if", "potentialMatch", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\\n", "\"", ",", "strings", ".", "TrimSpace", "(", "potentialMatch", "[", "1", "]", ")", ")", "\n", "}" ]
18,733
all-18734
[ "GetUserRuntimeDir", "is", "a", "wrapper", "around", "g_get_user_runtime_dir", "()", "." ]
[ "func", "GetUserRuntimeDir", "(", ")", "string", "{", "c", ":=", "C", ".", "g_get_user_runtime_dir", "(", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
18,734
all-18735
[ "OrderBy", "returns", "a", "new", "Condition", "of", "ORDER", "BY", "clause", "." ]
[ "func", "(", "db", "*", "DB", ")", "OrderBy", "(", "table", "interface", "{", "}", ",", "column", "<mask>", "{", "}", ",", "order", "...", "interface", "{", "}", ")", "*", "Condition", "{", "return", "newCondition", "(", "db", ")", ".", "OrderBy", "(", "table", ",", "column", ",", "order", "...", ")", "\n", "}" ]
18,735
all-18736
[ "Set", "a", "new", "padding", "style", "for", "mapping", "between", "characters", "and", "their", "numeric", "width" ]
[ "func", "(", "s", "*", "FileSequence", ")", "SetPaddingStyle", "(", "style", "PadStyle", ")", "{", "s", ".", "padMapper", "=", "padders", "[", "<mask>", "]", "\n", "s", ".", "SetPadding", "(", "s", ".", "padMapper", ".", "PaddingChars", "(", "s", ".", "ZFill", "(", ")", ")", ")", "\n", "}" ]
18,736
all-18737
[ "checkExistsFromError", "inspects", "an", "error", "and", "returns", "a", "true", "if", "err", "is", "nil", "false", "if", "error", "is", "an", "autorest", ".", "Error", "with", "StatusCode", "=", "404", "and", "will", "return", "the", "error", "back", "if", "error", "is", "another", "status", "code", "or", "another", "type", "of", "error", "." ]
[ "func", "checkResourceExistsFromError", "(", "err", "error", ")", "(", "bool", ",", "error", ")", "{", "if", "err", "==", "nil", "{", "return", "true", ",", "nil", "\n", "}", "\n", "v", ",", "ok", ":=", "err", ".", "(", "autorest", ".", "DetailedError", ")", "\n", "if", "<mask>", "&&", "v", ".", "StatusCode", "==", "http", ".", "StatusNotFound", "{", "return", "false", ",", "nil", "\n", "}", "\n", "return", "false", ",", "v", "\n", "}" ]
18,737
all-18738
[ "MarshalEasyJSON", "writes", "the", "CreditCard", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "u", "CreditCard", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "Writer", ")", "{", "w", ".", "<mask>", "(", "string", "(", "u", ")", ")", "\n", "}" ]
18,738
all-18739
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "NetworkGateway", ")", "Locator", "(", "api", "*", "API", ")", "*", "NetworkGatewayLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "NetworkGatewayLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,739
all-18740
[ "attach", "a", "range", "of", "a", "buffer", "object", "s", "data", "store", "to", "a", "buffer", "texture", "object" ]
[ "func", "TexBufferRange", "(", "target", "uint32", ",", "internalformat", "uint32", ",", "buffer", "uint32", ",", "offset", "int", ",", "size", "int", ")", "{", "syscall", ".", "Syscall6", "(", "gpTexBufferRange", ",", "5", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "buffer", ")", ",", "uintptr", "(", "offset", ")", ",", "uintptr", "(", "<mask>", ")", ",", "0", ")", "\n", "}" ]
18,740
all-18741
[ "square", "returns", "a", "float", "value", "indicating", "how", "much", "the", "given", "rectangle", "is", "close", "to", "a", "square", ".", "If", "the", "given", "rectangle", "is", "square", "this", "return", "1", "(", "maximum", "value", ")", ".", "Otherwise", "this", "returns", "a", "value", "in", "[", "0", "1", ")", "." ]
[ "func", "square", "(", "width", ",", "height", "int", ")", "float64", "{", "if", "width", "==", "0", "&&", "height", "==", "0", "{", "return", "0", "\n", "}", "\n", "if", "width", "<=", "height", "{", "return", "float64", "(", "<mask>", ")", "/", "float64", "(", "height", ")", "\n", "}", "\n", "return", "float64", "(", "height", ")", "/", "float64", "(", "width", ")", "\n", "}" ]
18,741
all-18742
[ "BodyString", "sets", "the", "request", "body", "to", "the", "given", "string", "." ]
[ "func", "(", "r", "*", "RequestBuilder", ")", "BodyString", "(", "body", "string", ")", "*", "RequestBuilder", "{", "return", "r", ".", "<mask>", "(", "strings", ".", "NewReader", "(", "body", ")", ")", "\n", "}" ]
18,742
all-18743
[ "GetUserDataDir", "is", "a", "wrapper", "around", "g_get_user_data_dir", "()", "." ]
[ "func", "GetUserDataDir", "(", ")", "string", "{", "c", ":=", "C", ".", "g_get_user_data_dir", "(", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
18,743
all-18744
[ "Check", "for", "an", "authorization", "signature", "in", "the", "request", ".", "Reject", "if", "not", "present", ".", "If", "validation", "required", "check", "the", "sha" ]
[ "func", "(", "t", "TravisHook", ")", "handleSignature", "(", "r", "*", "http", ".", "Request", ",", "secret", "string", ")", "error", "{", "signature", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "signature", "==", "\"", "\"", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "secret", "==", "\"", "\"", "{", "Logger", "(", ")", ".", "Print", "(", "\"", "\\n", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "content", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "+", "secret", "\n", "hash", ":=", "sha256", ".", "Sum256", "(", "[", "]", "<mask>", "(", "content", ")", ")", "\n", "expectedMac", ":=", "hex", ".", "EncodeToString", "(", "hash", "[", ":", "]", ")", "\n", "if", "signature", "!=", "expectedMac", "{", "fmt", ".", "Println", "(", "signature", ",", "expectedMac", ")", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,744
all-18745
[ "Vec3Scale", "scales", "a", "vector", "by", "value", "t", ".", "dest", "=", "v", "*", "t", "dest", "[", "out", "]", "The", "result", "vector", ".", "v", "[", "in", "]", "The", "vector", "to", "scale", ".", "t", "[", "in", "]", "The", "scaling", "factor", "." ]
[ "func", "Vec3Scale", "(", "dest", ",", "v", "Vec3", ",", "t", "float32", ")", "{", "dest", "[", "0", "]", "=", "v", "[", "0", "]", "*", "t", "\n", "dest", "[", "1", "]", "=", "v", "[", "1", "]", "*", "t", "\n", "<mask>", "[", "2", "]", "=", "v", "[", "2", "]", "*", "t", "\n", "}" ]
18,745
all-18746
[ "processProxyCmd", "checks", "the", "second", "non", "-", "flag", "element", "of", "the", "provided", "osArgs", "slice", "(", "which", "is", "the", "first", "argument", "to", "the", "executable", ")", "to", "see", "if", "it", "is", "a", "proxy", "command", ".", "If", "it", "is", "os", ".", "Args", "is", "set", "to", "be", "the", "non", "-", "proxy", "command", "arguments", "and", "the", "un", "-", "proxied", "command", "is", "run", ";", "otherwise", "it", "is", "a", "no", "-", "op", ".", "Returns", "true", "if", "the", "command", "was", "proxied", "and", "the", "proxied", "command", "was", "run", ";", "false", "otherwise", ".", "Note", "that", "if", "a", "proxied", "command", "is", "run", "it", "is", "possible", "that", "the", "proxied", "command", "may", "call", "some", "form", "of", "os", ".", "Exit", "itself", ".", "If", "this", "is", "the", "case", "then", "this", "function", "will", "be", "terminal", "and", "will", "not", "return", "a", "value", "." ]
[ "func", "processProxyCmd", "(", "osArgs", "[", "]", "string", ",", "fset", "*", "flag", ".", "FlagSet", ",", "cmdLibrary", "CmdLibrary", ")", "bool", "{", "// if fset is provided and is able to parse the arguments, parse the provided arguments and only consider the", "// non-flag arguments when determining whether or not the arguments constitute a proxy command", "if", "fset", "!=", "nil", "&&", "len", "(", "osArgs", ")", ">", "0", "{", "if", "err", ":=", "fset", ".", "Parse", "(", "osArgs", "[", "1", ":", "]", ")", ";", "err", "==", "nil", "{", "osArgs", "=", "append", "(", "[", "]", "string", "{", "osArgs", "[", "0", "]", "}", ",", "fset", ".", "Args", "(", ")", "...", ")", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "osArgs", ")", "<=", "1", "||", "!", "isProxyCmd", "(", "cmdType", "(", "osArgs", "[", "1", "]", ")", ")", "{", "// not a proxy command", "return", "<mask>", "\n", "}", "\n\n", "// get un-proxied command", "rawCmd", ":=", "unproxyCmd", "(", "cmdType", "(", "osArgs", "[", "1", "]", ")", ")", "\n", "cmd", ":=", "cmdLibrary", ".", "MustNewCmd", "(", "rawCmd", ".", "Name", "(", ")", ")", "\n\n", "// overwrite real \"os.Args\" with \"osArgs\" before calling the in-process runner", "os", ".", "Args", "=", "append", "(", "osArgs", "[", ":", "1", "]", ",", "osArgs", "[", "2", ":", "]", "...", ")", "\n\n", "// run command in-process. Calls into the wrapped \"main\" function, so it is possible/likely that the call will", "// call os.Exit and terminate the program.", "cmdLibrary", ".", "Run", "(", "cmd", ")", "\n\n", "// if previous call completed, it means that it reached the end of the wrapped main method and os.Exit was not", "// called. This is assumed to mean successful execution.", "return", "true", "\n", "}" ]
18,746
all-18747
[ "GetMaxOk", "returns", "a", "tuple", "with", "the", "Max", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetAxis", ")", "GetMaxOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "Max", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "Max", ",", "true", "\n", "}" ]
18,747
all-18748
[ "Child", "creates", "a", "child", "context", "with", "a", "separate", "container", "for", "headers", "." ]
[ "func", "(", "c", "headerCtx", ")", "Child", "(", ")", "ContextWithHeaders", "{", "var", "headersCopy", "headersContainer", "\n", "if", "h", ":=", "c", ".", "<mask>", "(", ")", ";", "h", "!=", "nil", "{", "headersCopy", "=", "*", "h", "\n", "}", "\n\n", "return", "Wrap", "(", "context", ".", "WithValue", "(", "c", ".", "Context", ",", "contextKeyHeaders", ",", "&", "headersCopy", ")", ")", "\n", "}" ]
18,748
all-18749
[ "Eq", "points", "check" ]
[ "func", "(", "p", "*", "Points", ")", "Eq", "(", "other", "*", "Points", ")", "bool", "{", "if", "other", "==", "nil", "{", "return", "false", "\n", "}", "\n", "if", "p", ".", "Metric", "!=", "other", ".", "Metric", "{", "return", "false", "\n", "}", "\n", "if", "p", ".", "Data", "==", "nil", "&&", "other", ".", "Data", "==", "nil", "{", "return", "true", "\n", "}", "\n", "if", "(", "p", ".", "Data", "==", "nil", "||", "other", ".", "Data", "==", "nil", ")", "&&", "(", "p", ".", "Data", "!=", "nil", "||", "<mask>", ".", "Data", "!=", "nil", ")", "{", "return", "false", "\n", "}", "\n", "if", "len", "(", "p", ".", "Data", ")", "!=", "len", "(", "other", ".", "Data", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "p", ".", "Data", ")", ";", "i", "++", "{", "if", "p", ".", "Data", "[", "i", "]", ".", "Value", "!=", "other", ".", "Data", "[", "i", "]", ".", "Value", "{", "return", "false", "\n", "}", "\n", "if", "p", ".", "Data", "[", "i", "]", ".", "Timestamp", "!=", "other", ".", "Data", "[", "i", "]", ".", "Timestamp", "{", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
18,749
all-18750
[ "bundle", "bundles", "the", "app", "into", "the", "named", "tarFile", "(", "-", "==", "stdout", ")", "." ]
[ "func", "(", "s", "*", "app", ")", "bundle", "(", "tarFile", "string", ")", "(", "err", "error", ")", "{", "var", "out", "io", ".", "Writer", "\n", "if", "tarFile", "==", "\"", "\"", "{", "out", "=", "<mask>", ".", "Stdout", "\n", "}", "else", "{", "f", ",", "err", ":=", "os", ".", "Create", "(", "tarFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "cerr", ":=", "f", ".", "Close", "(", ")", ";", "err", "==", "nil", "{", "err", "=", "cerr", "\n", "}", "\n", "}", "(", ")", "\n", "out", "=", "f", "\n", "}", "\n", "tw", ":=", "tar", ".", "NewWriter", "(", "out", ")", "\n\n", "for", "srcDir", ",", "importName", ":=", "range", "s", ".", "imports", "{", "dstDir", ":=", "\"", "\"", "+", "importName", "\n", "if", "err", "=", "copyTree", "(", "tw", ",", "dstDir", ",", "srcDir", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "srcDir", ",", "dstDir", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "copyTree", "(", "tw", ",", "\"", "\"", ",", "*", "rootDir", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "!", "s", ".", "hasMain", "{", "if", "err", ":=", "synthesizeMain", "(", "tw", ",", "s", ".", "appFiles", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "if", "err", ":=", "tw", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "tarFile", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,750
all-18751
[ "Options", "returns", "the", "list", "of", "options", "in", "a", "given", "section", "." ]
[ "func", "(", "c", "*", "Config", ")", "Options", "(", "section", "string", ")", "[", "]", "string", "{", "var", "options", "[", "]", "string", "\n", "for", "_", ",", "sect", ":=", "range", "c", ".", "sections", "{", "if", "sect", ".", "name", "==", "section", "{", "for", "_", ",", "opt", ":=", "range", "sect", ".", "options", "{", "options", "=", "append", "(", "options", ",", "opt", ".", "name", ")", "\n", "}", "\n", "<mask>", "\n", "}", "\n", "}", "\n", "return", "options", "\n", "}" ]
18,751
all-18752
[ "DeleteIntegrationAWS", "removes", "a", "specific", "AWS", "Account", "from", "the", "AWS", "Integration", "." ]
[ "func", "(", "client", "*", "<mask>", ")", "DeleteIntegrationAWS", "(", "awsAccount", "*", "IntegrationAWSAccountDeleteRequest", ")", "error", "{", "return", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "awsAccount", ",", "nil", ")", "\n", "}" ]
18,752
all-18753
[ "Delete", "deletes", "a", "vsphere_virtual_machine", "network_interface", "sub", "-", "resource", "." ]
[ "func", "(", "r", "*", "NetworkInterfaceSubresource", ")", "Delete", "(", "l", "object", ".", "VirtualDeviceList", ")", "(", "[", "]", "types", ".", "BaseVirtualDeviceConfigSpec", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "r", ")", "\n", "vd", ",", "err", ":=", "r", ".", "FindVirtualDevice", "(", "l", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "device", ",", "err", ":=", "baseVirtualDeviceToBaseVirtualEthernetCard", "(", "vd", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// If VMware tools is not running, this operation requires a reboot", "if", "r", ".", "rdd", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "!=", "string", "(", "types", ".", "VirtualMachineToolsRunningStatusGuestToolsRunning", ")", "{", "r", ".", "SetRestart", "(", "\"", "\"", ")", "\n", "}", "\n", "bvd", ":=", "baseVirtualEthernetCardToBaseVirtualDevice", "(", "device", ")", "\n", "spec", ",", "err", ":=", "object", ".", "VirtualDeviceList", "{", "bvd", "}", ".", "ConfigSpec", "(", "types", ".", "VirtualDeviceConfigSpecOperationRemove", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "r", ",", "DeviceChangeString", "(", "spec", ")", ")", "\n", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "r", ")", "\n", "return", "spec", ",", "nil", "\n", "}" ]
18,753
all-18754
[ "Returns", "a", "signed", "URL", "for", "EnsureKeyPair", "valid", "for", "the", "specified", "duration", ".", "Required", "scopes", ":", "ec2", "-", "manager", ":", "manage", "-", "key", "-", "pairs", ":", "<name", ">", "See", "EnsureKeyPair", "for", "more", "details", "." ]
[ "func", "(", "eC2Manager", "*", "EC2Manager", ")", "EnsureKeyPair_SignedURL", "(", "name", "string", ",", "duration", "time", ".", "Duration", ")", "(", "*", "url", ".", "URL", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "eC2Manager", ")", "\n", "return", "(", "&", "cd", ")", ".", "SignedURL", "(", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "name", ")", ",", "nil", ",", "<mask>", ")", "\n", "}" ]
18,754
all-18755
[ "HandleMethods", "uses", "a", "corresponding", "Handler", "based", "on", "HTTP", "request", "method", ".", "If", "Handler", "is", "not", "found", "a", "method", "not", "allowed", "HTTP", "response", "is", "returned", "with", "specified", "body", "and", "Content", "-", "Type", "header", "." ]
[ "func", "HandleMethods", "(", "methods", "map", "[", "string", "]", "http", ".", "Handler", ",", "body", "string", ",", "contentType", "string", ",", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "handler", ",", "ok", ":=", "methods", "[", "r", ".", "Method", "]", ";", "ok", "{", "handler", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", "else", "{", "allow", ":=", "[", "]", "string", "{", "}", "\n", "for", "k", ":=", "range", "methods", "{", "allow", "=", "append", "(", "allow", ",", "k", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "allow", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "strings", ".", "Join", "(", "allow", ",", "\"", "\"", ")", ")", "\n", "if", "r", ".", "Method", "==", "\"", "\"", "{", "w", ".", "WriteHeader", "(", "<mask>", ".", "StatusOK", ")", "\n", "}", "else", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "contentType", ")", "\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusMethodNotAllowed", ")", "\n", "fmt", ".", "Fprintln", "(", "w", ",", "body", ")", "\n", "}", "\n", "}", "\n", "}" ]
18,755
all-18756
[ "WithTTL", "configures", "the", "session", "s", "TTL", "in", "seconds", ".", "If", "TTL", "is", "<", "=", "0", "the", "default", "60", "seconds", "TTL", "will", "be", "used", "." ]
[ "func", "WithTTL", "(", "ttl", "int", ")", "SessionOption", "{", "<mask>", "func", "(", "so", "*", "sessionOptions", ")", "{", "if", "ttl", ">", "0", "{", "so", ".", "ttl", "=", "ttl", "\n", "}", "\n", "}", "\n", "}" ]
18,756
all-18757
[ "InMemoryInitZones", "pre", "-", "seeds", "the", "InMemoryProvider", "with", "given", "zones" ]
[ "func", "InMemoryInitZones", "(", "zones", "[", "]", "string", ")", "InMemoryOption", "{", "return", "func", "(", "p", "*", "InMemoryProvider", ")", "{", "for", "_", ",", "z", ":=", "<mask>", "zones", "{", "if", "err", ":=", "p", ".", "CreateZone", "(", "z", ")", ";", "err", "!=", "nil", "{", "log", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}" ]
18,757
all-18758
[ "HasTitle", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "AlertGraphDefinition", ")", "HasTitle", "(", ")", "bool", "{", "if", "a", "!=", "nil", "&&", "a", ".", "Title", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
18,758
all-18759
[ "NewRouter", "creates", "a", "new", "router", "instance", "." ]
[ "func", "NewRouter", "(", ")", "*", "Router", "{", "return", "&", "Router", "{", "routes", ":", "<mask>", "(", "map", "[", "string", "]", "func", "(", "ctx", "*", "neptulon", ".", "ReqCtx", ")", "error", ")", "}", "\n", "}" ]
18,759
all-18760
[ "deviceFlowAuth", "prints", "a", "message", "to", "the", "screen", "for", "user", "to", "take", "action", "to", "consent", "application", "on", "a", "browser", "and", "in", "the", "meanwhile", "the", "authentication", "endpoint", "is", "polled", "until", "user", "gives", "consent", "denies", "or", "the", "flow", "times", "out", ".", "Returned", "token", "must", "be", "saved", "." ]
[ "func", "deviceFlowAuth", "(", "oauthCfg", "azure", ".", "OAuthConfig", ",", "clientID", ",", "resource", "string", ")", "(", "*", "azure", ".", "ServicePrincipalToken", ",", "error", ")", "{", "cl", ":=", "oauthClient", "(", ")", "\n", "deviceCode", ",", "err", ":=", "azure", ".", "InitiateDeviceAuth", "(", "&", "cl", ",", "oauthCfg", ",", "clientID", ",", "resource", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "log", ".", "Debug", "(", "\"", "\"", ",", "logutil", ".", "Fields", "{", "\"", "\"", ":", "to", ".", "Int64", "(", "deviceCode", ".", "ExpiresIn", ")", ",", "\"", "\"", ":", "to", ".", "Int64", "(", "deviceCode", ".", "Interval", ")", ",", "}", ")", "\n\n", "// Example message: “To sign in, open https://aka.ms/devicelogin and enter", "// the code 0000000 to authenticate.”", "log", ".", "Infof", "(", "\"", "\"", ",", "to", ".", "String", "(", "deviceCode", ".", "<mask>", ")", ")", "\n\n", "token", ",", "err", ":=", "azure", ".", "WaitForUserCompletion", "(", "&", "cl", ",", "deviceCode", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "spt", ",", "err", ":=", "azure", ".", "NewServicePrincipalTokenFromManualToken", "(", "oauthCfg", ",", "clientID", ",", "resource", ",", "*", "token", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "spt", ",", "nil", "\n", "}" ]
18,760
all-18761
[ "ToLeet", "will", "format", "the", "provided", "string", "in", "Leet", "Speak", ".", "TODO", "(", "briandowns", ")", "Make", "select", "post", "match", "random", "." ]
[ "func", "ToLeet", "(", "theString", "string", ")", "(", "string", ",", "error", ")", "{", "f", ":=", "New", "(", "theString", ")", "\n\n", "if", "f", ".", "length", "<", "1", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "lengthError", ")", "\n", "}", "\n\n", "f", ".", "makeLower", "(", ")", "\n\n", "words", ":=", "strings", ".", "Fields", "(", "f", ".", "theString", ")", "\n", "var", "buffer", "bytes", ".", "Buffer", "\n\n", "for", "_", ",", "word", ":=", "range", "words", "{", "key", ":=", "string", "(", "<mask>", ")", "\n", "if", "_", ",", "ok", ":=", "leet", "[", "word", "]", ";", "ok", "{", "buffer", ".", "WriteString", "(", "leet", "[", "key", "]", "[", "0", "]", "+", "\"", "\"", ")", "\n", "}", "else", "{", "for", "_", ",", "i", ":=", "range", "word", "{", "letter", ":=", "string", "(", "i", ")", "\n", "if", "_", ",", "ok", ":=", "leet", "[", "letter", "]", ";", "ok", "{", "buffer", ".", "WriteString", "(", "leet", "[", "letter", "]", "[", "0", "]", ")", "\n", "}", "\n", "}", "\n", "buffer", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "buffer", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
18,761
all-18762
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "Style", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
18,762
all-18763
[ "Ref", "gets", "a", "definition", "for", "a", "Schema", "reference", "if", "it", "exists" ]
[ "func", "(", "d", "*", "Doc", ")", "Ref", "(", "r", "Ref", ")", "*", "Definition", "{", "if", "refIF", ",", "ok", ":=", "r", "[", "\"", "\"", "]", ";", "<mask>", "{", "refKey", ":=", "strings", ".", "TrimPrefix", "(", "refIF", ".", "(", "string", ")", ",", "\"", "\"", ")", "\n", "return", "d", ".", "Definitions", "[", "refKey", "]", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,763
all-18764
[ "NewMockCgroupFactory", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockCgroupFactory", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockCgroupFactory", "{", "mock", ":=", "&", "MockCgroupFactory", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockCgroupFactoryMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
18,764
all-18765
[ "New", "returns", "a", "new", "API", "client", "." ]
[ "func", "New", "(", "ctx", "<mask>", ".", "Context", ",", "host", "string", ",", "opts", "ClientOptions", ",", "debug", "bool", ")", "(", "Client", ",", "error", ")", "{", "if", "host", "==", "\"", "\"", "{", "return", "nil", ",", "errNewClient", "\n", "}", "\n\n", "host", "=", "strings", ".", "Replace", "(", "host", ",", "\"", "\"", ",", "\"", "\"", ",", "1", ")", "\n\n", "c", ":=", "&", "client", "{", "http", ":", "&", "http", ".", "Client", "{", "}", ",", "host", ":", "host", ",", "}", "\n\n", "if", "opts", ".", "Timeout", "!=", "0", "{", "c", ".", "http", ".", "Timeout", "=", "opts", ".", "Timeout", "\n", "}", "\n\n", "if", "opts", ".", "Insecure", "{", "c", ".", "http", ".", "Transport", "=", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "&", "tls", ".", "Config", "{", "InsecureSkipVerify", ":", "true", ",", "}", ",", "}", "\n", "}", "\n\n", "if", "opts", ".", "UseCerts", "{", "pool", ",", "err", ":=", "x509", ".", "SystemCertPool", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errSysCerts", "\n", "}", "\n", "c", ".", "http", ".", "Transport", "=", "&", "http", ".", "Transport", "{", "TLSClientConfig", ":", "&", "tls", ".", "Config", "{", "RootCAs", ":", "pool", ",", "InsecureSkipVerify", ":", "opts", ".", "Insecure", ",", "}", ",", "}", "\n", "}", "\n\n", "if", "opts", ".", "ShowHTTP", "{", "c", ".", "showHTTP", "=", "true", "\n", "}", "\n\n", "c", ".", "debug", "=", "debug", "\n\n", "return", "c", ",", "nil", "\n", "}" ]
18,765
all-18766
[ "InstallSnapshot", "implements", "the", "Transport", "interface", "." ]
[ "func", "(", "i", "*", "InmemTransport", ")", "InstallSnapshot", "(", "id", "ServerID", ",", "target", "ServerAddress", ",", "args", "*", "InstallSnapshotRequest", ",", "resp", "*", "InstallSnapshotResponse", ",", "data", "io", ".", "Reader", ")", "error", "{", "rpcResp", ",", "err", ":=", "i", ".", "makeRPC", "(", "target", ",", "args", ",", "<mask>", ",", "10", "*", "i", ".", "timeout", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Copy the result back", "out", ":=", "rpcResp", ".", "Response", ".", "(", "*", "InstallSnapshotResponse", ")", "\n", "*", "resp", "=", "*", "out", "\n", "return", "nil", "\n", "}" ]
18,766
all-18767
[ "StringJoin", "formats", "every", "value", "in", "values", "according", "to", "its", "default", "formatting", "and", "joins", "the", "result", "with", "sep", "as", "separator", ".", "values", "must", "be", "a", "slice", "of", "a", "formatable", "type" ]
[ "func", "StringJoin", "(", "values", "interface", "{", "}", ",", "sep", "string", ")", "string", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "<mask>", ")", "\n", "if", "v", ".", "Kind", "(", ")", "!=", "reflect", ".", "Slice", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "buffer", "bytes", ".", "Buffer", "\n", "for", "i", ":=", "0", ";", "i", "<", "v", ".", "Len", "(", ")", ";", "i", "++", "{", "if", "i", ">", "0", "{", "buffer", ".", "WriteString", "(", "sep", ")", "\n", "}", "\n", "buffer", ".", "WriteString", "(", "fmt", ".", "Sprint", "(", "v", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", ")", ")", "\n", "}", "\n", "return", "buffer", ".", "String", "(", ")", "\n", "}" ]
18,767
all-18768
[ "HasHeight", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "Screenboard", ")", "HasHeight", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Height", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
18,768
all-18769
[ "ResetBody", "resets", "request", "body", "." ]
[ "func", "(", "req", "*", "<mask>", ")", "ResetBody", "(", ")", "{", "req", ".", "RemoveMultipartFormFiles", "(", ")", "\n", "req", ".", "closeBodyStream", "(", ")", "\n", "if", "req", ".", "body", "!=", "nil", "{", "if", "req", ".", "keepBodyBuffer", "{", "req", ".", "body", ".", "Reset", "(", ")", "\n", "}", "else", "{", "requestBodyPool", ".", "Put", "(", "req", ".", "body", ")", "\n", "req", ".", "body", "=", "nil", "\n", "}", "\n", "}", "\n", "}" ]
18,769
all-18770
[ "NewMockUdev", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockUdev", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockUdev", "{", "mock", ":=", "&", "MockUdev", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockUdevMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
18,770
all-18771
[ "AppendPageMenu", "()", "is", "a", "wrapper", "around", "gtk_notebook_append_page_menu", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "AppendPageMenu", "(", "<mask>", "IWidget", ",", "tabLabel", "IWidget", ",", "menuLabel", "IWidget", ")", "int", "{", "c", ":=", "C", ".", "gtk_notebook_append_page_menu", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ",", "tabLabel", ".", "toWidget", "(", ")", ",", "menuLabel", ".", "toWidget", "(", ")", ")", "\n", "return", "int", "(", "c", ")", "\n", "}" ]
18,771
all-18772
[ "Available", "returns", "true", "if", "the", "unit", "is", "available", ".", "It", "will", "return", "true", "whenever", "the", "unit", "itself", "is", "available", "even", "when", "the", "application", "process", "is", "not", "." ]
[ "func", "(", "u", "*", "Unit", ")", "Available", "(", ")", "bool", "{", "return", "u", ".", "Status", "==", "StatusStarted", "||", "u", ".", "<mask>", "==", "StatusStarting", "||", "u", ".", "Status", "==", "StatusError", "\n", "}" ]
18,772
all-18773
[ "ErrorHandler", "simply", "counts", "the", "number", "of", "errors", "in", "the", "context", "and", "if", "more", "than", "0", "writes", "a", "response", "with", "an", "error", "code", "and", "a", "JSON", "payload", "describing", "the", "errors", ".", "The", "response", "will", "have", "a", "JSON", "content", "-", "type", ".", "Middleware", "remaining", "on", "the", "stack", "will", "not", "even", "see", "the", "request", "if", "by", "this", "point", "there", "are", "any", "errors", ".", "This", "is", "a", "default", "handler", "of", "sorts", "and", "you", "are", "welcome", "to", "use", "your", "own", "instead", ".", "The", "Bind", "middleware", "invokes", "this", "automatically", "for", "convenience", "." ]
[ "func", "ErrorHandler", "(", "errs", "Errors", ",", "resp", "http", ".", "ResponseWriter", ")", "{", "if", "len", "(", "errs", ")", ">", "0", "{", "resp", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "jsonContentType", ")", "\n", "if", "errs", ".", "Has", "(", "DeserializationError", ")", "{", "resp", ".", "WriteHeader", "(", "<mask>", ".", "StatusBadRequest", ")", "\n", "}", "else", "if", "errs", ".", "Has", "(", "ContentTypeError", ")", "{", "resp", ".", "WriteHeader", "(", "http", ".", "StatusUnsupportedMediaType", ")", "\n", "}", "else", "{", "resp", ".", "WriteHeader", "(", "StatusUnprocessableEntity", ")", "\n", "}", "\n", "errOutput", ",", "_", ":=", "json", ".", "Marshal", "(", "errs", ")", "\n", "resp", ".", "Write", "(", "errOutput", ")", "\n", "return", "\n", "}", "\n", "}" ]
18,773
all-18774
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "VersionRunningStatus", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "VersionRunningStatus", "(", "<mask>", ".", "String", "(", ")", ")", "{", "case", "VersionRunningStatusStopped", ":", "*", "t", "=", "VersionRunningStatusStopped", "\n", "case", "VersionRunningStatusStarting", ":", "*", "t", "=", "VersionRunningStatusStarting", "\n", "case", "VersionRunningStatusRunning", ":", "*", "t", "=", "VersionRunningStatusRunning", "\n", "case", "VersionRunningStatusStopping", ":", "*", "t", "=", "VersionRunningStatusStopping", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
18,774
all-18775
[ "CustomLogf", "outputs", "formatted", "custom", "level", "log" ]
[ "func", "(", "g", "*", "Glg", ")", "CustomLogf", "(", "level", "string", ",", "format", "string", ",", "val", "...", "interface", "{", "}", ")", "error", "{", "return", "g", ".", "out", "(", "g", ".", "TagStringToLevel", "(", "<mask>", ")", ",", "format", ",", "val", "...", ")", "\n", "}" ]
18,775
all-18776
[ "appender", "returns", "an", "appender", "for", "ingested", "samples", "from", "the", "target", "." ]
[ "func", "appender", "(", "app", "storage", ".", "Appender", ",", "limit", "int", ")", "storage", ".", "Appender", "{", "app", "=", "&", "timeLimitAppender", "{", "Appender", ":", "app", ",", "maxTime", ":", "timestamp", ".", "FromTime", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "maxAheadTime", ")", ")", ",", "}", "\n\n", "// The limit is applied after metrics are potentially dropped via relabeling.", "if", "limit", ">", "0", "{", "app", "=", "&", "limitAppender", "{", "Appender", ":", "app", ",", "limit", ":", "<mask>", ",", "}", "\n", "}", "\n", "return", "app", "\n", "}" ]
18,776
all-18777
[ "getPlatformStringsAddFunction", "returns", "a", "function", "used", "to", "add", "strings", "to", "a", "*", "platformStringsBuilder", "under", "the", "same", "set", "of", "constraints", ".", "This", "is", "a", "performance", "optimization", "to", "avoid", "evaluating", "constraints", "repeatedly", "." ]
[ "func", "getPlatformStringsAddFunction", "(", "c", "*", "config", ".", "Config", ",", "info", "fileInfo", ",", "cgoTags", "tagLine", ")", "func", "(", "sb", "*", "platformStringsBuilder", ",", "ss", "...", "string", ")", "{", "isOSSpecific", ",", "isArchSpecific", ":=", "isOSArchSpecific", "(", "info", ",", "cgoTags", ")", "\n\n", "switch", "{", "case", "!", "isOSSpecific", "&&", "!", "isArchSpecific", ":", "if", "checkConstraints", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "info", ".", "goos", ",", "info", ".", "goarch", ",", "info", ".", "tags", ",", "cgoTags", ")", "{", "return", "func", "(", "sb", "*", "platformStringsBuilder", ",", "ss", "...", "string", ")", "{", "for", "_", ",", "s", ":=", "range", "ss", "{", "sb", ".", "addGenericString", "(", "s", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "case", "isOSSpecific", "&&", "!", "isArchSpecific", ":", "var", "osMatch", "[", "]", "string", "\n", "for", "_", ",", "os", ":=", "range", "rule", ".", "KnownOSs", "{", "if", "checkConstraints", "(", "c", ",", "os", ",", "\"", "\"", ",", "info", ".", "goos", ",", "info", ".", "goarch", ",", "info", ".", "tags", ",", "cgoTags", ")", "{", "osMatch", "=", "append", "(", "osMatch", ",", "os", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "osMatch", ")", ">", "0", "{", "return", "func", "(", "sb", "*", "platformStringsBuilder", ",", "ss", "...", "string", ")", "{", "for", "_", ",", "s", ":=", "range", "ss", "{", "sb", ".", "addOSString", "(", "s", ",", "osMatch", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "case", "!", "isOSSpecific", "&&", "isArchSpecific", ":", "var", "archMatch", "[", "]", "string", "\n", "for", "_", ",", "arch", ":=", "range", "<mask>", ".", "KnownArchs", "{", "if", "checkConstraints", "(", "c", ",", "\"", "\"", ",", "arch", ",", "info", ".", "goos", ",", "info", ".", "goarch", ",", "info", ".", "tags", ",", "cgoTags", ")", "{", "archMatch", "=", "append", "(", "archMatch", ",", "arch", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "archMatch", ")", ">", "0", "{", "return", "func", "(", "sb", "*", "platformStringsBuilder", ",", "ss", "...", "string", ")", "{", "for", "_", ",", "s", ":=", "range", "ss", "{", "sb", ".", "addArchString", "(", "s", ",", "archMatch", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "default", ":", "var", "platformMatch", "[", "]", "rule", ".", "Platform", "\n", "for", "_", ",", "platform", ":=", "range", "rule", ".", "KnownPlatforms", "{", "if", "checkConstraints", "(", "c", ",", "platform", ".", "OS", ",", "platform", ".", "Arch", ",", "info", ".", "goos", ",", "info", ".", "goarch", ",", "info", ".", "tags", ",", "cgoTags", ")", "{", "platformMatch", "=", "append", "(", "platformMatch", ",", "platform", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "platformMatch", ")", ">", "0", "{", "return", "func", "(", "sb", "*", "platformStringsBuilder", ",", "ss", "...", "string", ")", "{", "for", "_", ",", "s", ":=", "range", "ss", "{", "sb", ".", "addPlatformString", "(", "s", ",", "platformMatch", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "func", "(", "_", "*", "platformStringsBuilder", ",", "_", "...", "string", ")", "{", "}", "\n", "}" ]
18,777
all-18778
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetResourceContentParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage33", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
18,778
all-18779
[ "DeleteDevice", "deletes", "a", "device", "for", "a", "customer" ]
[ "func", "(", "c", "*", "CustomerIO", ")", "DeleteDevice", "(", "customerID", "string", ",", "deviceID", "string", ")", "error", "{", "status", ",", "responseBody", ",", "err", ":=", "c", ".", "request", "(", "\"", "\"", ",", "c", ".", "deleteDeviceURL", "(", "customerID", ",", "deviceID", ")", ",", "[", "]", "byte", "{", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "else", "if", "status", "!=", "200", "{", "return", "&", "CustomerIOError", "{", "<mask>", ",", "c", ".", "deleteDeviceURL", "(", "customerID", ",", "deviceID", ")", ",", "responseBody", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,779
all-18780
[ "GetOwnersSet", "returns", "a", "set", "containing", "all", "the", "Owners", "files", "necessary", "to", "get", "the", "PR", "approved" ]
[ "func", "(", "o", "Owners", ")", "GetOwnersSet", "(", ")", "sets", ".", "String", "{", "owners", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "_", ",", "fn", ":=", "<mask>", "o", ".", "filenames", "{", "owners", ".", "Insert", "(", "o", ".", "repo", ".", "FindApproverOwnersForFile", "(", "fn", ")", ")", "\n", "}", "\n", "o", ".", "removeSubdirs", "(", "owners", ")", "\n", "return", "owners", "\n", "}" ]
18,780
all-18781
[ "MarshalBinary", "allocates", "a", "byte", "slice", "containing", "the", "data", "from", "an", "ATAArg", ".", "MarshalBinary", "never", "returns", "an", "error", "." ]
[ "func", "(", "a", "*", "ATAArg", ")", "MarshalBinary", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "// Allocate correct number of bytes for argument and data", "b", ":=", "make", "(", "[", "]", "byte", ",", "ataArgLen", "+", "len", "(", "a", ".", "Data", ")", ")", "\n\n", "// Add bit flags at appropriate positions", "//", "// 0101 0011", "// | | ||", "// | | |+-- write flag", "// | | +--- asynchronous flag", "// | +------- device/head register flag", "// +--------- extended LBA48 flag", "<mask>", "flags", "uint8", "\n", "if", "a", ".", "FlagLBA48Extended", "{", "flags", "|=", "(", "1", "<<", "6", ")", "\n", "}", "\n", "if", "a", ".", "FlagATADeviceHeadRegister", "{", "flags", "|=", "(", "1", "<<", "4", ")", "\n", "}", "\n", "if", "a", ".", "FlagAsynchronous", "{", "flags", "|=", "(", "1", "<<", "1", ")", "\n", "}", "\n", "if", "a", ".", "FlagWrite", "{", "flags", "|=", "1", "\n", "}", "\n", "b", "[", "0", "]", "=", "flags", "\n\n", "// Set other ATA data", "b", "[", "1", "]", "=", "a", ".", "ErrFeature", "\n", "b", "[", "2", "]", "=", "a", ".", "SectorCount", "\n", "b", "[", "3", "]", "=", "uint8", "(", "a", ".", "CmdStatus", ")", "\n", "b", "[", "4", "]", "=", "a", ".", "LBA", "[", "0", "]", "\n", "b", "[", "5", "]", "=", "a", ".", "LBA", "[", "1", "]", "\n", "b", "[", "6", "]", "=", "a", ".", "LBA", "[", "2", "]", "\n", "b", "[", "7", "]", "=", "a", ".", "LBA", "[", "3", "]", "\n", "b", "[", "8", "]", "=", "a", ".", "LBA", "[", "4", "]", "\n", "b", "[", "9", "]", "=", "a", ".", "LBA", "[", "5", "]", "\n\n", "// 2 bytes reserved space", "// Copy raw data after argument header", "copy", "(", "b", "[", "12", ":", "]", ",", "a", ".", "Data", ")", "\n\n", "return", "b", ",", "nil", "\n", "}" ]
18,781
all-18782
[ "export", "FrameSet_End" ]
[ "func", "FrameSet_End", "(", "id", "FrameSetId", ")", "C", ".", "int", "{", "fs", ",", "<mask>", ":=", "sFrameSets", ".", "Get", "(", "id", ")", "\n", "if", "!", "ok", "{", "return", "C", ".", "int", "(", "0", ")", "\n", "}", "\n", "return", "C", ".", "int", "(", "fs", ".", "End", "(", ")", ")", "\n", "}" ]
18,782
all-18783
[ "IntEnvDef", "get", "environment", "variable", "or", "some", "default", "def" ]
[ "func", "IntEnvDef", "(", "env", "string", ",", "def", "int", ")", "int", "{", "val", ":=", "<mask>", ".", "Getenv", "(", "env", ")", "\n", "if", "val", "==", "\"", "\"", "{", "return", "def", "\n", "}", "\n", "ival", ",", "err", ":=", "strconv", ".", "Atoi", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "def", "\n", "}", "\n", "return", "ival", "\n", "}" ]
18,783
all-18784
[ "HasCount", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "HasCount", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "Count", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
18,784
all-18785
[ "PreAccountReturnBalance", "returns", "from", "psc", "to", "ptc", "." ]
[ "func", "(", "w", "*", "Worker", ")", "PreAccountReturnBalance", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n", "acc", ",", "err", ":=", "w", ".", "relatedAccount", "(", "logger", ",", "job", ",", "data", ".", "JobPreAccountReturnBalance", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "key", ",", "err", ":=", "w", ".", "key", "(", "logger", ",", "acc", ".", "PrivateKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "jobData", ",", "err", ":=", "w", ".", "balanceData", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "auth", ":=", "bind", ".", "NewKeyedTransactor", "(", "key", ")", "\n\n", "amount", ",", "err", ":=", "w", ".", "ethBack", ".", "PSCBalanceOf", "(", "&", "bind", ".", "CallOpts", "{", "}", ",", "auth", ".", "From", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "<mask>", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrPSCReturnBalance", "\n", "}", "\n\n", "if", "amount", "<", "uint64", "(", "jobData", ".", "Amount", ")", "{", "return", "ErrInsufficientPSCBalance", "\n", "}", "\n\n", "ethAmount", ",", "err", ":=", "w", ".", "ethBalance", "(", "logger", ",", "auth", ".", "From", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "wantedEthBalance", ":=", "w", ".", "gasConf", ".", "PSC", ".", "ReturnBalanceERC20", "*", "jobData", ".", "GasPrice", "\n\n", "if", "wantedEthBalance", ">", "ethAmount", ".", "Uint64", "(", ")", "{", "return", "ErrInsufficientEthBalance", "\n", "}", "\n\n", "auth", ".", "GasLimit", "=", "w", ".", "gasConf", ".", "PSC", ".", "ReturnBalanceERC20", "\n", "auth", ".", "GasPrice", "=", "new", "(", "big", ".", "Int", ")", ".", "SetUint64", "(", "jobData", ".", "GasPrice", ")", "\n\n", "tx", ",", "err", ":=", "w", ".", "ethBack", ".", "PSCReturnBalanceERC20", "(", "auth", ",", "uint64", "(", "jobData", ".", "Amount", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Add", "(", "\"", "\"", ",", "auth", ".", "GasLimit", ",", "\"", "\"", ",", "auth", ".", "GasPrice", ")", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrPSCRetrieveBalance", "\n", "}", "\n\n", "return", "w", ".", "saveEthTX", "(", "logger", ",", "job", ",", "tx", ",", "\"", "\"", ",", "job", ".", "RelatedType", ",", "job", ".", "RelatedID", ",", "data", ".", "HexFromBytes", "(", "w", ".", "pscAddr", ".", "Bytes", "(", ")", ")", ",", "acc", ".", "EthAddr", ")", "\n", "}" ]
18,785
all-18786
[ "DeepCopyObject", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "runtime", ".", "Object", "." ]
[ "func", "(", "in", "*", "AppList", ")", "DeepCopyObject", "(", ")", "runtime", ".", "Object", "{", "if", "c", ":=", "<mask>", ".", "DeepCopy", "(", ")", ";", "c", "!=", "nil", "{", "return", "c", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,786
all-18787
[ "/", "1", ".", "0", "/", "storage", "-", "pools", "/", "{", "pool", "}", "/", "volumes", "/", "{", "type", "}", "/", "{", "name", "}" ]
[ "func", "storagePoolVolumeTypeDelete", "(", "d", "*", "Daemon", ",", "r", "*", "<mask>", ".", "Request", ",", "volumeTypeName", "string", ")", "Response", "{", "project", ":=", "projectParam", "(", "r", ")", "\n\n", "// Get the name of the storage volume.", "var", "volumeName", "string", "\n", "fields", ":=", "strings", ".", "Split", "(", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "fields", ")", "==", "3", "&&", "fields", "[", "1", "]", "==", "\"", "\"", "{", "// Handle volume snapshots", "volumeName", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fields", "[", "0", "]", ",", "shared", ".", "SnapshotDelimiter", ",", "fields", "[", "2", "]", ")", "\n", "}", "else", "if", "len", "(", "fields", ")", ">", "0", "{", "// Handle volume", "volumeName", "=", "fields", "[", "0", "]", "\n", "}", "else", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", ")", ")", "\n", "}", "\n\n", "// Get the name of the storage pool the volume is supposed to be", "// attached to.", "poolName", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n\n", "// Convert the volume type name to our internal integer representation.", "volumeType", ",", "err", ":=", "storagePoolVolumeTypeNameToType", "(", "volumeTypeName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "BadRequest", "(", "err", ")", "\n", "}", "\n", "// Check that the storage volume type is valid.", "if", "!", "shared", ".", "IntInSlice", "(", "volumeType", ",", "supportedVolumeTypes", ")", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "volumeTypeName", ")", ")", "\n", "}", "\n\n", "response", ":=", "ForwardedResponseIfTargetIsRemote", "(", "d", ",", "r", ")", "\n", "if", "response", "!=", "nil", "{", "return", "response", "\n", "}", "\n\n", "poolID", ",", "_", ",", "err", ":=", "d", ".", "cluster", ".", "StoragePoolGet", "(", "poolName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "response", "=", "ForwardedResponseIfVolumeIsRemote", "(", "d", ",", "r", ",", "poolID", ",", "volumeName", ",", "volumeType", ")", "\n", "if", "response", "!=", "nil", "{", "return", "response", "\n", "}", "\n\n", "switch", "volumeType", "{", "case", "storagePoolVolumeTypeCustom", ":", "// allowed", "case", "storagePoolVolumeTypeImage", ":", "// allowed", "default", ":", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ",", "volumeTypeName", ")", ")", "\n", "}", "\n\n", "volumeUsedBy", ",", "err", ":=", "storagePoolVolumeUsedByGet", "(", "d", ".", "State", "(", ")", ",", "project", ",", "volumeName", ",", "volumeTypeName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "volumeUsedBy", ")", ">", "0", "{", "if", "len", "(", "volumeUsedBy", ")", "!=", "1", "||", "volumeType", "!=", "storagePoolVolumeTypeImage", "||", "volumeUsedBy", "[", "0", "]", "!=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "version", ".", "APIVersion", ",", "volumeName", ")", "{", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "`The storage volume is `", "+", "`still in use by containers or profiles`", ")", ")", "\n", "}", "\n", "}", "\n\n", "s", ",", "err", ":=", "storagePoolVolumeInit", "(", "d", ".", "State", "(", ")", ",", "\"", "\"", ",", "poolName", ",", "volumeName", ",", "volumeType", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NotFound", "(", "err", ")", "\n", "}", "\n\n", "switch", "volumeType", "{", "case", "storagePoolVolumeTypeCustom", ":", "var", "snapshots", "[", "]", "string", "\n\n", "// Delete storage volume snapshots", "snapshots", ",", "err", "=", "d", ".", "cluster", ".", "StoragePoolVolumeSnapshotsGetType", "(", "volumeName", ",", "volumeType", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "for", "_", ",", "snapshot", ":=", "range", "snapshots", "{", "s", ",", "err", ":=", "storagePoolVolumeInit", "(", "d", ".", "State", "(", ")", ",", "project", ",", "poolName", ",", "snapshot", ",", "volumeType", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NotFound", "(", "err", ")", "\n", "}", "\n\n", "err", "=", "s", ".", "StoragePoolVolumeSnapshotDelete", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "}", "\n\n", "err", "=", "s", ".", "StoragePoolVolumeDelete", "(", ")", "\n", "case", "storagePoolVolumeTypeImage", ":", "err", "=", "s", ".", "ImageDelete", "(", "volumeName", ")", "\n", "default", ":", "return", "BadRequest", "(", "fmt", ".", "Errorf", "(", "`Storage volumes of type \"%s\" `", "+", "`cannot be deleted with the storage api`", ",", "volumeTypeName", ")", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "return", "EmptySyncResponse", "\n", "}" ]
18,787
all-18788
[ "Decrypt", "decrypts", "the", "given", "encrypted", "string", "using", "the", "hard", "-", "coded", "secret", "." ]
[ "func", "Decrypt", "(", "text", "string", ")", "(", "string", ",", "error", ")", "{", "if", "text", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n", "key", ":=", "seekret", "(", ")", "\n", "bytes", ":=", "decodeBase64", "(", "[", "]", "byte", "(", "text", ")", ")", "\n", "block", ",", "err", ":=", "aes", ".", "NewCipher", "(", "key", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "len", "(", "bytes", ")", "<", "aes", ".", "BlockSize", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "iv", ":=", "<mask>", "[", ":", "aes", ".", "BlockSize", "]", "\n", "bytes", "=", "bytes", "[", "aes", ".", "BlockSize", ":", "]", "\n", "cfb", ":=", "cipher", ".", "NewCFBDecrypter", "(", "block", ",", "iv", ")", "\n", "cfb", ".", "XORKeyStream", "(", "bytes", ",", "bytes", ")", "\n", "return", "string", "(", "decodeBase64", "(", "bytes", ")", ")", ",", "nil", "\n", "}" ]
18,788
all-18789
[ "Create", "indicates", "an", "expected", "call", "of", "Create" ]
[ "func", "(", "mr", "*", "MockOSMockRecorder", ")", "Create", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockOS", ")", "(", "nil", ")", ".", "Create", ")", ",", "arg0", ")", "\n", "}" ]
18,789
all-18790
[ "Do", "executes", "Page", ".", "printToPDF", "against", "the", "provided", "context", ".", "returns", ":", "data", "-", "Base64", "-", "encoded", "pdf", "data", "." ]
[ "func", "(", "p", "*", "PrintToPDFParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "data", "[", "]", "byte", ",", "err", "error", ")", "{", "// execute", "var", "res", "PrintToPDFReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandPrintToPDF", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// decode", "var", "dec", "[", "]", "<mask>", "\n", "dec", ",", "err", "=", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "res", ".", "Data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "dec", ",", "nil", "\n", "}" ]
18,790
all-18791
[ "IsErrNotAuthorized", "checks", "if", "an", "error", "is", "a", "ErrNotAuthorized" ]
[ "func", "IsErrNotAuthorized", "(", "err", "error", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "// TODO(msteffen) This is unstructured because we have no way to propagate", "// structured errors across GRPC boundaries. Fix", "return", "strings", ".", "Contains", "(", "err", ".", "<mask>", "(", ")", ",", "errNotAuthorizedMsg", ")", "\n", "}" ]
18,791
all-18792
[ "BlockIODeviceWeight", "property", "of", "systemd", "does", "not", "work", "properly", "and", "systemd", "expects", "device", "path", "instead", "of", "major", "minor", "numbers", "which", "is", "also", "confusing", "for", "users", ".", "So", "we", "use", "fs", "work", "around", "for", "now", "." ]
[ "func", "joinBlkio", "(", "c", "*", "configs", ".", "Cgroup", ",", "pid", "int", ")", "error", "{", "path", ",", "err", ":=", "getSubsystemPath", "(", "c", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "c", ".", "BlkioWeightDevice", "!=", "\"", "\"", "{", "if", "err", ":=", "writeFile", "(", "path", ",", "\"", "\"", ",", "c", ".", "BlkioWeightDevice", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "c", ".", "BlkioThrottleReadBpsDevice", "!=", "\"", "\"", "{", "if", "err", ":=", "writeFile", "(", "path", ",", "\"", "\"", ",", "c", ".", "BlkioThrottleReadBpsDevice", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "c", ".", "BlkioThrottleWriteBpsDevice", "!=", "\"", "\"", "{", "if", "err", ":=", "writeFile", "(", "<mask>", ",", "\"", "\"", ",", "c", ".", "BlkioThrottleWriteBpsDevice", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "c", ".", "BlkioThrottleReadIOpsDevice", "!=", "\"", "\"", "{", "if", "err", ":=", "writeFile", "(", "path", ",", "\"", "\"", ",", "c", ".", "BlkioThrottleReadIOpsDevice", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "if", "c", ".", "BlkioThrottleWriteIOpsDevice", "!=", "\"", "\"", "{", "if", "err", ":=", "writeFile", "(", "path", ",", "\"", "\"", ",", "c", ".", "BlkioThrottleWriteIOpsDevice", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,792
all-18793
[ "NewServer", "returns", "a", "new", "Server", "that", "can", "recieve", "Thrift", "calls", "or", "raw", "calls", "." ]
[ "func", "NewServer", "(", "optFns", "...", "Option", ")", "Server", "{", "opts", ":=", "getOptions", "(", "optFns", ")", "\n", "if", "opts", ".", "external", "{", "return", "newExternalServer", "(", "opts", ")", "\n", "}", "\n\n", "ch", ",", "err", ":=", "tchannel", ".", "NewChannel", "(", "opts", ".", "svcName", ",", "&", "tchannel", ".", "ChannelOptions", "{", "Logger", ":", "tchannel", ".", "NewLevelLogger", "(", "tchannel", ".", "NewLogger", "(", "<mask>", ".", "Stderr", ")", ",", "tchannel", ".", "LogLevelWarn", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "if", "err", ":=", "ch", ".", "ListenAndServe", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "s", ":=", "&", "internalServer", "{", "ch", ":", "ch", ",", "opts", ":", "opts", ",", "}", "\n\n", "tServer", ":=", "thrift", ".", "NewServer", "(", "ch", ")", "\n", "tServer", ".", "Register", "(", "gen", ".", "NewTChanSecondServiceServer", "(", "handler", "{", "calls", ":", "&", "s", ".", "thriftCalls", "}", ")", ")", "\n", "ch", ".", "Register", "(", "raw", ".", "Wrap", "(", "rawHandler", "{", "calls", ":", "&", "s", ".", "rawCalls", "}", ")", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "opts", ".", "advertiseHosts", ")", ">", "0", "{", "if", "err", ":=", "s", ".", "Advertise", "(", "opts", ".", "advertiseHosts", ")", ";", "err", "!=", "nil", "{", "panic", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "s", "\n", "}" ]
18,793
all-18794
[ "deleteJob", "is", "identical", "to", "updateJobState", "except", "that", "jobPtr", "points", "to", "a", "job", "that", "should", "be", "deleted", "rather", "than", "marked", "failed", ".", "Jobs", "may", "be", "deleted", "if", "their", "output", "commit", "is", "deleted", "." ]
[ "func", "(", "a", "*", "APIServer", ")", "deleteJob", "(", "stm", "<mask>", ".", "STM", ",", "jobPtr", "*", "pps", ".", "EtcdJobInfo", ")", "error", "{", "pipelinePtr", ":=", "&", "pps", ".", "EtcdPipelineInfo", "{", "}", "\n", "if", "err", ":=", "a", ".", "pipelines", ".", "ReadWrite", "(", "stm", ")", ".", "Update", "(", "jobPtr", ".", "Pipeline", ".", "Name", ",", "pipelinePtr", ",", "func", "(", ")", "error", "{", "if", "pipelinePtr", ".", "JobCounts", "==", "nil", "{", "pipelinePtr", ".", "JobCounts", "=", "make", "(", "map", "[", "int32", "]", "int32", ")", "\n", "}", "\n", "if", "pipelinePtr", ".", "JobCounts", "[", "int32", "(", "jobPtr", ".", "State", ")", "]", "!=", "0", "{", "pipelinePtr", ".", "JobCounts", "[", "int32", "(", "jobPtr", ".", "State", ")", "]", "--", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "a", ".", "jobs", ".", "ReadWrite", "(", "stm", ")", ".", "Delete", "(", "jobPtr", ".", "Job", ".", "ID", ")", "\n", "}" ]
18,794
all-18795
[ "SetMockService", "return", "a", "new", "MockService", "and", "set", "as", "a", "servicemanager" ]
[ "func", "SetMockService", "(", "m", "*", "MockService", ")", "{", "m", ".", "Cache", "=", "&", "cache", ".", "MockAppCacheService", "{", "}", "\n", "m", ".", "Plan", "=", "&", "app", ".", "MockPlanService", "{", "}", "\n", "m", ".", "Platform", "=", "&", "app", ".", "MockPlatformService", "{", "}", "\n", "m", ".", "PlatformImage", "=", "&", "image", ".", "MockPlatformImageService", "{", "}", "\n", "m", ".", "Team", "=", "&", "auth", ".", "MockTeamService", "{", "}", "\n", "m", ".", "UserQuota", "=", "&", "quota", ".", "MockQuotaService", "{", "}", "\n", "m", ".", "AppQuota", "=", "&", "quota", ".", "MockQuotaService", "{", "}", "\n", "m", ".", "Cluster", "=", "&", "provision", ".", "MockClusterService", "{", "}", "\n", "m", ".", "ServiceBroker", "=", "&", "<mask>", ".", "MockServiceBrokerService", "{", "}", "\n", "m", ".", "ServiceBrokerCatalogCache", "=", "&", "service", ".", "MockServiceBrokerCatalogCacheService", "{", "}", "\n", "servicemanager", ".", "AppCache", "=", "m", ".", "Cache", "\n", "servicemanager", ".", "Plan", "=", "m", ".", "Plan", "\n", "servicemanager", ".", "Platform", "=", "m", ".", "Platform", "\n", "servicemanager", ".", "PlatformImage", "=", "m", ".", "PlatformImage", "\n", "servicemanager", ".", "Team", "=", "m", ".", "Team", "\n", "servicemanager", ".", "UserQuota", "=", "m", ".", "UserQuota", "\n", "servicemanager", ".", "AppQuota", "=", "m", ".", "AppQuota", "\n", "servicemanager", ".", "Cluster", "=", "m", ".", "Cluster", "\n", "servicemanager", ".", "ServiceBroker", "=", "m", ".", "ServiceBroker", "\n", "servicemanager", ".", "ServiceBrokerCatalogCache", "=", "m", ".", "ServiceBrokerCatalogCache", "\n", "}" ]
18,795
all-18796
[ "Limit", "returns", "a", "derivative", "query", "that", "has", "a", "limit", "on", "the", "number", "of", "results", "returned", ".", "A", "negative", "value", "means", "unlimited", "." ]
[ "func", "(", "q", "*", "Query", ")", "Limit", "(", "limit", "int", ")", "*", "Query", "{", "q", "=", "q", ".", "clone", "(", ")", "\n", "if", "limit", "<", "math", ".", "MinInt32", "||", "limit", ">", "math", ".", "MaxInt32", "{", "q", ".", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "return", "q", "\n", "}", "\n", "q", ".", "<mask>", "=", "int32", "(", "limit", ")", "\n", "return", "q", "\n", "}" ]
18,796
all-18797
[ "Analyzed", "creates", "a", "new", "analyzed", "spec", "document" ]
[ "func", "Analyzed", "(", "data", "json", ".", "RawMessage", ",", "version", "string", ")", "(", "*", "Document", ",", "error", ")", "{", "if", "version", "==", "\"", "\"", "{", "version", "=", "\"", "\"", "\n", "}", "\n", "if", "version", "!=", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "version", ")", "\n", "}", "\n\n", "<mask>", ":=", "data", "\n", "trimmed", ":=", "bytes", ".", "TrimSpace", "(", "data", ")", "\n", "if", "len", "(", "trimmed", ")", ">", "0", "{", "if", "trimmed", "[", "0", "]", "!=", "'{'", "&&", "trimmed", "[", "0", "]", "!=", "'['", "{", "yml", ",", "err", ":=", "swag", ".", "BytesToYAMLDoc", "(", "trimmed", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "d", ",", "err", ":=", "swag", ".", "YAMLToJSON", "(", "yml", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "raw", "=", "d", "\n", "}", "\n", "}", "\n\n", "swspec", ":=", "new", "(", "spec", ".", "Swagger", ")", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "raw", ",", "swspec", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "origsqspec", ",", "err", ":=", "cloneSpec", "(", "swspec", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "d", ":=", "&", "Document", "{", "Analyzer", ":", "analysis", ".", "New", "(", "swspec", ")", ",", "schema", ":", "spec", ".", "MustLoadSwagger20Schema", "(", ")", ",", "spec", ":", "swspec", ",", "raw", ":", "raw", ",", "origSpec", ":", "origsqspec", ",", "}", "\n", "return", "d", ",", "nil", "\n", "}" ]
18,797
all-18798
[ "invalidate", "the", "content", "of", "a", "region", "of", "some", "or", "all", "of", "a", "framebuffer", "s", "attachments" ]
[ "func", "InvalidateSubFramebuffer", "(", "target", "uint32", ",", "numAttachments", "int32", ",", "attachments", "*", "uint32", ",", "x", "int32", ",", "y", "int32", ",", "width", "int32", ",", "height", "int32", ")", "{", "syscall", ".", "Syscall9", "(", "gpInvalidateSubFramebuffer", ",", "7", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "numAttachments", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "attachments", ")", ")", ",", "uintptr", "(", "x", ")", ",", "uintptr", "(", "y", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "height", ")", ",", "0", ",", "0", ")", "\n", "}" ]
18,798
all-18799
[ "RegisterInterruptHandler", "registers", "a", "new", "InterruptHandler", ".", "Handlers", "registered", "after", "interrupt", "handing", "was", "initiated", "will", "not", "be", "executed", "." ]
[ "func", "RegisterInterruptHandler", "(", "h", "InterruptHandler", ")", "{", "interruptRegisterMu", ".", "Lock", "(", ")", "\n", "defer", "interruptRegisterMu", ".", "Unlock", "(", ")", "\n", "interruptHandlers", "=", "<mask>", "(", "interruptHandlers", ",", "h", ")", "\n", "}" ]
18,799
all-18800
[ "PutHashTree", "is", "a", "convenience", "function", "for", "putting", "a", "HashTree", "to", "an", "object", "store", "." ]
[ "func", "PutHashTree", "(", "pachClient", "*", "client", ".", "APIClient", ",", "tree", "HashTree", ",", "tags", "...", "string", ")", "(", "*", "pfs", ".", "Object", ",", "error", ")", "{", "r", ",", "w", ":=", "io", ".", "Pipe", "(", ")", "\n", "<mask>", "eg", "errgroup", ".", "Group", "\n", "eg", ".", "Go", "(", "func", "(", ")", "(", "retErr", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "err", ":=", "w", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n", "return", "tree", ".", "Serialize", "(", "w", ")", "\n", "}", ")", "\n", "var", "treeRef", "*", "pfs", ".", "Object", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "var", "err", "error", "\n", "treeRef", ",", "_", ",", "err", "=", "pachClient", ".", "PutObject", "(", "r", ",", "tags", "...", ")", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", ":=", "eg", ".", "Wait", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "treeRef", ",", "nil", "\n", "}" ]