id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
23,200
all-23201
[ "ReadFromResource", "reads", "a", "file", "from", "different", "sources", "at", "the", "moment", "suppoted", "resources", "are", "http", "http", "local", "file", "system", "(", "POSIX", ")" ]
[ "func", "ReadFromResource", "(", "r", "string", ")", "(", "string", ",", "error", ")", "{", "env", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n\n", "// Hack in here for local bootstrap override", "devMode", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "devMode", "!=", "\"", "\"", "{", "logger", ".", "Info", "(", "\"", "\"", ",", "r", ")", "\n", "return", "readFromFS", "(", "r", ")", "\n", "}", "\n\n", "switch", "{", "// -----------------------------------------------------------------------------------------------------------------", "//", "//", "// starts with bootstrap/", "//", "case", "strings", ".", "HasPrefix", "(", "strings", ".", "ToLower", "(", "r", ")", ",", "\"", "\"", ")", "&&", "env", "!=", "\"", "\"", ":", "// If we start with bootstrap/ we know this is a resource we should pull from github.com", "// So here we build the GitHub URL and send the request", "gitHubUrl", ":=", "getGitHubUrl", "(", "r", ")", "\n", "logger", ".", "Info", "(", "\"", "\"", ",", "gitHubUrl", ")", "\n", "url", ",", "err", ":=", "<mask>", ".", "ParseRequestURI", "(", "gitHubUrl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "readFromHTTP", "(", "url", ")", "\n\n", "// -----------------------------------------------------------------------------------------------------------------", "//", "//", "// starts with http(s)://", "//", "case", "strings", ".", "HasPrefix", "(", "strings", ".", "ToLower", "(", "r", ")", ",", "\"", "\"", ")", "||", "strings", ".", "HasPrefix", "(", "strings", ".", "ToLower", "(", "r", ")", ",", "\"", "\"", ")", "&&", "env", "!=", "\"", "\"", ":", "url", ",", "err", ":=", "url", ".", "ParseRequestURI", "(", "r", ")", "\n", "logger", ".", "Info", "(", "\"", "\"", ",", "url", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "readFromHTTP", "(", "url", ")", "\n\n", "// -----------------------------------------------------------------------------------------------------------------", "//", "//", "// pull from local", "//", "default", ":", "logger", ".", "Info", "(", "\"", "\"", ",", "r", ")", "\n", "return", "readFromFS", "(", "r", ")", "\n", "}", "\n", "}" ]
23,201
all-23202
[ "CreateCheckBundle", "creates", "a", "new", "check", "bundle", "(", "check", ")", "." ]
[ "func", "(", "a", "*", "API", ")", "CreateCheckBundle", "(", "cfg", "*", "CheckBundle", ")", "(", "*", "CheckBundle", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "<mask>", "(", "config", ".", "CheckBundlePrefix", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "checkBundle", ":=", "&", "CheckBundle", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "checkBundle", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "checkBundle", ",", "nil", "\n", "}" ]
23,202
all-23203
[ "HasDisplayFormat", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "HasDisplayFormat", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "DisplayFormat", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
23,203
all-23204
[ "Check", "that", "cluster", "-", "related", "preconditions", "are", "met", "for", "bootstrapping", "or", "joining", "a", "cluster", "." ]
[ "func", "membershipCheckClusterStateForBootstrapOrJoin", "(", "tx", "*", "<mask>", ".", "ClusterTx", ")", "error", "{", "nodes", ",", "err", ":=", "tx", ".", "Nodes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "len", "(", "nodes", ")", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,204
all-23205
[ "HasEmail", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "HasEmail", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "Email", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
23,205
all-23206
[ "SetDOMStorageItem", "[", "no", "description", "]", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "DOMStorage#method", "-", "setDOMStorageItem", "parameters", ":", "storageID", "key", "value" ]
[ "func", "SetDOMStorageItem", "(", "storageID", "*", "StorageID", ",", "key", "string", ",", "value", "string", ")", "*", "SetDOMStorageItemParams", "{", "return", "&", "SetDOMStorageItemParams", "{", "StorageID", ":", "storageID", ",", "Key", ":", "key", ",", "<mask>", ":", "value", ",", "}", "\n", "}" ]
23,206
all-23207
[ "EncodeSQL", "performs", "the", "SQL", "encoding", "for", "InsertValues", "." ]
[ "func", "(", "iv", "InsertValues", ")", "EncodeSQL", "(", "buf", "*", "<mask>", ".", "Buffer", ")", "{", "for", "i", ",", "rows", ":=", "range", "iv", "{", "if", "i", "!=", "0", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "buf", ".", "WriteByte", "(", "'('", ")", "\n", "for", "j", ",", "bv", ":=", "range", "rows", "{", "if", "j", "!=", "0", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "bv", ".", "EncodeSQL", "(", "buf", ")", "\n", "}", "\n", "buf", ".", "WriteByte", "(", "')'", ")", "\n", "}", "\n", "}" ]
23,207
all-23208
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "prm", "*", "prmMatchRepository", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "*", "prm", "=", "prmMatchRepository", "{", "}", "\n", "var", "tmp", "prmMatchRepository", "\n", "if", "err", ":=", "paranoidUnmarshalJSONObjectExactFields", "(", "data", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "&", "tmp", ".", "Type", ",", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "tmp", ".", "<mask>", "!=", "prmTypeMatchRepository", "{", "return", "InvalidPolicyFormatError", "(", "fmt", ".", "Sprintf", "(", "\"", "\\\"", "\\\"", "\"", ",", "tmp", ".", "Type", ")", ")", "\n", "}", "\n", "*", "prm", "=", "*", "newPRMMatchRepository", "(", ")", "\n", "return", "nil", "\n", "}" ]
23,208
all-23209
[ "GetAccessRoleOk", "returns", "a", "tuple", "with", "the", "AccessRole", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "u", "*", "User", ")", "GetAccessRoleOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "u", "==", "nil", "||", "u", ".", "AccessRole", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "u", ".", "AccessRole", ",", "<mask>", "\n", "}" ]
23,209
all-23210
[ "Addr", "returns", "binded", "socket", "address", ".", "For", "bind", "port", "0", "in", "tests" ]
[ "func", "(", "rcv", "*", "UDP", ")", "Addr", "(", ")", "net", ".", "Addr", "{", "if", "rcv", ".", "conn", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "rcv", ".", "<mask>", ".", "LocalAddr", "(", ")", "\n", "}" ]
23,210
all-23211
[ "MatchedRoles", "return", "defined", "roles", "from", "user" ]
[ "func", "MatchedRoles", "(", "req", "*", "http", ".", "Request", ",", "user", "<mask>", "{", "}", ")", "[", "]", "string", "{", "return", "Global", ".", "MatchedRoles", "(", "req", ",", "user", ")", "\n", "}" ]
23,211
all-23212
[ "SetValueWidth", "changes", "width", "of", "the", "value", "panel", "on", "the", "left" ]
[ "func", "(", "b", "*", "SparkChart", ")", "SetValueWidth", "(", "width", "int", ")", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "b", ".", "valueWidth", "=", "<mask>", "\n", "}" ]
23,212
all-23213
[ "newPipelineHandler", "returns", "a", "handler", "for", "handling", "raft", "messages", "from", "pipeline", "for", "RaftPrefix", ".", "The", "handler", "reads", "out", "the", "raft", "message", "from", "request", "body", "and", "forwards", "it", "to", "the", "given", "raft", "state", "machine", "for", "processing", "." ]
[ "func", "newPipelineHandler", "(", "t", "*", "Transport", ",", "r", "Raft", ",", "cid", "<mask>", ".", "ID", ")", "http", ".", "Handler", "{", "return", "&", "pipelineHandler", "{", "lg", ":", "t", ".", "Logger", ",", "localID", ":", "t", ".", "ID", ",", "tr", ":", "t", ",", "r", ":", "r", ",", "cid", ":", "cid", ",", "}", "\n", "}" ]
23,213
all-23214
[ "HasMustShowErrors", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasMustShowErrors", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "MustShowErrors", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
23,214
all-23215
[ "Get", "gets", "the", "named", "provisioner", "from", "the", "registry", "." ]
[ "func", "Get", "(", "name", "string", ")", "(", "Provisioner", ",", "error", ")", "{", "pFunc", ",", "ok", ":=", "provisioners", "[", "<mask>", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "return", "pFunc", "(", ")", "\n", "}" ]
23,215
all-23216
[ "measure", "records", "metrics", "about", "the", "provided", "method", "path", "and", "code", ".", "start", "needs", "to", "be", "recorded", "before", "doing", "the", "request", "." ]
[ "func", "(", "c", "*", "Client", ")", "measure", "(", "method", ",", "path", "string", ",", "<mask>", "int", ",", "start", "time", ".", "Time", ")", "{", "if", "c", ".", "metrics", "==", "nil", "{", "return", "\n", "}", "\n", "c", ".", "metrics", ".", "RequestLatency", ".", "WithLabelValues", "(", "method", ",", "path", ")", ".", "Observe", "(", "time", ".", "Since", "(", "start", ")", ".", "Seconds", "(", ")", ")", "\n", "c", ".", "metrics", ".", "Requests", ".", "WithLabelValues", "(", "method", ",", "path", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "code", ")", ")", ".", "Inc", "(", ")", "\n", "}" ]
23,216
all-23217
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetDiscoverTargetsParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
23,217
all-23218
[ "=============================================================================", "These", "functions", "were", "adapted", "from", "https", ":", "//", "github", ".", "com", "/", "nsqio", "/", "nsq" ]
[ "func", "writeResponse", "(", "w", "*", "bufio", ".", "Writer", ",", "b", "[", "]", "<mask>", ")", "(", "err", "error", ")", "{", "if", "err", "=", "binary", ".", "Write", "(", "w", ",", "binary", ".", "BigEndian", ",", "int32", "(", "len", "(", "b", ")", ")", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "_", ",", "err", "=", "w", ".", "Write", "(", "b", ")", "\n", "return", "\n", "}" ]
23,218
all-23219
[ "MethodNotAllowedHandler", "returns", "the", "default", "Mux", "405", "responder", "whenever", "a", "method", "cannot", "be", "resolved", "for", "a", "route", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "MethodNotAllowedHandler", "(", ")", "<mask>", ".", "HandlerFunc", "{", "if", "mx", ".", "methodNotAllowedHandler", "!=", "nil", "{", "return", "mx", ".", "methodNotAllowedHandler", "\n", "}", "\n", "return", "methodNotAllowedHandler", "\n", "}" ]
23,219
all-23220
[ "<type", ">", "+" ]
[ "func", "(", "st", "*", "state", ")", "parmlist", "(", ")", "[", "]", "AST", "{", "var", "ret", "[", "]", "AST", "\n", "for", "{", "if", "len", "(", "st", ".", "str", ")", "<", "1", "{", "<mask>", "\n", "}", "\n", "if", "st", ".", "str", "[", "0", "]", "==", "'E'", "||", "st", ".", "str", "[", "0", "]", "==", "'.'", "{", "break", "\n", "}", "\n", "if", "(", "st", ".", "str", "[", "0", "]", "==", "'R'", "||", "st", ".", "str", "[", "0", "]", "==", "'O'", ")", "&&", "len", "(", "st", ".", "str", ")", ">", "1", "&&", "st", ".", "str", "[", "1", "]", "==", "'E'", "{", "// This is a function ref-qualifier.", "break", "\n", "}", "\n", "ptype", ":=", "st", ".", "demangleType", "(", "false", ")", "\n", "ret", "=", "append", "(", "ret", ",", "ptype", ")", "\n", "}", "\n\n", "// There should always be at least one type. A function that", "// takes no arguments will have a single parameter type", "// \"void\".", "if", "len", "(", "ret", ")", "==", "0", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Omit a single parameter type void.", "if", "len", "(", "ret", ")", "==", "1", "{", "if", "bt", ",", "ok", ":=", "ret", "[", "0", "]", ".", "(", "*", "BuiltinType", ")", ";", "ok", "&&", "bt", ".", "Name", "==", "\"", "\"", "{", "ret", "=", "nil", "\n", "}", "\n", "}", "\n\n", "return", "ret", "\n", "}" ]
23,220
all-23221
[ "ChangeContactHostNotificationTimeperiod", "creates", "a", "new", "CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD", "Nagios", "command", ".", "Changes", "the", "host", "notification", "timeperiod", "for", "a", "particular", "contact", "to", "what", "is", "specified", "by", "the", "notification_timeperiod", "option", ".", "The", "notification_timeperiod", "option", "should", "be", "the", "short", "name", "of", "the", "timeperiod", "that", "is", "to", "be", "used", "as", "the", "contact", "s", "host", "notification", "timeperiod", ".", "The", "timeperiod", "must", "have", "been", "configured", "in", "Nagios", "before", "it", "was", "last", "(", "re", ")", "started", "." ]
[ "func", "ChangeContactHostNotificationTimeperiod", "(", "contact_name", "<mask>", ",", "notification_timeperiod", "string", ",", ")", "*", "livestatus", ".", "Command", "{", "return", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "contact_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "notification_timeperiod", ")", ",", ")", "\n", "}" ]
23,221
all-23222
[ "GetMaxAge", "parses", "the", "Cache", "-", "Control", "header", "and", "returns", "a", "LifeChanger", "which", "can", "be", "passed", "to", "the", "response", "s", "Reset" ]
[ "func", "GetMaxAge", "(", "r", "*", "http", ".", "Request", ")", "entry", ".", "LifeChanger", "{", "return", "func", "(", ")", "time", ".", "Duration", "{", "cacheControlHeader", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "// headerCacheDur returns the seconds", "headerCacheDur", ":=", "entry", ".", "ParseMaxAge", "(", "cacheControlHeader", ")", "\n", "return", "<mask>", ".", "Duration", "(", "headerCacheDur", ")", "*", "time", ".", "Second", "\n", "}", "\n", "}" ]
23,222
all-23223
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetSearchResultsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom32", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
23,223
all-23224
[ "determine", "if", "a", "name", "corresponds", "to", "a", "buffer", "object" ]
[ "func", "IsBuffer", "(", "buffer", "uint32", ")", "bool", "{", "ret", ":=", "C", ".", "glowIsBuffer", "(", "gpIsBuffer", ",", "(", "C", ".", "GLuint", ")", "(", "buffer", ")", ")", "\n", "return", "<mask>", "==", "TRUE", "\n", "}" ]
23,224
all-23225
[ "CoveredNetworks", "returns", "the", "list", "of", "RangerEntry", "(", "s", ")", "the", "given", "ipnet", "covers", ".", "That", "is", "the", "networks", "that", "are", "completely", "subsumed", "by", "the", "specified", "network", "." ]
[ "func", "(", "b", "*", "bruteRanger", ")", "CoveredNetworks", "(", "network", "net", ".", "IPNet", ")", "(", "[", "]", "RangerEntry", ",", "error", ")", "{", "entries", ",", "err", ":=", "b", ".", "getEntriesByVersion", "(", "<mask>", ".", "IP", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "results", "[", "]", "RangerEntry", "\n", "testNetwork", ":=", "rnet", ".", "NewNetwork", "(", "network", ")", "\n", "for", "_", ",", "entry", ":=", "range", "entries", "{", "entryNetwork", ":=", "rnet", ".", "NewNetwork", "(", "entry", ".", "Network", "(", ")", ")", "\n", "if", "testNetwork", ".", "Covers", "(", "entryNetwork", ")", "{", "results", "=", "append", "(", "results", ",", "entry", ")", "\n", "}", "\n", "}", "\n", "return", "results", ",", "nil", "\n", "}" ]
23,225
all-23226
[ "SetBodyStreamWriter", "registers", "the", "given", "sw", "for", "populating", "request", "body", ".", "This", "function", "may", "be", "used", "in", "the", "following", "cases", ":", "*", "if", "request", "body", "is", "too", "big", "(", "more", "than", "10MB", ")", ".", "*", "if", "request", "body", "is", "streamed", "from", "slow", "external", "sources", ".", "*", "if", "request", "body", "must", "be", "streamed", "to", "the", "server", "in", "chunks", "(", "aka", "http", "client", "push", "or", "chunked", "transfer", "-", "encoding", ")", ".", "Note", "that", "GET", "and", "HEAD", "requests", "cannot", "have", "body", ".", "/", "See", "also", "SetBodyStream", "." ]
[ "func", "(", "req", "*", "Request", ")", "SetBodyStreamWriter", "(", "sw", "StreamWriter", ")", "{", "sr", ":=", "NewStreamReader", "(", "sw", ")", "\n", "req", ".", "SetBodyStream", "(", "<mask>", ",", "-", "1", ")", "\n", "}" ]
23,226
all-23227
[ "GetLogSetOk", "returns", "a", "tuple", "with", "the", "LogSet", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryConfig", ")", "GetLogSetOk", "(", ")", "(", "LogSet", ",", "bool", ")", "{", "if", "q", "==", "nil", "||", "q", ".", "LogSet", "==", "nil", "{", "return", "LogSet", "{", "}", ",", "false", "\n", "}", "\n", "return", "*", "q", ".", "LogSet", ",", "<mask>", "\n", "}" ]
23,227
all-23228
[ "NewPinger", "returns", "a", "new", "Pinger", "struct", "pointer" ]
[ "func", "NewPinger", "(", ")", "*", "Pinger", "{", "rand", ".", "Seed", "(", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ")", "\n", "return", "&", "Pinger", "{", "id", ":", "rand", ".", "Intn", "(", "0xffff", ")", ",", "seq", ":", "rand", ".", "Intn", "(", "0xffff", ")", ",", "addrs", ":", "make", "(", "<mask>", "[", "string", "]", "*", "net", ".", "IPAddr", ")", ",", "network", ":", "\"", "\"", ",", "source", ":", "\"", "\"", ",", "source6", ":", "\"", "\"", ",", "hasIPv4", ":", "false", ",", "hasIPv6", ":", "false", ",", "Size", ":", "TimeSliceLength", ",", "MaxRTT", ":", "time", ".", "Second", ",", "OnRecv", ":", "nil", ",", "OnIdle", ":", "nil", ",", "Debug", ":", "false", ",", "}", "\n", "}" ]
23,228
all-23229
[ "GetPageIterator", "returns", "a", "ConferencePageIterator", "with", "the", "given", "page", "filters", ".", "Call", "iterator", ".", "Next", "()", "to", "get", "the", "first", "page", "of", "resources", "(", "and", "again", "to", "retrieve", "subsequent", "pages", ")", "." ]
[ "func", "(", "c", "*", "ConferenceService", ")", "GetPageIterator", "(", "<mask>", "url", ".", "Values", ")", "ConferencePageIterator", "{", "return", "&", "conferencePageIterator", "{", "p", ":", "NewPageIterator", "(", "c", ".", "client", ",", "data", ",", "conferencePathPart", ")", ",", "}", "\n", "}" ]
23,229
all-23230
[ "GetStyle", "returns", "the", "Style", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "GetStyle", "(", ")", "TileDefRequestStyle", "{", "if", "t", "==", "nil", "||", "t", ".", "Style", "==", "nil", "{", "return", "TileDefRequestStyle", "{", "}", "\n", "}", "\n", "<mask>", "*", "t", ".", "Style", "\n", "}" ]
23,230
all-23231
[ "SetMarkup", "is", "a", "wrapper", "around", "gtk_message_dialog_set_markup", "()", "." ]
[ "func", "(", "v", "*", "MessageDialog", ")", "SetMarkup", "(", "str", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "str", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_message_dialog_set_markup", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
23,231
all-23232
[ "GetTitle", "returns", "the", "Title", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "Dashboard", ")", "GetTitle", "(", ")", "<mask>", "{", "if", "d", "==", "nil", "||", "d", ".", "Title", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "d", ".", "Title", "\n", "}" ]
23,232
all-23233
[ "ApplyChanges", "applies", "the", "given", "changes", ".", "Returns", "nil", "if", "the", "operation", "was", "successful", "or", "an", "error", "if", "the", "operation", "failed", "." ]
[ "func", "(", "p", "*", "AlibabaCloudProvider", ")", "applyChangesForPrivateZone", "(", "changes", "*", "plan", ".", "Changes", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "*", "changes", ")", "\n\n", "zones", ",", "err", ":=", "p", ".", "getPrivateZones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "zoneName", ",", "zone", ":=", "<mask>", "zones", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "zoneName", ",", "zone", ")", "\n", "}", "\n\n", "p", ".", "createPrivateZoneRecords", "(", "zones", ",", "changes", ".", "Create", ")", "\n", "p", ".", "deletePrivateZoneRecords", "(", "zones", ",", "changes", ".", "Delete", ")", "\n", "p", ".", "updatePrivateZoneRecords", "(", "zones", ",", "changes", ".", "UpdateNew", ")", "\n", "return", "nil", "\n", "}" ]
23,233
all-23234
[ "Returns", "a", "new", "decoder", ".", "Data", "will", "be", "read", "from", "r", "and", "decoded", "according", "to", "enc", "." ]
[ "func", "NewDecoder", "(", "enc", "*", "Encoding", ",", "r", "<mask>", ".", "Reader", ")", "io", ".", "Reader", "{", "return", "&", "decoder", "{", "enc", ":", "enc", ",", "r", ":", "r", ",", "buf", ":", "bytes", ".", "NewBuffer", "(", "nil", ")", ",", "leftovers", ":", "bytes", ".", "NewBuffer", "(", "nil", ")", "}", "\n", "}" ]
23,234
all-23235
[ "fileFunc", "returns", "or", "accumulates", "file", "dependencies", "." ]
[ "func", "fileFunc", "(", "b", "*", "Brain", ",", "used", ",", "<mask>", "*", "dep", ".", "Set", ")", "func", "(", "string", ")", "(", "string", ",", "error", ")", "{", "return", "func", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "d", ",", "err", ":=", "dep", ".", "NewFileQuery", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "used", ".", "Add", "(", "d", ")", "\n\n", "if", "value", ",", "ok", ":=", "b", ".", "Recall", "(", "d", ")", ";", "ok", "{", "if", "value", "==", "nil", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n", "return", "value", ".", "(", "string", ")", ",", "nil", "\n", "}", "\n\n", "missing", ".", "Add", "(", "d", ")", "\n\n", "return", "\"", "\"", ",", "nil", "\n", "}", "\n", "}" ]
23,235
all-23236
[ "Generate", "n", "passwords", "that", "meet", "the", "given", "requirements" ]
[ "func", "NewPasswords", "(", "reqs", "*", "PasswordStrengthRequirements", ",", "n", "int", ")", "(", "[", "]", "string", ",", "error", ")", "{", "<mask>", "err", "error", "\n", "if", "reqs", "==", "nil", "{", "reqs", "=", "&", "Medium", "\n", "}", "\n", "if", "ok", ",", "problems", ":=", "reqs", ".", "sanityCheck", "(", ")", ";", "!", "ok", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", "+", "problems", ")", "\n", "}", "\n", "e", ":=", "Garbler", "{", "}", "\n", "passes", ":=", "make", "(", "[", "]", "string", ",", "n", ",", "n", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "passes", "[", "i", "]", ",", "err", "=", "e", ".", "password", "(", "*", "reqs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "return", "passes", ",", "nil", "\n", "}" ]
23,236
all-23237
[ "bind", "a", "user", "-", "defined", "varying", "out", "variable", "to", "a", "fragment", "shader", "color", "number", "and", "index" ]
[ "func", "BindFragDataLocationIndexed", "(", "program", "uint32", ",", "colorNumber", "uint32", ",", "index", "uint32", ",", "name", "*", "uint8", ")", "{", "C", ".", "glowBindFragDataLocationIndexed", "(", "gpBindFragDataLocationIndexed", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLuint", ")", "(", "colorNumber", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "}" ]
23,237
all-23238
[ "resourceVSphereVirtualMachineCreateBare", "contains", "the", "bare", "metal", "VM", "deploy", "path", ".", "The", "VM", "is", "returned", "." ]
[ "func", "resourceVSphereVirtualMachineCreateBare", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ")", "(", "*", "object", ".", "VirtualMachine", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ")", "\n", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "poolID", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "\n", "pool", ",", "err", ":=", "resourcepool", ".", "FromID", "(", "client", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "poolID", ",", "err", ")", "\n", "}", "\n\n", "// Find the folder based off the path to the resource pool. Basically what we", "// are saying here is that the VM folder that we are placing this VM in needs", "// to be in the same hierarchy as the resource pool - so in other words, the", "// same datacenter.", "fo", ",", "err", ":=", "folder", ".", "VirtualMachineFolderFromObject", "(", "client", ",", "pool", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "hs", "*", "object", ".", "HostSystem", "\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOk", "(", "\"", "\"", ")", ";", "ok", "{", "hsID", ":=", "v", ".", "(", "string", ")", "\n", "var", "err", "error", "\n", "if", "hs", ",", "err", "=", "hostsystem", ".", "FromID", "(", "client", ",", "hsID", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "hsID", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "// Validate that the host is part of the resource pool before proceeding", "if", "err", ":=", "resourcepool", ".", "ValidateHost", "(", "client", ",", "pool", ",", "hs", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Ready to start making the VM here. First expand our main config spec.", "spec", ",", "err", ":=", "expandVirtualMachineConfigSpec", "(", "d", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// Now we need to get the default device set - this is available in the", "// environment info in the resource pool, which we can then filter through", "// our device CRUD lifecycles to get a full deviceChange attribute for our", "// configspec.", "devices", ",", "err", ":=", "resourcepool", ".", "DefaultDevices", "(", "client", ",", "pool", ",", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "virtualdevice", ".", "DeviceListString", "(", "devices", ")", ")", "\n\n", "if", "spec", ".", "DeviceChange", ",", "err", "=", "applyVirtualDevices", "(", "d", ",", "client", ",", "devices", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Create the VM according the right API path - if we have a datastore", "// cluster, use the SDRS API, if not, use the standard API.", "var", "vm", "*", "object", ".", "VirtualMachine", "\n", "if", "_", ",", "ok", ":=", "d", ".", "GetOk", "(", "\"", "\"", ")", ";", "ok", "{", "vm", ",", "err", "=", "resourceVSphereVirtualMachineCreateBareWithSDRS", "(", "d", ",", "meta", ",", "fo", ",", "spec", ",", "pool", ",", "hs", ")", "\n", "}", "else", "{", "vm", ",", "err", "=", "resourceVSphereVirtualMachineCreateBareStandard", "(", "d", ",", "meta", ",", "fo", ",", "spec", ",", "pool", ",", "hs", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// VM is created. Set the ID now before proceeding, in case the rest of the", "// process here fails.", "vprops", ",", "err", ":=", "virtualmachine", ".", "Properties", "(", "vm", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "InventoryPath", ",", "vprops", ".", "Config", ".", "Uuid", ")", "\n", "d", ".", "SetId", "(", "vprops", ".", "Config", ".", "Uuid", ")", "\n\n", "// Start the virtual machine", "if", "err", ":=", "virtualmachine", ".", "PowerOn", "(", "vm", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "vm", ",", "nil", "\n", "}" ]
23,238
all-23239
[ "Notification", "that", "a", "container", "was", "moved", ".", "At", "the", "moment", "it", "s", "used", "for", "ceph", "-", "based", "containers", "where", "the", "target", "node", "needs", "to", "create", "the", "appropriate", "mount", "points", "." ]
[ "func", "internalClusterContainerMovedPost", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ")", "Response", "{", "project", ":=", "projectParam", "(", "r", ")", "\n", "containerName", ":=", "mux", ".", "Vars", "(", "r", ")", "[", "\"", "\"", "]", "\n", "err", ":=", "containerPostCreateContainerMountPoint", "(", "d", ",", "<mask>", ",", "containerName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n", "return", "EmptySyncResponse", "\n", "}" ]
23,239
all-23240
[ "Push", "adds", "an", "element", "at", "the", "end", "of", "the", "stack" ]
[ "func", "(", "s", "*", "Stack", ")", "Push", "(", "v", "<mask>", "{", "}", ")", "{", "if", "len", "(", "*", "s", ")", ">=", "s", ".", "BufferSize", "(", ")", "{", "s", ".", "Resize", "(", "calcNewSize", "(", "cap", "(", "*", "s", ")", ")", ")", "\n", "}", "\n\n", "*", "s", "=", "append", "(", "*", "s", ",", "v", ")", "\n", "}" ]
23,240
all-23241
[ "CreateInlineType", "creates", "a", "new", "inline", "type", "." ]
[ "func", "(", "reg", "*", "TypeRegistry", ")", "CreateInlineType", "(", "name", "string", ")", "*", "gen", ".", "ObjectDataType", "{", "goName", ":=", "toGoTypeName", "(", "<mask>", ")", "\n", "obj", ":=", "gen", ".", "ObjectDataType", "{", "TypeName", ":", "goName", "}", "\n", "reg", ".", "InlineTypes", "[", "goName", "]", "=", "append", "(", "reg", ".", "InlineTypes", "[", "goName", "]", ",", "&", "obj", ")", "\n", "return", "&", "obj", "\n", "}" ]
23,241
all-23242
[ "SaveEntity", "saves", "the", "given", "Identifiable", "into", "the", "server", "." ]
[ "func", "(", "s", "*", "Session", ")", "SaveEntity", "(", "object", "Identifiable", ")", "*", "Error", "{", "url", ",", "berr", ":=", "s", ".", "getPersonalURL", "(", "object", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n\n", "buffer", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "if", "err", ":=", "json", ".", "NewEncoder", "(", "buffer", ")", ".", "Encode", "(", "object", ")", ";", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "url", "=", "<mask>", "+", "\"", "\"", "\n", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "url", ",", "buffer", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "response", ",", "berr", ":=", "s", ".", "send", "(", "request", ",", "nil", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n\n", "body", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "response", ".", "Body", ")", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "string", "(", "body", ")", ")", "\n\n", "dest", ":=", "IdentifiablesList", "{", "object", "}", "\n", "if", "len", "(", "body", ")", ">", "0", "{", "if", "err", ":=", "json", ".", "Unmarshal", "(", "body", ",", "&", "dest", ")", ";", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
23,242
all-23243
[ "newLine", "creates", "and", "returns", "a", "line", "." ]
[ "func", "newLine", "(", "no", "int", ",", "str", "string", ",", "opts", "*", "Options", ",", "f", "*", "File", ")", "*", "line", "{", "return", "&", "line", "{", "no", ":", "no", ",", "str", ":", "str", ",", "indent", ":", "indent", "(", "str", ")", ",", "tokens", ":", "strings", ".", "Split", "(", "strings", ".", "TrimLeft", "(", "str", ",", "<mask>", ")", ",", "space", ")", ",", "opts", ":", "opts", ",", "file", ":", "f", ",", "}", "\n", "}" ]
23,243
all-23244
[ "GetThresholdWindows", "returns", "the", "ThresholdWindows", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "o", "*", "<mask>", ")", "GetThresholdWindows", "(", ")", "ThresholdWindows", "{", "if", "o", "==", "nil", "||", "o", ".", "ThresholdWindows", "==", "nil", "{", "return", "ThresholdWindows", "{", "}", "\n", "}", "\n", "return", "*", "o", ".", "ThresholdWindows", "\n", "}" ]
23,244
all-23245
[ "SetCreatedAt", "sets", "the", "timestamp", "for", "container", "s", "creation", "time" ]
[ "func", "(", "c", "*", "Container", ")", "SetCreatedAt", "(", "createdAt", "time", ".", "Time", ")", "{", "if", "createdAt", ".", "IsZero", "(", ")", "{", "return", "\n", "}", "\n", "c", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "c", ".", "createdAt", "=", "createdAt", "\n", "}" ]
23,245
all-23246
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GtkEntryCompletion", "." ]
[ "func", "(", "v", "*", "EntryCompletion", ")", "native", "(", ")", "*", "C", ".", "GtkEntryCompletion", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "return", "C", ".", "toGtkEntryCompletion", "(", "p", ")", "\n", "}" ]
23,246
all-23247
[ "GetManageStatusTitleText", "returns", "the", "ManageStatusTitleText", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetManageStatusTitleText", "(", ")", "string", "{", "if", "w", "==", "nil", "||", "w", ".", "ManageStatusTitleText", "==", "nil", "{", "<mask>", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "ManageStatusTitleText", "\n", "}" ]
23,247
all-23248
[ "GetManifest", "returns", "the", "image", "s", "manifest", "along", "with", "its", "MIME", "type", "(", "which", "may", "be", "empty", "when", "it", "can", "t", "be", "determined", "but", "the", "manifest", "is", "available", ")", ".", "It", "may", "use", "a", "remote", "(", "=", "slow", ")", "service", ".", "If", "instanceDigest", "is", "not", "nil", "it", "contains", "a", "digest", "of", "the", "specific", "manifest", "instance", "to", "retrieve", "(", "when", "the", "primary", "manifest", "is", "a", "manifest", "list", ")", ";", "this", "never", "happens", "if", "the", "primary", "manifest", "is", "not", "a", "manifest", "list", "(", "e", ".", "g", ".", "if", "the", "source", "never", "returns", "manifest", "lists", ")", "." ]
[ "func", "(", "s", "*", "Source", ")", "GetManifest", "(", "ctx", "context", ".", "Context", ",", "instanceDigest", "*", "digest", ".", "Digest", ")", "(", "[", "]", "byte", ",", "string", ",", "error", ")", "{", "if", "instanceDigest", "!=", "nil", "{", "// How did we even get here? GetManifest(ctx, nil) has returned a manifest.DockerV2Schema2MediaType.", "return", "nil", ",", "\"", "\"", ",", "errors", ".", "Errorf", "(", "`Manifest lists are not supported by \"docker-daemon:\"`", ")", "\n", "}", "\n", "if", "s", ".", "generatedManifest", "==", "nil", "{", "if", "err", ":=", "s", ".", "ensureCachedDataIsPresent", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n", "m", ":=", "manifest", ".", "Schema2", "{", "SchemaVersion", ":", "2", ",", "MediaType", ":", "manifest", ".", "DockerV2Schema2MediaType", ",", "ConfigDescriptor", ":", "manifest", ".", "Schema2Descriptor", "{", "MediaType", ":", "manifest", ".", "DockerV2Schema2ConfigMediaType", ",", "Size", ":", "int64", "(", "len", "(", "s", ".", "configBytes", ")", ")", ",", "Digest", ":", "s", ".", "configDigest", ",", "}", ",", "LayersDescriptors", ":", "[", "]", "manifest", ".", "Schema2Descriptor", "{", "}", ",", "}", "\n", "for", "_", ",", "diffID", ":=", "range", "s", ".", "orderedDiffIDList", "{", "li", ",", "ok", ":=", "s", ".", "knownLayers", "[", "diffID", "]", "\n", "if", "!", "<mask>", "{", "return", "nil", ",", "\"", "\"", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "diffID", ")", "\n", "}", "\n", "m", ".", "LayersDescriptors", "=", "append", "(", "m", ".", "LayersDescriptors", ",", "manifest", ".", "Schema2Descriptor", "{", "Digest", ":", "diffID", ",", "// diffID is a digest of the uncompressed tarball", "MediaType", ":", "manifest", ".", "DockerV2Schema2LayerMediaType", ",", "Size", ":", "li", ".", "size", ",", "}", ")", "\n", "}", "\n", "manifestBytes", ",", "err", ":=", "json", ".", "Marshal", "(", "&", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n", "s", ".", "generatedManifest", "=", "manifestBytes", "\n", "}", "\n", "return", "s", ".", "generatedManifest", ",", "manifest", ".", "DockerV2Schema2MediaType", ",", "nil", "\n", "}" ]
23,248
all-23249
[ "ToHTTP", "writes", "the", "error", "to", "the", "http", "response" ]
[ "func", "ToHTTP", "(", "in", "error", ",", "w", "http", ".", "ResponseWriter", ")", "error", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", ",", "ok", ":=", "in", ".", "(", "Error", ")", ";", "ok", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "CodeHeader", ",", "err", ".", "Code", "(", ")", ".", "<mask>", "(", ")", ")", "\n", "w", ".", "WriteHeader", "(", "err", ".", "Type", "(", ")", ".", "HTTPStatusCode", "(", ")", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "toJSON", "(", "err", ")", ")", "\n", "}", "\n\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusInternalServerError", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "&", "jsonError", "{", "Message", ":", "in", ".", "Error", "(", ")", ",", "Type", ":", "Unknown", ",", "}", ")", "\n", "}" ]
23,249
all-23250
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "BreakLocationType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
23,250
all-23251
[ "NewMakeMirrorCommand", "returns", "the", "cobra", "command", "for", "makeMirror", "." ]
[ "func", "NewMakeMirrorCommand", "(", ")", "*", "cobra", ".", "Command", "{", "c", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"", "\"", ",", "Short", ":", "\"", "\"", ",", "Run", ":", "makeMirrorCommandFunc", ",", "}", "\n\n", "c", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "mmprefix", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "c", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "mmdestprefix", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "c", ".", "Flags", "(", ")", ".", "BoolVar", "(", "&", "mmnodestprefix", ",", "\"", "\"", ",", "false", ",", "\"", "\"", ")", "\n", "c", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "mmcert", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "c", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "mmkey", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "c", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "mmcacert", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "// TODO: secure by default when etcd enables secure gRPC by default.", "c", ".", "Flags", "(", ")", ".", "BoolVar", "(", "&", "mminsecureTr", ",", "\"", "\"", ",", "<mask>", ",", "\"", "\"", ")", "\n\n", "return", "c", "\n", "}" ]
23,251
all-23252
[ "Subscribe", "returns", "a", "new", "Subscription", "for", "the", "given", "topic", ".", "Note", "that", "subscription", "is", "not", "an", "instanteneous", "operation", ".", "It", "may", "take", "some", "time", "before", "the", "subscription", "is", "processed", "by", "the", "pubsub", "main", "loop", "and", "propagated", "to", "our", "peers", "." ]
[ "func", "(", "p", "*", "PubSub", ")", "Subscribe", "(", "topic", "string", ",", "opts", "...", "SubOpt", ")", "(", "*", "Subscription", ",", "error", ")", "{", "td", ":=", "pb", ".", "TopicDescriptor", "{", "<mask>", ":", "&", "topic", "}", "\n\n", "return", "p", ".", "SubscribeByTopicDescriptor", "(", "&", "td", ",", "opts", "...", ")", "\n", "}" ]
23,252
all-23253
[ "SetTags", "allows", "to", "set", "tags" ]
[ "func", "(", "r", "*", "Registry", ")", "SetTags", "(", "tags", "...", "string", ")", "{", "r", ".", "mutex", ".", "Lock", "(", ")", "\n", "r", ".", "<mask>", "=", "tags", "\n", "r", ".", "mutex", ".", "Unlock", "(", ")", "\n", "}" ]
23,253
all-23254
[ "PublishPacts", "publishes", "a", "set", "of", "pacts", "to", "a", "pact", "broker" ]
[ "func", "(", "p", "*", "PactClient", ")", "PublishPacts", "(", "request", "types", ".", "PublishRequest", ")", "error", "{", "svc", ":=", "p", ".", "publishSvcManager", ".", "NewService", "(", "request", ".", "Args", ")", "\n", "log", ".", "Println", "(", "\"", "\"", ")", "\n", "cmd", ":=", "svc", ".", "Start", "(", ")", "\n\n", "<mask>", ".", "Println", "(", "\"", "\"", ")", "\n", "err", ":=", "cmd", ".", "Wait", "(", ")", "\n\n", "log", ".", "Println", "(", "\"", "\"", ",", "err", ")", "\n\n", "return", "err", "\n", "}" ]
23,254
all-23255
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform4f", "(", "<mask>", "int32", ",", "v0", "float32", ",", "v1", "float32", ",", "v2", "float32", ",", "v3", "float32", ")", "{", "C", ".", "glowUniform4f", "(", "gpUniform4f", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v0", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v1", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v2", ")", ",", "(", "C", ".", "GLfloat", ")", "(", "v3", ")", ")", "\n", "}" ]
23,255
all-23256
[ "ContainerRemove", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClient", ")", "ContainerRemove", "(", "arg0", "context", ".", "Context", ",", "arg1", "string", ",", "arg2", "types", ".", "ContainerRemoveOptions", ")", "error", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ",", "arg2", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "error", ")", "\n", "return", "ret0", "\n", "}" ]
23,256
all-23257
[ "CheckFlags", "makes", "sure", "not", "both", "PR", "and", "issues", "are", "ignored" ]
[ "func", "(", "t", "*", "TypeFilterWrapperPlugin", ")", "CheckFlags", "(", ")", "error", "{", "if", "t", ".", "pullRequests", "&&", "t", ".", "<mask>", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,257
all-23258
[ "PrependSectionWithoutLabel", "is", "a", "wrapper", "around", "g_menu_prepend_section", "()", "with", "label", "set", "to", "null", "." ]
[ "func", "(", "v", "*", "Menu", ")", "PrependSectionWithoutLabel", "(", "section", "*", "MenuModel", ")", "{", "C", ".", "g_menu_prepend_section", "(", "v", ".", "native", "(", ")", ",", "nil", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
23,258
all-23259
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "ExecutionContextDescription", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime27", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
23,259
all-23260
[ "Prefix", "returns", "an", "AssetPipeline", "that", "prefixes", "URLs", "with", "the", "given", "string" ]
[ "func", "Prefix", "(", "prefix", "string", ",", "p", "AssetPipeline", ")", "AssetPipeline", "{", "if", "<mask>", "==", "\"", "\"", "{", "return", "p", "\n", "}", "\n\n", "return", "&", "prefixPipeline", "{", "prefix", ":", "prefix", ",", "AssetPipeline", ":", "p", ",", "}", "\n", "}" ]
23,260
all-23261
[ "Given", "specifies", "a", "provider", "state", ".", "Optional", "." ]
[ "func", "(", "i", "*", "Interaction", ")", "Given", "(", "state", "string", ")", "*", "Interaction", "{", "i", ".", "State", "=", "<mask>", "\n\n", "return", "i", "\n", "}" ]
23,261
all-23262
[ "HasQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "HasQuery", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "Query", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
23,262
all-23263
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StorageID", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
23,263
all-23264
[ "AgentSeal", "encrypts", "message", "using", "client", "s", "public", "key", "and", "packs", "with", "agent", "signature", "." ]
[ "func", "AgentSeal", "(", "<mask>", ",", "clientPub", "[", "]", "byte", ",", "agentKey", "*", "ecdsa", ".", "PrivateKey", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "pubKey", ",", "err", ":=", "ethcrypto", ".", "UnmarshalPubkey", "(", "clientPub", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "pub", ":=", "ecies", ".", "ImportECDSAPublic", "(", "pubKey", ")", "\n", "msgEncrypted", ",", "err", ":=", "ecies", ".", "Encrypt", "(", "rand", ".", "Reader", ",", "pub", ",", "msg", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "PackWithSignature", "(", "msgEncrypted", ",", "agentKey", ")", "\n", "}" ]
23,264
all-23265
[ "GetTranslatorCredits", "is", "a", "wrapper", "around", "gtk_about_dialog_get_translator_credits", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "GetTranslatorCredits", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_about_dialog_get_translator_credits", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
23,265
all-23266
[ "UnmarshalBinaryBare", "will", "panic", "if", "ptr", "is", "a", "nil", "-", "pointer", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "UnmarshalBinaryBare", "(", "bz", "[", "]", "byte", ",", "ptr", "interface", "{", "}", ")", "error", "{", "rv", ":=", "reflect", ".", "ValueOf", "(", "ptr", ")", "\n", "if", "rv", ".", "Kind", "(", ")", "!=", "reflect", ".", "Ptr", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "rv", "=", "rv", ".", "Elem", "(", ")", "\n", "rt", ":=", "rv", ".", "Type", "(", ")", "\n", "info", ",", "err", ":=", "cdc", ".", "getTypeInfo_wlock", "(", "rt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// If registered concrete, consume and verify prefix bytes.", "if", "info", ".", "Registered", "{", "pb", ":=", "info", ".", "Prefix", ".", "Bytes", "(", ")", "\n", "if", "len", "(", "bz", ")", "<", "4", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pb", ",", "bz", ")", "\n", "}", "else", "if", "!", "<mask>", ".", "Equal", "(", "bz", "[", ":", "4", "]", ",", "pb", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pb", ",", "bz", "[", ":", "4", "]", ")", "\n", "}", "\n", "bz", "=", "bz", "[", "4", ":", "]", "\n", "}", "\n", "// Decode contents into rv.", "n", ",", "err", ":=", "cdc", ".", "decodeReflectBinary", "(", "bz", ",", "info", ",", "rv", ",", "FieldOptions", "{", "BinFieldNum", ":", "1", "}", ",", "true", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "info", ".", "Type", ",", "n", ",", "err", ",", "bz", ")", "\n", "}", "\n", "if", "n", "!=", "len", "(", "bz", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "info", ".", "Type", ",", "len", "(", "bz", ")", ",", "n", ",", "bz", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,266
all-23267
[ "ImageLastAccessInit", "inits", "the", "last_use_date", "field", "of", "the", "image", "with", "the", "given", "fingerprint", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageLastAccessInit", "(", "fingerprint", "string", ")", "error", "{", "stmt", ":=", "`UPDATE images SET cached=1, last_use_date=strftime(\"%s\") WHERE fingerprint=?`", "\n", "err", ":=", "<mask>", "(", "c", ".", "db", ",", "stmt", ",", "fingerprint", ")", "\n", "return", "err", "\n", "}" ]
23,267
all-23268
[ "Delete", "deletes", "the", "entity", "for", "the", "given", "key", "." ]
[ "func", "Delete", "(", "c", "context", ".", "Context", ",", "key", "*", "Key", ")", "error", "{", "err", ":=", "DeleteMulti", "(", "c", ",", "[", "]", "*", "Key", "{", "key", "}", ")", "\n", "if", "me", ",", "<mask>", ":=", "err", ".", "(", "appengine", ".", "MultiError", ")", ";", "ok", "{", "return", "me", "[", "0", "]", "\n", "}", "\n", "return", "err", "\n", "}" ]
23,268
all-23269
[ "CopyTo", "copies", "all", "the", "headers", "to", "dst", "." ]
[ "func", "(", "h", "*", "ResponseHeader", ")", "CopyTo", "(", "dst", "*", "ResponseHeader", ")", "{", "dst", ".", "Reset", "(", ")", "\n\n", "dst", ".", "disableNormalizing", "=", "h", ".", "disableNormalizing", "\n", "dst", ".", "noHTTP11", "=", "h", ".", "noHTTP11", "\n", "dst", ".", "connectionClose", "=", "h", ".", "connectionClose", "\n", "dst", ".", "noDefaultContentType", "=", "h", ".", "noDefaultContentType", "\n\n", "dst", ".", "statusCode", "=", "h", ".", "statusCode", "\n", "dst", ".", "contentLength", "=", "h", ".", "contentLength", "\n", "dst", ".", "contentLengthBytes", "=", "<mask>", "(", "dst", ".", "contentLengthBytes", "[", ":", "0", "]", ",", "h", ".", "contentLengthBytes", "...", ")", "\n", "dst", ".", "contentType", "=", "append", "(", "dst", ".", "contentType", "[", ":", "0", "]", ",", "h", ".", "contentType", "...", ")", "\n", "dst", ".", "server", "=", "append", "(", "dst", ".", "server", "[", ":", "0", "]", ",", "h", ".", "server", "...", ")", "\n", "dst", ".", "h", "=", "copyArgs", "(", "dst", ".", "h", ",", "h", ".", "h", ")", "\n", "dst", ".", "cookies", "=", "copyArgs", "(", "dst", ".", "cookies", ",", "h", ".", "cookies", ")", "\n", "}" ]
23,269
all-23270
[ "Main", "draws", "the", "different", "line", "caps", "and", "joins", ".", "This", "should", "only", "be", "used", "during", "testing", "." ]
[ "func", "Main", "(", "gc", "draw2d", ".", "GraphicContext", ",", "ext", "string", ")", "(", "string", ",", "error", ")", "{", "// Draw the line", "const", "offset", "=", "75.0", "\n", "x", ":=", "35.0", "\n", "<mask>", ":=", "[", "]", "draw2d", ".", "LineCap", "{", "draw2d", ".", "ButtCap", ",", "draw2d", ".", "SquareCap", ",", "draw2d", ".", "RoundCap", "}", "\n", "joins", ":=", "[", "]", "draw2d", ".", "LineJoin", "{", "draw2d", ".", "BevelJoin", ",", "draw2d", ".", "MiterJoin", ",", "draw2d", ".", "RoundJoin", "}", "\n", "for", "i", ":=", "range", "caps", "{", "Draw", "(", "gc", ",", "caps", "[", "i", "]", ",", "joins", "[", "i", "]", ",", "x", ",", "50", ",", "x", ",", "160", ",", "offset", ")", "\n", "x", "+=", "offset", "\n", "}", "\n\n", "// Return the output filename", "return", "samples", ".", "Output", "(", "\"", "\"", ",", "ext", ")", ",", "nil", "\n", "}" ]
23,270
all-23271
[ "Process", "method", "starts", "the", "workManager", "by", "processing", "the", "rootPaths", "and", "resolving", "file", "/", "sequence", "listings", "from", "them", ".", "Output", "is", "printed", "according", "to", "application", "Options", ".", "It", "is", "an", "error", "to", "call", "this", "method", "more", "than", "once", "." ]
[ "func", "(", "w", "*", "workManager", ")", "<mask>", "(", "rootPaths", "[", "]", "string", ")", "error", "{", "if", "w", ".", "hasRun", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "w", ".", "hasRun", "=", "true", "\n\n", "// Start the workers to find sequences", "var", "wg", "sync", ".", "WaitGroup", "\n", "for", "i", ":=", "0", ";", "i", "<", "numWorkers", ";", "i", "++", "{", "wg", ".", "Add", "(", "1", ")", "\n", "go", "func", "(", ")", "{", "// Processes work from the input chans", "// and places them into the output chans", "w", ".", "processSources", "(", ")", "\n", "wg", ".", "Done", "(", ")", "\n", "}", "(", ")", "\n", "}", "\n\n", "// Load the root paths into the source channel", "go", "func", "(", ")", "{", "if", "Options", ".", "Recurse", "{", "// Perform a recursive walk on all paths", "w", ".", "loadRecursive", "(", "rootPaths", ")", "\n", "}", "else", "{", "// Load each root path directly into chan", "w", ".", "load", "(", "rootPaths", ")", "\n", "}", "\n", "w", ".", "closeInputs", "(", ")", "\n", "}", "(", ")", "\n\n", "// Will close the output channel when no more source", "// paths are being added", "go", "func", "(", ")", "{", "wg", ".", "Wait", "(", ")", "\n", "w", ".", "closeOutput", "(", ")", "\n", "}", "(", ")", "\n\n", "// Pull out all processed sequences and print", "w", ".", "processResults", "(", ")", "\n\n", "return", "nil", "\n", "}" ]
23,271
all-23272
[ "bind", "a", "named", "buffer", "object" ]
[ "func", "BindBuffer", "(", "target", "uint32", ",", "buffer", "uint32", ")", "{", "C", ".", "glowBindBuffer", "(", "gpBindBuffer", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ")", "\n", "}" ]
23,272
all-23273
[ "handlePingReq", "responds", "to", "the", "pingReq", "message", "with", "a", "pingRes", "." ]
[ "func", "(", "c", "*", "Connection", ")", "handlePingReq", "(", "frame", "*", "Frame", ")", "{", "if", "<mask>", ":=", "c", ".", "readState", "(", ")", ";", "state", "!=", "connectionActive", "{", "c", ".", "protocolError", "(", "frame", ".", "Header", ".", "ID", ",", "errConnNotActive", "{", "\"", "\"", ",", "state", "}", ")", "\n", "return", "\n", "}", "\n\n", "pingRes", ":=", "&", "pingRes", "{", "id", ":", "frame", ".", "Header", ".", "ID", "}", "\n", "if", "err", ":=", "c", ".", "sendMessage", "(", "pingRes", ")", ";", "err", "!=", "nil", "{", "c", ".", "connectionError", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}" ]
23,273
all-23274
[ "Helper", "function", "that", "checks", "if", "an", "[]", "asn1", ".", "ObjectIdentifier", "slice", "contains", "an", "asn1", ".", "ObjectIdentifier" ]
[ "func", "SliceContainsOID", "(", "list", "[", "]", "asn1", ".", "ObjectIdentifier", ",", "oid", "asn1", ".", "ObjectIdentifier", ")", "bool", "{", "for", "_", ",", "v", ":=", "<mask>", "list", "{", "if", "oid", ".", "Equal", "(", "v", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
23,274
all-23275
[ "Focus", "implements", "the", "interface", ".", "This", "is", "called", "from", "queue", "context", "so", "be", "careful", "to", "not", "use", "blocking", "calls", "." ]
[ "func", "(", "e", "*", "Edit", ")", "Focus", "(", ")", "{", "if", "e", ".", "cx", "==", "-", "1", "||", "e", ".", "cy", "==", "-", "1", "{", "// || is deliberate to handle \"just in case\"", "e", ".", "cx", "=", "e", ".", "trueX", "\n", "e", ".", "cy", "=", "e", ".", "trueY", "\n", "e", ".", "<mask>", "=", "0", "\n", "}", "\n", "setCursor", "(", "e", ".", "cx", ",", "e", ".", "cy", ")", "\n", "}" ]
23,275
all-23276
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventListener", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger10", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
23,276
all-23277
[ "BoundingBoxIntWithPrecision", "returns", "the", "region", "encoded", "by", "the", "integer", "geohash", "with", "the", "specified", "precision", "." ]
[ "func", "BoundingBoxIntWithPrecision", "(", "hash", "uint64", ",", "bits", "uint", ")", "Box", "{", "fullHash", ":=", "<mask>", "<<", "(", "64", "-", "bits", ")", "\n", "latInt", ",", "lngInt", ":=", "deinterleave", "(", "fullHash", ")", "\n", "lat", ":=", "decodeRange", "(", "latInt", ",", "90", ")", "\n", "lng", ":=", "decodeRange", "(", "lngInt", ",", "180", ")", "\n", "latErr", ",", "lngErr", ":=", "errorWithPrecision", "(", "bits", ")", "\n", "return", "Box", "{", "MinLat", ":", "lat", ",", "MaxLat", ":", "lat", "+", "latErr", ",", "MinLng", ":", "lng", ",", "MaxLng", ":", "lng", "+", "lngErr", ",", "}", "\n", "}" ]
23,277
all-23278
[ "dateToken", "generates", "a", "GitHub", "search", "query", "token", "for", "the", "specified", "date", "range", ".", "See", ":", "https", ":", "//", "help", ".", "github", ".", "com", "/", "articles", "/", "understanding", "-", "the", "-", "search", "-", "syntax", "/", "#query", "-", "for", "-", "dates" ]
[ "func", "dateToken", "(", "start", ",", "<mask>", "time", ".", "Time", ")", "string", "{", "// GitHub's GraphQL API silently fails if you provide it with an invalid time", "// string.", "// Dates before 1970 (unix epoch) are considered invalid.", "startString", ",", "endString", ":=", "\"", "\"", ",", "\"", "\"", "\n", "if", "start", ".", "Year", "(", ")", ">=", "1970", "{", "startString", "=", "start", ".", "Format", "(", "github", ".", "SearchTimeFormat", ")", "\n", "}", "\n", "if", "end", ".", "Year", "(", ")", ">=", "1970", "{", "endString", "=", "end", ".", "Format", "(", "github", ".", "SearchTimeFormat", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "startString", ",", "endString", ")", "\n", "}" ]
23,278
all-23279
[ "GetScale", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_scale", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "GetScale", "(", ")", "float64", "{", "c", ":=", "C", ".", "gtk_print_settings_get_scale", "(", "ps", ".", "native", "(", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
23,279
all-23280
[ "title", ":", "login", "path", ":", "/", "auth", "/", "login", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "403", ":", "Forbidden", "404", ":", "Not", "found" ]
[ "func", "login", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "(", "err", "error", ")", "{", "params", ":=", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", ",", "}", "\n", "fields", ":=", "InputFields", "(", "r", ")", "\n", "for", "key", ",", "<mask>", ":=", "range", "fields", "{", "params", "[", "key", "]", "=", "values", "[", "0", "]", "\n", "}", "\n", "token", ",", "err", ":=", "app", ".", "AuthScheme", ".", "Login", "(", "params", ")", "\n", "if", "err", "!=", "nil", "{", "return", "handleAuthError", "(", "err", ")", "\n", "}", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "token", ".", "GetValue", "(", ")", "}", ")", "\n", "}" ]
23,280
all-23281
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "TransactionResultCode", ")", "<mask>", "(", ")", "string", "{", "name", ",", "_", ":=", "transactionResultCodeMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "name", "\n", "}" ]
23,281
all-23282
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "AttachToTargetReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget28", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
23,282
all-23283
[ "HasLastNotifiedTs", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GroupData", ")", "HasLastNotifiedTs", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "LastNotifiedTs", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
23,283
all-23284
[ "Returns", "how", "many", "nodes", "are", "in", "the", "node", "table", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "NumNodes", "(", ")", "int", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "s", ".", "numNodes", "(", ")", "\n", "}" ]
23,284
all-23285
[ "Prev", "advances", "to", "the", "previous", "position", "." ]
[ "func", "(", "s", "*", "Iterator", ")", "Prev", "(", ")", "{", "y", ".", "AssertTrue", "(", "s", ".", "Valid", "(", ")", ")", "\n", "s", ".", "n", ",", "_", "=", "s", ".", "list", ".", "findNear", "(", "s", ".", "Key", "(", ")", ",", "true", ",", "<mask>", ")", "// find <. No equality allowed.", "\n", "}" ]
23,285
all-23286
[ "WriteToStreamingBytesServer", "writes", "the", "data", "from", "the", "io", ".", "Reader", "to", "the", "StreamingBytesServer", "." ]
[ "func", "WriteToStreamingBytesServer", "(", "<mask>", "io", ".", "Reader", ",", "streamingBytesServer", "StreamingBytesServer", ")", "error", "{", "buf", ":=", "GetBuffer", "(", ")", "\n", "defer", "PutBuffer", "(", "buf", ")", "\n", "_", ",", "err", ":=", "io", ".", "CopyBuffer", "(", "NewStreamingBytesWriter", "(", "streamingBytesServer", ")", ",", "ReaderWrapper", "{", "reader", "}", ",", "buf", ")", "\n", "return", "err", "\n", "}" ]
23,286
all-23287
[ "If", "n", "is", "an", "*", "ast", ".", "Ident", "isIdent", "returns", "it", ";", "otherwise", "isIdent", "returns", "nil", "." ]
[ "func", "isIdent", "(", "n", "interface", "{", "}", ")", "*", "ast", ".", "Ident", "{", "id", ",", "_", ":=", "n", ".", "(", "*", "ast", ".", "Ident", ")", "\n", "return", "<mask>", "\n", "}" ]
23,287
all-23288
[ "newIncomingContext", "creates", "a", "new", "context", "for", "an", "incoming", "call", "with", "the", "given", "span", "." ]
[ "func", "newIncomingContext", "(", "call", "IncomingCall", ",", "timeout", "time", ".", "Duration", ")", "(", "context", ".", "Context", ",", "context", ".", "CancelFunc", ")", "{", "return", "NewContextBuilder", "(", "timeout", ")", ".", "setIncomingCall", "(", "<mask>", ")", ".", "Build", "(", ")", "\n", "}" ]
23,288
all-23289
[ "SetIconFromIconName", "is", "a", "wrapper", "around", "gtk_tooltip_set_icon_from_icon_name", "()", "." ]
[ "func", "(", "t", "*", "Tooltip", ")", "SetIconFromIconName", "(", "iconName", "string", ",", "<mask>", "IconSize", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "iconName", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_tooltip_set_icon_from_icon_name", "(", "t", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "GtkIconSize", "(", "size", ")", ")", "\n", "}" ]
23,289
all-23290
[ "buildImplicitLinuxCPUSpec", "builds", "the", "implicit", "task", "CPU", "spec", "when", "task", "CPU", "and", "memory", "limit", "feature", "is", "enabled" ]
[ "func", "(", "task", "*", "Task", ")", "buildImplicitLinuxCPUSpec", "(", ")", "specs", ".", "LinuxCPU", "{", "// If task level CPU limits are missing,", "// aggregate container CPU shares when present", "var", "taskCPUShares", "uint64", "\n", "for", "_", ",", "container", ":=", "range", "task", ".", "Containers", "{", "if", "<mask>", ".", "CPU", ">", "0", "{", "taskCPUShares", "+=", "uint64", "(", "container", ".", "CPU", ")", "\n", "}", "\n", "}", "\n\n", "// If there are are no CPU limits at task or container level,", "// default task CPU shares", "if", "taskCPUShares", "==", "0", "{", "// Set default CPU shares", "taskCPUShares", "=", "minimumCPUShare", "\n", "}", "\n\n", "return", "specs", ".", "LinuxCPU", "{", "Shares", ":", "&", "taskCPUShares", ",", "}", "\n", "}" ]
23,290
all-23291
[ "Count", "is", "a", "convenience", "for", "checking", "the", "current", "number", "of", "nodes", "in", "the", "cluster", "." ]
[ "func", "Count", "(", "state", "*", "state", ".", "State", ")", "(", "int", ",", "error", ")", "{", "var", "count", "int", "\n", "err", ":=", "state", ".", "Cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "<mask>", "err", "error", "\n", "count", ",", "err", "=", "tx", ".", "NodesCount", "(", ")", "\n", "return", "err", "\n", "}", ")", "\n", "return", "count", ",", "err", "\n", "}" ]
23,291
all-23292
[ "ReadObject", "gets", "an", "object", "by", "hash", "and", "returns", "it", "directly", "as", "[]", "byte", "." ]
[ "func", "(", "c", "APIClient", ")", "ReadObject", "(", "hash", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "<mask>", "bytes", ".", "Buffer", "\n", "if", "err", ":=", "c", ".", "GetObject", "(", "hash", ",", "&", "buffer", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "buffer", ".", "Bytes", "(", ")", ",", "nil", "\n", "}" ]
23,292
all-23293
[ "Match", "is", "called", "once", "a", "server", "completes", "writing", "entries", "to", "disk", ":", "either", "the", "leader", "has", "written", "the", "new", "entry", "or", "a", "follower", "has", "replied", "to", "an", "AppendEntries", "RPC", ".", "The", "given", "server", "s", "disk", "agrees", "with", "this", "server", "s", "log", "up", "through", "the", "given", "index", "." ]
[ "func", "(", "c", "*", "commitment", ")", "<mask>", "(", "server", "ServerID", ",", "matchIndex", "uint64", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "if", "prev", ",", "hasVote", ":=", "c", ".", "matchIndexes", "[", "server", "]", ";", "hasVote", "&&", "matchIndex", ">", "prev", "{", "c", ".", "matchIndexes", "[", "server", "]", "=", "matchIndex", "\n", "c", ".", "recalculate", "(", ")", "\n", "}", "\n", "}" ]
23,293
all-23294
[ "WaitForIt", "waits", "for", "a", "service", "or", "URL", "to", "become", "online" ]
[ "func", "WaitForIt", "(", "fullConn", ",", "host", "string", ",", "port", ",", "timeout", "int", ")", "error", "{", "// fullConn := flag.String(\"full-connection\", \"\", \"full connection\")", "// host := flag.String(\"host\", \"\", \"host to connect\")", "// port := flag.Int(\"port\", 80, \"port to connect\")", "// timeout := flag.Int(\"timeout\", 10, \"time to wait until port become available\")", "// printVersion := flag.Bool(\"v\", false, \"show the current version\")", "// debug = flag.Bool(\"debug\", false, \"enable debug\")", "// flag.Parse()", "// if *printVersion {", "// \tfmt.Println(\"waitforit version \" + VERSION)", "// \treturn", "// }", "conn", ":=", "buildConn", "(", "host", ",", "port", ",", "fullConn", ")", "\n", "if", "conn", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "log", ".", "Debug", "(", "\"", "\"", "+", "strconv", ".", "Itoa", "(", "timeout", ")", "+", "\"", "\"", ")", "\n", "if", "err", ":=", "pingTCP", "(", "conn", ",", "timeout", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "<mask>", ".", "Scheme", "!=", "\"", "\"", "&&", "conn", ".", "Scheme", "!=", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "pingHTTP", "(", "conn", ",", "timeout", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
23,294
all-23295
[ "Scan", "implements", "database", "/", "sql", ".", "Scanner", "." ]
[ "func", "(", "x", "*", "VCS", ")", "Scan", "(", "v", "interface", "{", "}", ")", "error", "{", "if", "data", ",", "ok", ":=", "v", ".", "(", "[", "]", "byte", ")", ";", "<mask>", "{", "*", "x", "=", "VCS", "(", "data", ")", "\n", "return", "nil", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "x", ",", "v", ")", "\n", "}" ]
23,295
all-23296
[ "Zones", "returns", "the", "list", "of", "hosted", "zones", "." ]
[ "func", "(", "p", "*", "AWSProvider", ")", "Zones", "(", ")", "(", "map", "[", "string", "]", "*", "route53", ".", "HostedZone", ",", "error", ")", "{", "zones", ":=", "make", "(", "map", "[", "string", "]", "*", "route53", ".", "HostedZone", ")", "\n\n", "var", "tagErr", "error", "\n", "f", ":=", "func", "(", "resp", "*", "route53", ".", "ListHostedZonesOutput", ",", "lastPage", "bool", ")", "(", "shouldContinue", "bool", ")", "{", "for", "_", ",", "zone", ":=", "range", "resp", ".", "HostedZones", "{", "if", "!", "p", ".", "zoneIDFilter", ".", "Match", "(", "aws", ".", "StringValue", "(", "zone", ".", "Id", ")", ")", "{", "continue", "\n", "}", "\n\n", "if", "!", "p", ".", "zoneTypeFilter", ".", "Match", "(", "zone", ")", "{", "continue", "\n", "}", "\n\n", "if", "!", "p", ".", "domainFilter", ".", "Match", "(", "aws", ".", "StringValue", "(", "zone", ".", "Name", ")", ")", "{", "continue", "\n", "}", "\n\n", "// Only fetch tags if a tag filter was specified", "if", "!", "p", ".", "zoneTagFilter", ".", "IsEmpty", "(", ")", "{", "tags", ",", "err", ":=", "p", ".", "tagsForZone", "(", "*", "zone", ".", "Id", ")", "\n", "if", "err", "!=", "nil", "{", "tagErr", "=", "err", "\n", "return", "false", "\n", "}", "\n", "if", "!", "p", ".", "zoneTagFilter", ".", "Match", "(", "tags", ")", "{", "continue", "\n", "}", "\n", "}", "\n\n", "zones", "[", "aws", ".", "StringValue", "(", "zone", ".", "<mask>", ")", "]", "=", "zone", "\n", "}", "\n\n", "return", "true", "\n", "}", "\n\n", "err", ":=", "p", ".", "client", ".", "ListHostedZonesPages", "(", "&", "route53", ".", "ListHostedZonesInput", "{", "}", ",", "f", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "tagErr", "!=", "nil", "{", "return", "nil", ",", "tagErr", "\n", "}", "\n\n", "for", "_", ",", "zone", ":=", "range", "zones", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "aws", ".", "StringValue", "(", "zone", ".", "Id", ")", ",", "aws", ".", "StringValue", "(", "zone", ".", "Name", ")", ")", "\n", "}", "\n\n", "return", "zones", ",", "nil", "\n", "}" ]
23,296
all-23297
[ "isPrintable", "reports", "whether", "the", "given", "b", "is", "in", "the", "ASN", ".", "1", "PrintableString", "set", "." ]
[ "func", "isPrintable", "(", "b", "<mask>", ")", "bool", "{", "return", "'a'", "<=", "b", "&&", "b", "<=", "'z'", "||", "'A'", "<=", "b", "&&", "b", "<=", "'Z'", "||", "'0'", "<=", "b", "&&", "b", "<=", "'9'", "||", "'\\''", "<=", "b", "&&", "b", "<=", "')'", "||", "'+'", "<=", "b", "&&", "b", "<=", "'/'", "||", "b", "==", "' '", "||", "b", "==", "':'", "||", "b", "==", "'='", "||", "b", "==", "'?'", "||", "// This is technically not allowed in a PrintableString.", "// However, x509 certificates with wildcard strings don't", "// always use the correct string type so we permit it.", "b", "==", "'*'", "\n", "}" ]
23,297
all-23298
[ "GetDisplayFormatOk", "returns", "a", "tuple", "with", "the", "DisplayFormat", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TraceServiceDefinition", ")", "GetDisplayFormatOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "DisplayFormat", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "t", ".", "DisplayFormat", ",", "<mask>", "\n", "}" ]
23,298
all-23299
[ "And", "this", "function", "is", "why", "I", "started", "hating", "on", "btrfs", "..." ]
[ "func", "(", "s", "*", "storageBtrfs", ")", "ContainerCreateFromImage", "(", "container", "container", ",", "fingerprint", "string", ",", "tracker", "*", "ioprogress", ".", "ProgressTracker", ")", "error", "{", "logger", ".", "Debugf", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "s", ".", "volume", ".", "Name", ",", "s", ".", "pool", ".", "Name", ")", "\n\n", "source", ":=", "s", ".", "pool", ".", "Config", "[", "\"", "\"", "]", "\n", "if", "source", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "_", ",", "err", ":=", "s", ".", "StoragePoolMount", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// We can only create the btrfs subvolume under the mounted storage", "// pool. The on-disk layout for containers on a btrfs storage pool will", "// thus be", "// ${LXD_DIR}/storage-pools/<pool>/containers/. The btrfs tool will", "// complain if the intermediate path does not exist, so create it if it", "// doesn't already.", "containerSubvolumePath", ":=", "s", ".", "getContainerSubvolumePath", "(", "s", ".", "pool", ".", "Name", ")", "\n", "if", "!", "shared", ".", "PathExists", "(", "containerSubvolumePath", ")", "{", "err", ":=", "os", ".", "MkdirAll", "(", "containerSubvolumePath", ",", "containersDirMode", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Mountpoint of the image:", "// ${LXD_DIR}/images/<fingerprint>", "imageMntPoint", ":=", "getImageMountPoint", "(", "s", ".", "pool", ".", "Name", ",", "fingerprint", ")", "\n", "imageStoragePoolLockID", ":=", "getImageCreateLockID", "(", "s", ".", "pool", ".", "Name", ",", "fingerprint", ")", "\n", "lxdStorageMapLock", ".", "Lock", "(", ")", "\n", "if", "waitChannel", ",", "ok", ":=", "lxdStorageOngoingOperationMap", "[", "imageStoragePoolLockID", "]", ";", "ok", "{", "lxdStorageMapLock", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "ok", ":=", "<-", "waitChannel", ";", "ok", "{", "logger", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "else", "{", "lxdStorageOngoingOperationMap", "[", "imageStoragePoolLockID", "]", "=", "<mask>", "(", "chan", "bool", ")", "\n", "lxdStorageMapLock", ".", "Unlock", "(", ")", "\n\n", "var", "imgerr", "error", "\n", "if", "!", "shared", ".", "PathExists", "(", "imageMntPoint", ")", "||", "!", "isBtrfsSubVolume", "(", "imageMntPoint", ")", "{", "imgerr", "=", "s", ".", "ImageCreate", "(", "fingerprint", ",", "tracker", ")", "\n", "}", "\n\n", "lxdStorageMapLock", ".", "Lock", "(", ")", "\n", "if", "waitChannel", ",", "ok", ":=", "lxdStorageOngoingOperationMap", "[", "imageStoragePoolLockID", "]", ";", "ok", "{", "close", "(", "waitChannel", ")", "\n", "delete", "(", "lxdStorageOngoingOperationMap", ",", "imageStoragePoolLockID", ")", "\n", "}", "\n", "lxdStorageMapLock", ".", "Unlock", "(", ")", "\n\n", "if", "imgerr", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "imgerr", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Create a rw snapshot at", "// ${LXD_DIR}/storage-pools/<pool>/containers/<name>", "// from the mounted ro image snapshot mounted at", "// ${LXD_DIR}/storage-pools/<pool>/images/<fingerprint>", "containerSubvolumeName", ":=", "getContainerMountPoint", "(", "container", ".", "Project", "(", ")", ",", "s", ".", "pool", ".", "Name", ",", "container", ".", "Name", "(", ")", ")", "\n", "err", "=", "s", ".", "btrfsPoolVolumesSnapshot", "(", "imageMntPoint", ",", "containerSubvolumeName", ",", "false", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Create the mountpoint for the container at:", "// ${LXD_DIR}/containers/<name>", "err", "=", "createContainerMountpoint", "(", "containerSubvolumeName", ",", "container", ".", "Path", "(", ")", ",", "container", ".", "IsPrivileged", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "logger", ".", "Debugf", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "s", ".", "volume", ".", "Name", ",", "s", ".", "pool", ".", "Name", ")", "\n", "err", "=", "container", ".", "TemplateApply", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
23,299
all-23300
[ "=====", "Actions", "GET", "/", "api", "/", "temp_instance_prices", "Returns", "a", "JSON", "blob", "with", "all", "prices", "for", "Scenario", "Builder", "." ]
[ "func", "(", "loc", "*", "TempInstancePriceLocator", ")", "Index", "(", ")", "(", "string", ",", "error", ")", "{", "var", "res", "string", "\n", "var", "params", "rsapi", ".", "APIParams", "\n", "var", "p", "rsapi", ".", "APIParams", "\n", "uri", ",", "err", ":=", "loc", ".", "ActionPath", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "req", ",", "err", ":=", "loc", ".", "api", ".", "BuildHTTPRequest", "(", "uri", ".", "HTTPMethod", ",", "uri", ".", "<mask>", ",", "APIVersion", ",", "params", ",", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "resp", ",", "err", ":=", "loc", ".", "api", ".", "PerformRequest", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "<", "200", "||", "resp", ".", "StatusCode", ">", "299", "{", "respBody", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "sr", ":=", "string", "(", "respBody", ")", "\n", "if", "sr", "!=", "\"", "\"", "{", "sr", "=", "\"", "\"", "+", "sr", "\n", "}", "\n", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Status", ",", "sr", ")", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "respBody", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "res", "=", "string", "(", "respBody", ")", "\n", "return", "res", ",", "err", "\n", "}" ]