id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
19,500
all-19501
[ "doJsonRequest", "is", "the", "simplest", "type", "of", "request", ":", "a", "method", "on", "a", "URI", "that", "returns", "some", "JSON", "result", "which", "we", "unmarshal", "into", "the", "passed", "interface", ".", "It", "wraps", "doJsonRequestUnredacted", "to", "redact", "api", "and", "application", "keys", "from", "errors", "." ]
[ "func", "(", "client", "*", "Client", ")", "doJsonRequest", "(", "method", ",", "api", "string", ",", "reqbody", ",", "out", "interface", "{", "}", ")", "error", "{", "if", "err", ":=", "client", ".", "doJsonRequestUnredacted", "(", "method", ",", "api", ",", "reqbody", ",", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "client", ".", "redactError", "(", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,501
all-19502
[ "MemoryInUse", "returns", "total", "memory", "used", "by", "nodetables", "in", "a", "process" ]
[ "func", "MemoryInUse", "(", ")", "(", "sz", "int64", ")", "{", "buf", ":=", "dbInstances", ".", "MakeBuf", "(", ")", "\n", "defer", "dbInstances", ".", "FreeBuf", "(", "buf", ")", "\n", "iter", ":=", "dbInstances", ".", "NewIterator", "(", "CompareNodeTable", ",", "buf", ")", "\n", "for", "iter", ".", "SeekFirst", "(", ")", ";", "iter", ".", "Valid", "(", ")", ";", "iter", ".", "Next", "(", ")", "{", "db", ":=", "(", "*", "NodeTable", ")", "(", "iter", ".", "Get", "(", ")", ")", "\n", "sz", "+=", "<mask>", ".", "MemoryInUse", "(", ")", "\n", "}", "\n\n", "return", "\n", "}" ]
19,502
all-19503
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetPossibleBreakpointsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger35", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
19,503
all-19504
[ "addConnection", "adds", "the", "connection", "to", "the", "channel", "s", "list", "of", "connection", "if", "the", "channel", "is", "in", "a", "valid", "state", "to", "accept", "this", "connection", ".", "It", "returns", "whether", "the", "connection", "was", "added", "." ]
[ "func", "(", "ch", "*", "Channel", ")", "addConnection", "(", "c", "*", "Connection", ",", "direction", "connectionDirection", ")", "bool", "{", "ch", ".", "mutable", ".", "Lock", "(", ")", "\n", "defer", "ch", ".", "mutable", ".", "Unlock", "(", ")", "\n\n", "if", "c", ".", "readState", "(", ")", "!=", "connectionActive", "{", "return", "<mask>", "\n", "}", "\n\n", "switch", "state", ":=", "ch", ".", "mutable", ".", "state", ";", "state", "{", "case", "ChannelClient", ",", "ChannelListening", ":", "break", "\n", "default", ":", "return", "false", "\n", "}", "\n\n", "ch", ".", "mutable", ".", "conns", "[", "c", ".", "connID", "]", "=", "c", "\n", "return", "true", "\n", "}" ]
19,504
all-19505
[ "ServiceAccount", "returns", "a", "string", "representing", "the", "service", "account", "name", "in", "the", "form", "of", "an", "email", "address", "(", "typically", "app_id" ]
[ "func", "ServiceAccount", "(", "c", "context", ".", "<mask>", ")", "(", "string", ",", "error", ")", "{", "req", ":=", "&", "pb", ".", "GetServiceAccountNameRequest", "{", "}", "\n", "res", ":=", "&", "pb", ".", "GetServiceAccountNameResponse", "{", "}", "\n\n", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "res", ".", "GetServiceAccountName", "(", ")", ",", "err", "\n", "}" ]
19,505
all-19506
[ "UnmarshalJSON", "sets", "the", "UUID4", "from", "JSON" ]
[ "func", "(", "u", "*", "UUID4", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "if", "string", "(", "data", ")", "==", "jsonNull", "{", "return", "nil", "\n", "}", "\n", "l", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "u", ".", "UnmarshalEasyJSON", "(", "&", "l", ")", "\n", "return", "l", ".", "Error", "(", ")", "\n", "}" ]
19,506
all-19507
[ "NewRootFromPath", "takes", "the", "datacenter", "path", "for", "a", "specific", "entity", "and", "then", "appends", "the", "new", "particle", "supplied", "." ]
[ "func", "(", "p", "RootPathParticle", ")", "NewRootFromPath", "(", "inventoryPath", "string", ",", "newParticle", "RootPathParticle", ")", "(", "string", ",", "error", ")", "{", "dcPath", ",", "err", ":=", "p", ".", "SplitDatacenter", "(", "inventoryPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "inventoryPath", ",", "<mask>", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "dcPath", ",", "newParticle", ")", ",", "nil", "\n", "}" ]
19,507
all-19508
[ "Do", "executes", "Cast", ".", "startTabMirroring", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "StartTabMirroringParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandStartTabMirroring", ",", "p", ",", "nil", ")", "\n", "}" ]
19,508
all-19509
[ "NewHTTPSource", "creates", "a", "new", "HTTPSource", "instance" ]
[ "func", "NewHTTPSource", "(", "r", "*", "http", ".", "Response", ")", "(", "*", "HTTPSource", ",", "error", ")", "{", "body", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "s", ":=", "&", "HTTPSource", "{", "bytes", ".", "NewBuffer", "(", "body", ")", ",", "<mask>", ".", "Time", "{", "}", ",", "}", "\n\n", "if", "lastmodStr", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ";", "lastmodStr", "!=", "\"", "\"", "{", "t", ",", "err", ":=", "time", ".", "Parse", "(", "http", ".", "TimeFormat", ",", "lastmodStr", ")", "\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "t", "=", "time", ".", "Now", "(", ")", "\n", "}", "\n", "s", ".", "LastModifiedTime", "=", "t", "\n", "}", "else", "{", "s", ".", "LastModifiedTime", "=", "time", ".", "Now", "(", ")", "\n", "}", "\n\n", "return", "s", ",", "nil", "\n", "}" ]
19,509
all-19510
[ "Do", "executes", "CSS", ".", "collectClassNames", "against", "the", "provided", "context", ".", "returns", ":", "classNames", "-", "Class", "name", "list", "." ]
[ "func", "(", "p", "*", "CollectClassNamesParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "classNames", "[", "]", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "CollectClassNamesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCollectClassNames", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "ClassNames", ",", "nil", "\n", "}" ]
19,510
all-19511
[ "Aliases", "lists", "the", "aliases", "of", "an", "account" ]
[ "func", "(", "acc", "*", "Account", ")", "Aliases", "(", ")", "(", "[", "]", "*", "Alias", ",", "error", ")", "{", "var", "vl", "valueList", "\n", "err", ":=", "acc", ".", "Domain", ".", "cgp", ".", "<mask>", "(", "listAliases", "{", "Param", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "acc", ".", "Name", ",", "acc", ".", "Domain", ".", "Name", ")", "}", ",", "&", "vl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "*", "Alias", "{", "}", ",", "err", "\n", "}", "\n", "vals", ":=", "vl", ".", "compact", "(", ")", "\n", "as", ":=", "make", "(", "[", "]", "*", "Alias", ",", "len", "(", "vals", ")", ")", "\n", "for", "i", ",", "v", ":=", "range", "vals", "{", "as", "[", "i", "]", "=", "acc", ".", "Alias", "(", "v", ")", "\n", "}", "\n", "return", "as", ",", "nil", "\n", "}" ]
19,511
all-19512
[ "commonKind", "returns", "the", "kind", "to", "which", "v1", "and", "v2", "can", "be", "converted", "with", "the", "least", "information", "loss", "." ]
[ "func", "commonKind", "(", "v1", ",", "v2", "reflect", ".", "<mask>", ")", "reflect", ".", "Kind", "{", "k1", ":=", "unsizedKind", "(", "v1", ")", "\n", "k2", ":=", "unsizedKind", "(", "v2", ")", "\n", "if", "k1", "==", "k2", "&&", "(", "k1", "==", "reflect", ".", "Uint64", "||", "k1", "==", "reflect", ".", "Int64", ")", "{", "return", "k1", "\n", "}", "\n", "if", "k1", "==", "reflect", ".", "Complex128", "||", "k2", "==", "reflect", ".", "Complex128", "{", "return", "reflect", ".", "Complex128", "\n", "}", "\n", "return", "reflect", ".", "Float64", "\n", "}" ]
19,512
all-19513
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "BlockedReason", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "BlockedReason", "(", "in", ".", "String", "(", ")", ")", "{", "case", "BlockedReasonOther", ":", "*", "t", "=", "BlockedReasonOther", "\n", "case", "BlockedReasonCsp", ":", "*", "t", "=", "BlockedReasonCsp", "\n", "case", "BlockedReasonMixedContent", ":", "*", "t", "=", "BlockedReasonMixedContent", "\n", "case", "BlockedReasonOrigin", ":", "*", "t", "=", "BlockedReasonOrigin", "\n", "case", "BlockedReasonInspector", ":", "*", "t", "=", "BlockedReasonInspector", "\n", "case", "BlockedReasonSubresourceFilter", ":", "*", "t", "=", "BlockedReasonSubresourceFilter", "\n", "case", "BlockedReasonContentType", ":", "*", "t", "=", "BlockedReasonContentType", "\n", "case", "BlockedReasonCollapsedByClient", ":", "*", "t", "=", "BlockedReasonCollapsedByClient", "\n\n", "default", ":", "in", ".", "AddError", "(", "<mask>", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
19,513
all-19514
[ "IsLeader", "returns", "true", "if", "the", "candidate", "is", "currently", "a", "leader", "." ]
[ "func", "(", "c", "*", "Candidate", ")", "IsLeader", "(", ")", "bool", "{", "c", ".", "<mask>", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "leader", "\n", "}" ]
19,514
all-19515
[ "Attrs", "will", "return", "a", "map", "of", "the", "attributes", "added", "to", "the", "struct", "." ]
[ "func", "(", "a", "*", "Attrs", ")", "Attrs", "(", ")", "map", "[", "string", "]", "<mask>", "{", "}", "{", "a", ".", "attrsLock", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "attrsLock", ".", "RUnlock", "(", ")", "\n\n", "attrs", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "for", "hash", ",", "val", ":=", "range", "a", ".", "attrs", "{", "key", ",", "_", ":=", "getHashAttr", "(", "hash", ")", "\n", "attrs", "[", "key", "]", "=", "val", "\n", "}", "\n", "return", "attrs", "\n", "}" ]
19,515
all-19516
[ "GetDropIndex", "is", "a", "wrapper", "around", "gtk_toolbar_get_drop_index", "()", "." ]
[ "func", "(", "v", "*", "Toolbar", ")", "GetDropIndex", "(", "x", ",", "y", "int", ")", "int", "{", "c", ":=", "C", ".", "gtk_toolbar_get_drop_index", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "x", ")", ",", "C", ".", "gint", "(", "y", ")", ")", "\n", "<mask>", "int", "(", "c", ")", "\n", "}" ]
19,516
all-19517
[ "UDPAddr", "returns", "a", "UDP", "address", "of", "the", "listener", "that", "a", "server", "with", "a", "specific", "name", "is", "using", ".", "If", "there", "are", "more", "servers", "with", "the", "same", "name", "the", "address", "of", "the", "first", "started", "server", "is", "returned", "." ]
[ "func", "(", "s", "*", "Servers", ")", "UDPAddr", "(", "name", "string", ")", "(", "a", "*", "net", ".", "UDPAddr", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "for", "_", ",", "srv", ":=", "range", "s", ".", "servers", "{", "if", "srv", ".", "<mask>", "==", "name", "{", "return", "srv", ".", "udpAddr", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,517
all-19518
[ "Inside", "the", "handler", "use", "traces", "to", "capture", "request", "specific", "events", "and", "timings", "and", "the", "el", "member", "to", "log", "service", "specific", "events", "-", "like", "failures" ]
[ "func", "(", "th", "*", "timeHandler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "t", ",", "_", ":=", "trace", ".", "NewContext", "(", "context", ".", "Background", "(", ")", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "defer", "t", ".", "Finish", "(", ")", "\n\n", "tm", ":=", "<mask>", ".", "Now", "(", ")", ".", "Format", "(", "th", ".", "format", ")", "\n", "// log to the trace", "t", ".", "LazyPrintf", "(", "\"", "\"", ",", "tm", ")", "\n", "w", ".", "Write", "(", "[", "]", "byte", "(", "\"", "\"", "+", "tm", ")", ")", "\n", "}" ]
19,518
all-19519
[ "forwardPeerFrame", "forwards", "a", "frame", "from", "the", "peer", "to", "the", "appropriate", "message", "exchange" ]
[ "func", "(", "mexset", "*", "messageExchangeSet", ")", "forwardPeerFrame", "(", "frame", "*", "Frame", ")", "error", "{", "if", "mexset", ".", "log", ".", "Enabled", "(", "LogLevelDebug", ")", "{", "mexset", ".", "log", ".", "Debugf", "(", "\"", "\"", ",", "mexset", ".", "name", ",", "frame", ".", "Header", ")", "\n", "}", "\n\n", "mexset", ".", "RLock", "(", ")", "\n", "mex", ":=", "mexset", ".", "exchanges", "[", "frame", ".", "Header", ".", "ID", "]", "\n", "mexset", ".", "RUnlock", "(", ")", "\n\n", "if", "mex", "==", "nil", "{", "// This is ok since the exchange might have expired or been cancelled", "mexset", ".", "log", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "frame", ".", "Header", ".", "String", "(", ")", "}", ",", "LogField", "{", "\"", "\"", ",", "mexset", ".", "name", "}", ",", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "mex", ".", "forwardPeerFrame", "(", "frame", ")", ";", "err", "!=", "nil", "{", "mexset", ".", "log", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "frame", ".", "Header", ".", "String", "(", ")", "}", ",", "LogField", "{", "\"", "\"", ",", "<mask>", ".", "Header", ".", "FrameSize", "(", ")", "}", ",", "LogField", "{", "\"", "\"", ",", "mexset", ".", "name", "}", ",", "ErrField", "(", "err", ")", ",", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
19,519
all-19520
[ "SetDisplayName", "sets", "virtual", "machine", "name", "." ]
[ "func", "(", "v", "*", "VM", ")", "SetDisplayName", "(", "<mask>", "string", ")", "error", "{", "return", "v", ".", "updateVMX", "(", "func", "(", "model", "*", "vmx", ".", "VirtualMachine", ")", "error", "{", "model", ".", "DisplayName", "=", "name", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
19,520
all-19521
[ "UnmarshalJSON", "sets", "the", "HexColor", "from", "JSON" ]
[ "func", "(", "h", "*", "HexColor", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "l", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "h", ".", "UnmarshalEasyJSON", "(", "&", "l", ")", "\n", "return", "l", ".", "<mask>", "(", ")", "\n", "}" ]
19,521
all-19522
[ "GetQuery", "returns", "the", "Query", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "ApmOrLogQuerySearch", ")", "GetQuery", "(", ")", "string", "{", "if", "a", "==", "nil", "||", "a", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "a", ".", "Query", "\n", "}" ]
19,522
all-19523
[ "GetString", "property", "." ]
[ "func", "(", "c", "HubConfig", ")", "GetString", "(", "key", "string", ",", "defval", "string", ")", "string", "{", "val", ",", "ok", ":=", "c", "[", "key", "]", "\n", "if", "ok", "{", "s", ",", "<mask>", ":=", "val", ".", "(", "string", ")", "\n", "if", "ok", "&&", "len", "(", "s", ")", ">", "0", "{", "return", "s", "\n", "}", "\n", "// TODO only primitive types", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "val", ")", "\n", "}", "\n", "return", "defval", "\n", "}" ]
19,523
all-19524
[ "SharedFoldersParentDir", "returns", "the", "parent", "dir", "for", "share", "folders", "in", "the", "Guest", "." ]
[ "func", "(", "g", "*", "Guest", ")", "SharedFoldersParentDir", "(", ")", "(", "string", ",", "error", ")", "{", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n", "var", "<mask>", "*", "C", ".", "char", "\n\n", "err", "=", "C", ".", "get_property", "(", "g", ".", "handle", ",", "C", ".", "VIX_PROPERTY_GUEST_SHAREDFOLDERS_SHARES_PATH", ",", "unsafe", ".", "Pointer", "(", "&", "path", ")", ")", "\n\n", "defer", "C", ".", "Vix_FreeBuffer", "(", "unsafe", ".", "Pointer", "(", "path", ")", ")", "\n\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "\"", "\"", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "C", ".", "GoString", "(", "path", ")", ",", "nil", "\n", "}" ]
19,524
all-19525
[ "Status", "is", "a", "wrapper", "around", "cairo_status", "()", "." ]
[ "func", "(", "v", "*", "Context", ")", "Status", "(", ")", "<mask>", "{", "c", ":=", "C", ".", "cairo_status", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "Status", "(", "c", ")", "\n", "}" ]
19,525
all-19526
[ "New", "generator", "to", "create", "a", "grift", "task" ]
[ "func", "New", "(", "opts", "*", "Options", ")", "(", "*", "genny", ".", "Generator", ",", "error", ")", "{", "g", ":=", "genny", ".", "New", "(", ")", "\n\n", "if", "err", ":=", "opts", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "g", ",", "err", "\n", "}", "\n\n", "data", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "opts", ",", "}", "\n", "t", ":=", "gogen", ".", "TemplateTransformer", "(", "<mask>", ",", "template", ".", "FuncMap", "{", "}", ")", "\n", "g", ".", "Transformer", "(", "t", ")", "\n\n", "g", ".", "RunFn", "(", "func", "(", "r", "*", "genny", ".", "Runner", ")", "error", "{", "return", "genFile", "(", "r", ",", "opts", ")", "\n", "}", ")", "\n", "return", "g", ",", "nil", "\n", "}" ]
19,526
all-19527
[ "WalkSelect", "normalizes", "the", "AST", "in", "Select", "mode", "." ]
[ "func", "(", "nz", "*", "normalizer", ")", "WalkSelect", "(", "node", "SQLNode", ")", "(", "bool", ",", "error", ")", "{", "<mask>", "node", ":=", "node", ".", "(", "type", ")", "{", "case", "*", "SQLVal", ":", "nz", ".", "convertSQLValDedup", "(", "node", ")", "\n", "case", "*", "ComparisonExpr", ":", "nz", ".", "convertComparison", "(", "node", ")", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}" ]
19,527
all-19528
[ "xtoi2", "converts", "the", "next", "two", "hex", "digits", "of", "s", "into", "a", "byte", ".", "If", "s", "is", "longer", "than", "2", "bytes", "then", "the", "third", "byte", "must", "be", "e", ".", "If", "the", "first", "two", "bytes", "of", "s", "are", "not", "hex", "digits", "or", "the", "third", "byte", "does", "not", "match", "e", "false", "is", "returned", "." ]
[ "func", "xtoi2", "(", "s", "string", ",", "e", "byte", ")", "(", "byte", ",", "bool", ")", "{", "if", "len", "(", "s", ")", ">", "2", "&&", "s", "[", "2", "]", "!=", "e", "{", "return", "0", ",", "false", "\n", "}", "\n", "n", ",", "ei", ",", "<mask>", ":=", "xtoi", "(", "s", "[", ":", "2", "]", ",", "0", ")", "\n", "return", "byte", "(", "n", ")", ",", "ok", "&&", "ei", "==", "2", "\n", "}" ]
19,528
all-19529
[ "Fetch", "queries", "the", "Consul", "API", "defined", "by", "the", "given", "client", "." ]
[ "func", "(", "d", "*", "KVKeysQuery", ")", "Fetch", "(", "clients", "*", "ClientSet", ",", "opts", "*", "QueryOptions", ")", "(", "interface", "{", "}", ",", "*", "ResponseMetadata", ",", "error", ")", "{", "select", "{", "case", "<-", "d", ".", "stopCh", ":", "return", "nil", ",", "nil", ",", "ErrStopped", "\n", "default", ":", "}", "\n\n", "opts", "=", "opts", ".", "Merge", "(", "&", "QueryOptions", "{", "Datacenter", ":", "d", ".", "dc", ",", "}", ")", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "d", ",", "&", "url", ".", "URL", "{", "Path", ":", "\"", "\"", "+", "d", ".", "prefix", ",", "RawQuery", ":", "opts", ".", "String", "(", ")", ",", "}", ")", "\n\n", "<mask>", ",", "qm", ",", "err", ":=", "clients", ".", "Consul", "(", ")", ".", "KV", "(", ")", ".", "Keys", "(", "d", ".", "prefix", ",", "\"", "\"", ",", "opts", ".", "ToConsulOpts", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "d", ".", "String", "(", ")", ")", "\n", "}", "\n\n", "keys", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "list", ")", ")", "\n", "for", "i", ",", "v", ":=", "range", "list", "{", "v", "=", "strings", ".", "TrimPrefix", "(", "v", ",", "d", ".", "prefix", ")", "\n", "v", "=", "strings", ".", "TrimLeft", "(", "v", ",", "\"", "\"", ")", "\n", "keys", "[", "i", "]", "=", "v", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "d", ",", "len", "(", "list", ")", ")", "\n\n", "rm", ":=", "&", "ResponseMetadata", "{", "LastIndex", ":", "qm", ".", "LastIndex", ",", "LastContact", ":", "qm", ".", "LastContact", ",", "}", "\n\n", "return", "keys", ",", "rm", ",", "nil", "\n", "}" ]
19,529
all-19530
[ "NewPdf", "creates", "a", "new", "pdf", "document", "with", "the", "draw2d", "fontfolder", "adds", "a", "page", "and", "set", "fill", "color", "to", "white", "." ]
[ "func", "NewPdf", "(", "orientationStr", ",", "unitStr", ",", "sizeStr", "<mask>", ")", "*", "gofpdf", ".", "Fpdf", "{", "pdf", ":=", "gofpdf", ".", "New", "(", "orientationStr", ",", "unitStr", ",", "sizeStr", ",", "draw2d", ".", "GetFontFolder", "(", ")", ")", "\n", "// to be compatible with draw2d", "pdf", ".", "SetMargins", "(", "0", ",", "0", ",", "0", ")", "\n", "pdf", ".", "SetDrawColor", "(", "0", ",", "0", ",", "0", ")", "\n", "pdf", ".", "SetFillColor", "(", "255", ",", "255", ",", "255", ")", "\n", "pdf", ".", "SetLineCapStyle", "(", "\"", "\"", ")", "\n", "pdf", ".", "SetLineJoinStyle", "(", "\"", "\"", ")", "\n", "pdf", ".", "SetLineWidth", "(", "1", ")", "\n", "pdf", ".", "AddPage", "(", ")", "\n", "return", "pdf", "\n", "}" ]
19,530
all-19531
[ "Log", "passes", "the", "log", "record", "to", "all", "backends", "." ]
[ "func", "(", "b", "*", "multiLogger", ")", "Log", "(", "level", "Level", ",", "calldepth", "int", ",", "rec", "*", "Record", ")", "(", "err", "error", ")", "{", "for", "_", ",", "backend", ":=", "range", "b", ".", "backends", "{", "if", "backend", ".", "IsEnabledFor", "(", "<mask>", ",", "rec", ".", "Module", ")", "{", "// Shallow copy of the record for the formatted cache on Record and get the", "// record formatter from the backend.", "r2", ":=", "*", "rec", "\n", "if", "e", ":=", "backend", ".", "Log", "(", "level", ",", "calldepth", "+", "1", ",", "&", "r2", ")", ";", "e", "!=", "nil", "{", "err", "=", "e", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
19,531
all-19532
[ "ClearCompiledRegexes", "removes", "compiled", "regexes", "from", "the", "presubmits", "useful", "for", "testing", "when", "deep", "equality", "is", "needed", "between", "presubmits" ]
[ "func", "ClearCompiledRegexes", "(", "presubmits", "[", "]", "Presubmit", ")", "{", "for", "i", ":=", "<mask>", "presubmits", "{", "presubmits", "[", "i", "]", ".", "re", "=", "nil", "\n", "presubmits", "[", "i", "]", ".", "Brancher", ".", "re", "=", "nil", "\n", "presubmits", "[", "i", "]", ".", "Brancher", ".", "reSkip", "=", "nil", "\n", "presubmits", "[", "i", "]", ".", "RegexpChangeMatcher", ".", "reChanges", "=", "nil", "\n", "}", "\n", "}" ]
19,532
all-19533
[ "GetLegend", "returns", "the", "Legend", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "Widget", ")", "GetLegend", "(", ")", "bool", "{", "if", "w", "==", "nil", "||", "w", ".", "Legend", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "Legend", "\n", "}" ]
19,533
all-19534
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "Post", "a", "message", "on", "IRC", "to", "a", "specific", "channel", "or", "user", "or", "a", "specific", "user", "on", "a", "specific", "channel", ".", "Success", "of", "this", "API", "method", "does", "not", "imply", "the", "message", "was", "successfully", "posted", ".", "This", "API", "method", "merely", "inserts", "the", "IRC", "message", "into", "a", "queue", "that", "will", "be", "processed", "by", "a", "background", "process", ".", "This", "allows", "us", "to", "re", "-", "send", "the", "message", "in", "face", "of", "connection", "issues", ".", "However", "if", "the", "user", "isn", "t", "online", "the", "message", "will", "be", "dropped", "without", "error", ".", "We", "maybe", "improve", "this", "behavior", "in", "the", "future", ".", "For", "now", "just", "keep", "in", "mind", "that", "IRC", "is", "a", "best", "-", "effort", "service", ".", "Required", "scopes", ":", "If", "channelRequest", ":", "notify", ":", "irc", "-", "channel", ":", "<channel", ">", "See", "#irc" ]
[ "func", "(", "notify", "*", "Notify", ")", "Irc", "(", "payload", "*", "PostIRCMessageRequest", ")", "error", "{", "cd", ":=", "tcclient", ".", "<mask>", "(", "*", "notify", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "payload", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
19,534
all-19535
[ "IsEmail", "validates", "an", "email", "address", "." ]
[ "func", "IsEmail", "(", "str", "string", ")", "bool", "{", "addr", ",", "e", ":=", "<mask>", ".", "ParseAddress", "(", "str", ")", "\n", "return", "e", "==", "nil", "&&", "addr", ".", "Address", "!=", "\"", "\"", "\n", "}" ]
19,535
all-19536
[ "in", "searches", "for", "a", "given", "value", "in", "a", "given", "interface", "." ]
[ "func", "in", "(", "l", ",", "v", "interface", "{", "}", ")", "(", "bool", ",", "error", ")", "{", "lv", ":=", "reflect", ".", "ValueOf", "(", "l", ")", "\n", "vv", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n\n", "switch", "lv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Array", ",", "reflect", ".", "Slice", ":", "// if the slice contains 'interface' elements, then the element needs to be extracted directly to examine its type,", "// otherwise it will just resolve to 'interface'.", "var", "interfaceSlice", "[", "]", "interface", "{", "}", "\n", "if", "reflect", ".", "TypeOf", "(", "l", ")", ".", "Elem", "(", ")", ".", "Kind", "(", ")", "==", "reflect", ".", "Interface", "{", "interfaceSlice", "=", "l", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "lv", ".", "Len", "(", ")", ";", "i", "++", "{", "var", "lvv", "reflect", ".", "Value", "\n", "if", "interfaceSlice", "!=", "nil", "{", "lvv", "=", "reflect", ".", "ValueOf", "(", "interfaceSlice", "[", "i", "]", ")", "\n", "}", "else", "{", "lvv", "=", "lv", ".", "Index", "(", "i", ")", "\n", "}", "\n\n", "switch", "lvv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "switch", "vv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "if", "vv", ".", "Int", "(", ")", "==", "lvv", ".", "Int", "(", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "case", "reflect", ".", "Float32", ",", "reflect", ".", "Float64", ":", "switch", "vv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Float32", ",", "reflect", ".", "Float64", ":", "if", "vv", ".", "Float", "(", ")", "==", "lvv", ".", "<mask>", "(", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "case", "reflect", ".", "String", ":", "if", "vv", ".", "Type", "(", ")", "==", "lvv", ".", "Type", "(", ")", "&&", "vv", ".", "String", "(", ")", "==", "lvv", ".", "String", "(", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n", "}", "\n", "case", "reflect", ".", "String", ":", "if", "vv", ".", "Type", "(", ")", "==", "lv", ".", "Type", "(", ")", "&&", "strings", ".", "Contains", "(", "lv", ".", "String", "(", ")", ",", "vv", ".", "String", "(", ")", ")", "{", "return", "true", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "false", ",", "nil", "\n", "}" ]
19,536
all-19537
[ "Validates", "passed", "data", "against", "format", ".", "Note", "that", "the", "format", "name", "is", "automatically", "normalized", "e", ".", "g", ".", "one", "may", "use", "date", "-", "time", "to", "use", "the", "datetime", "format", "validator", "." ]
[ "func", "(", "f", "*", "defaultFormats", ")", "Validates", "(", "name", ",", "data", "string", ")", "bool", "{", "f", ".", "Lock", "(", ")", "\n", "defer", "f", ".", "Unlock", "(", ")", "\n", "nme", ":=", "f", ".", "normalizeName", "(", "name", ")", "\n", "for", "_", ",", "v", ":=", "<mask>", "f", ".", "data", "{", "if", "v", ".", "Name", "==", "nme", "{", "return", "v", ".", "Validator", "(", "data", ")", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
19,537
all-19538
[ "Details", "gets", "all", "the", "data", "for", "a", "venue", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "details" ]
[ "func", "(", "s", "*", "VenueService", ")", "Details", "(", "<mask>", "string", ")", "(", "*", "Venue", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "response", ":=", "new", "(", "Response", ")", "\n", "venue", ":=", "new", "(", "venueResp", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "id", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "response", ".", "Response", ",", "venue", ")", "\n", "}", "\n", "return", "&", "venue", ".", "Venue", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
19,538
all-19539
[ "control", "clip", "coordinate", "to", "window", "coordinate", "behavior" ]
[ "func", "ClipControl", "(", "origin", "uint32", ",", "depth", "uint32", ")", "{", "C", ".", "glowClipControl", "(", "gpClipControl", ",", "(", "C", ".", "GLenum", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "depth", ")", ")", "\n", "}" ]
19,539
all-19540
[ "DeepCopyObject", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "runtime", ".", "Object", "." ]
[ "func", "(", "in", "*", "DNSEndpointList", ")", "DeepCopyObject", "(", ")", "runtime", ".", "Object", "{", "if", "c", ":=", "<mask>", ".", "DeepCopy", "(", ")", ";", "c", "!=", "nil", "{", "return", "c", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,540
all-19541
[ "CanInsert", "is", "a", "wrapper", "around", "gtk_text_iter_can_insert", "()", "." ]
[ "func", "(", "v", "*", "TextIter", ")", "CanInsert", "(", "v1", "bool", ")", "bool", "{", "<mask>", "gobool", "(", "C", ".", "gtk_text_iter_can_insert", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "v1", ")", ")", ")", "\n", "}" ]
19,541
all-19542
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "InitiatorType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "InitiatorType", "(", "in", ".", "String", "(", ")", ")", "{", "case", "InitiatorTypeParser", ":", "*", "t", "=", "InitiatorTypeParser", "\n", "case", "InitiatorTypeScript", ":", "*", "t", "=", "InitiatorTypeScript", "\n", "case", "InitiatorTypePreload", ":", "*", "t", "=", "InitiatorTypePreload", "\n", "<mask>", "InitiatorTypeSignedExchange", ":", "*", "t", "=", "InitiatorTypeSignedExchange", "\n", "case", "InitiatorTypeOther", ":", "*", "t", "=", "InitiatorTypeOther", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
19,542
all-19543
[ "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", "(", "w", "*", "Widget", ")", "GetDisplayFormatOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "DisplayFormat", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "DisplayFormat", ",", "true", "\n", "}" ]
19,543
all-19544
[ "GetRole", "returns", "the", "Role", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "GetRole", "(", ")", "string", "{", "if", "c", "==", "nil", "||", "c", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "Role", "\n", "}" ]
19,544
all-19545
[ "native", "()", "returns", "a", "pointer", "to", "the", "underlying", "GNotification", "." ]
[ "func", "(", "v", "*", "Notification", ")", "native", "(", ")", "*", "C", ".", "GNotification", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "return", "C", ".", "toGNotification", "(", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", ")", "\n", "}" ]
19,545
all-19546
[ "ListGroups", "lists", "all", "groups" ]
[ "func", "(", "c", "*", "Client", ")", "ListGroups", "(", ")", "(", "*", "Groups", ",", "error", ")", "{", "url", ":=", "umGroups", "(", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "<mask>", ".", "pretty", ")", "\n", "ret", ":=", "&", "Groups", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Get", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
19,546
all-19547
[ "postProcessRegistries", "checks", "the", "consistency", "of", "all", "registries", "(", "e", ".", "g", ".", "set", "the", "Prefix", "to", "Location", "if", "not", "set", ")", "and", "applies", "conflict", "checks", ".", "It", "returns", "an", "array", "of", "cleaned", "registries", "and", "error", "in", "case", "of", "conflicts", "." ]
[ "func", "postProcessRegistries", "(", "regs", "[", "]", "Registry", ")", "(", "[", "]", "Registry", ",", "error", ")", "{", "var", "registries", "[", "]", "Registry", "\n", "regMap", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "Registry", ")", "\n\n", "for", "_", ",", "reg", ":=", "range", "regs", "{", "var", "err", "error", "\n\n", "// make sure Location and Prefix are valid", "reg", ".", "Location", ",", "err", "=", "parseLocation", "(", "reg", ".", "Location", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "reg", ".", "Prefix", "==", "\"", "\"", "{", "reg", ".", "Prefix", "=", "reg", ".", "Location", "\n", "}", "else", "{", "reg", ".", "Prefix", ",", "err", "=", "parseLocation", "(", "reg", ".", "Prefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// make sure mirrors are valid", "for", "_", ",", "mir", ":=", "range", "reg", ".", "Mirrors", "{", "mir", ".", "Location", ",", "err", "=", "parseLocation", "(", "mir", ".", "Location", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "registries", "=", "<mask>", "(", "registries", ",", "reg", ")", "\n", "regMap", "[", "reg", ".", "Location", "]", "=", "append", "(", "regMap", "[", "reg", ".", "Location", "]", ",", "reg", ")", "\n", "}", "\n\n", "// Given a registry can be mentioned multiple times (e.g., to have", "// multiple prefixes backed by different mirrors), we need to make sure", "// there are no conflicts among them.", "//", "// Note: we need to iterate over the registries array to ensure a", "// deterministic behavior which is not guaranteed by maps.", "for", "_", ",", "reg", ":=", "range", "registries", "{", "others", ",", "_", ":=", "regMap", "[", "reg", ".", "Location", "]", "\n", "for", "_", ",", "other", ":=", "range", "others", "{", "if", "reg", ".", "Insecure", "!=", "other", ".", "Insecure", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "reg", ".", "Location", ")", "\n\n", "return", "nil", ",", "&", "InvalidRegistries", "{", "s", ":", "msg", "}", "\n", "}", "\n", "if", "reg", ".", "Blocked", "!=", "other", ".", "Blocked", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "reg", ".", "Location", ")", "\n", "return", "nil", ",", "&", "InvalidRegistries", "{", "s", ":", "msg", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "registries", ",", "nil", "\n", "}" ]
19,547
all-19548
[ "export", "goTrackbarCallback" ]
[ "func", "goTrackbarCallback", "(", "barName_", ",", "winName_", "*", "C", ".", "char", ",", "pos", "C", ".", "int", ")", "{", "runtime", ".", "LockOSThread", "(", ")", "\n", "defer", "runtime", ".", "UnlockOSThread", "(", ")", "\n\n", "winName", ":=", "C", ".", "GoString", "(", "winName_", ")", "\n", "barName", ":=", "C", ".", "GoString", "(", "barName_", ")", "\n\n", "win", ",", "ok", ":=", "allWindows", "[", "winName", "]", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n\n", "trackbarHandle", ",", "ok", ":=", "win", ".", "trackbarHandle", "[", "barName", "]", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n", "if", "trackbarHandle", "==", "nil", "{", "return", "\n", "}", "\n\n", "if", "fa", ",", "ok", ":=", "trackbarHandle", ".", "(", "func", "(", "pos", "int", ")", ")", ";", "ok", "{", "fa", "(", "int", "(", "pos", ")", ")", "\n", "}", "else", "if", "fb", ",", "ok", ":=", "trackbarHandle", ".", "(", "func", "(", "pos", "int", ",", "param", "...", "interface", "{", "}", ")", ")", ";", "<mask>", "{", "param", ":=", "win", ".", "trackbarParam", "[", "barName", "]", "\n", "if", "param", "!=", "nil", "{", "fb", "(", "int", "(", "pos", ")", ",", "param", "...", ")", "\n", "}", "else", "{", "fb", "(", "int", "(", "pos", ")", ")", "\n", "}", "\n", "}", "\n", "}" ]
19,548
all-19549
[ "1", ".", "Check", "that", "the", "status", "event", "received", "from", "the", "webhook", "is", "for", "the", "CNCF", "-", "CLA", ".", "2", ".", "Use", "the", "github", "search", "API", "to", "search", "for", "the", "PRs", "which", "match", "the", "commit", "hash", "corresponding", "to", "the", "status", "event", ".", "3", ".", "For", "each", "issue", "that", "matches", "check", "that", "the", "PR", "s", "HEAD", "commit", "hash", "against", "the", "commit", "hash", "for", "which", "the", "status", "was", "received", ".", "This", "is", "because", "we", "only", "care", "about", "the", "status", "associated", "with", "the", "last", "(", "latest", ")", "commit", "in", "a", "PR", ".", "4", ".", "Set", "the", "corresponding", "CLA", "label", "if", "needed", "." ]
[ "func", "handle", "(", "gc", "gitHubClient", ",", "log", "*", "logrus", ".", "Entry", ",", "se", "github", ".", "StatusEvent", ")", "error", "{", "if", "se", ".", "State", "==", "\"", "\"", "||", "se", ".", "Context", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "se", ".", "Context", "!=", "claContextName", "{", "// Not the CNCF CLA context, do not process this.", "return", "nil", "\n", "}", "\n\n", "if", "se", ".", "State", "==", "github", ".", "StatusPending", "{", "// do nothing and wait for state to be updated.", "return", "nil", "\n", "}", "\n\n", "org", ":=", "se", ".", "Repo", ".", "Owner", ".", "Login", "\n", "repo", ":=", "se", ".", "Repo", ".", "Name", "\n", "log", ".", "Info", "(", "\"", "\"", ")", "\n\n", "var", "issues", "[", "]", "github", ".", "Issue", "\n", "var", "err", "error", "\n", "for", "i", ":=", "0", ";", "i", "<", "maxRetries", ";", "i", "++", "{", "issues", ",", "err", "=", "gc", ".", "FindIssues", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "se", ".", "SHA", ",", "org", ",", "repo", ")", ",", "\"", "\"", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "len", "(", "issues", ")", ">", "0", "{", "break", "\n", "}", "\n", "<mask>", ".", "Sleep", "(", "10", "*", "time", ".", "Second", ")", "\n", "}", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "len", "(", "issues", ")", ")", "\n\n", "for", "_", ",", "issue", ":=", "range", "issues", "{", "l", ":=", "log", ".", "WithField", "(", "\"", "\"", ",", "issue", ".", "Number", ")", "\n", "hasCncfYes", ":=", "issue", ".", "HasLabel", "(", "labels", ".", "ClaYes", ")", "\n", "hasCncfNo", ":=", "issue", ".", "HasLabel", "(", "labels", ".", "ClaNo", ")", "\n", "if", "hasCncfYes", "&&", "se", ".", "State", "==", "github", ".", "StatusSuccess", "{", "// Nothing to update.", "l", ".", "Infof", "(", "\"", "\"", ",", "labels", ".", "ClaYes", ")", "\n", "continue", "\n", "}", "\n\n", "if", "hasCncfNo", "&&", "(", "se", ".", "State", "==", "github", ".", "StatusFailure", "||", "se", ".", "State", "==", "github", ".", "StatusError", ")", "{", "// Nothing to update.", "l", ".", "Infof", "(", "\"", "\"", ",", "labels", ".", "ClaNo", ")", "\n", "continue", "\n", "}", "\n\n", "l", ".", "Info", "(", "\"", "\"", ")", "\n", "pr", ",", "err", ":=", "gc", ".", "GetPullRequest", "(", "org", ",", "repo", ",", "issue", ".", "Number", ")", "\n", "if", "err", "!=", "nil", "{", "l", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "issue", ".", "Number", ",", "org", ",", "repo", ")", "\n", "continue", "\n", "}", "\n\n", "// Check if this is the latest commit in the PR.", "if", "pr", ".", "Head", ".", "SHA", "!=", "se", ".", "SHA", "{", "l", ".", "Info", "(", "\"", "\"", ")", "\n", "continue", "\n", "}", "\n\n", "number", ":=", "pr", ".", "Number", "\n", "if", "se", ".", "State", "==", "github", ".", "StatusSuccess", "{", "if", "hasCncfNo", "{", "if", "err", ":=", "gc", ".", "RemoveLabel", "(", "org", ",", "repo", ",", "number", ",", "labels", ".", "ClaNo", ")", ";", "err", "!=", "nil", "{", "l", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "labels", ".", "ClaNo", ")", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "gc", ".", "AddLabel", "(", "org", ",", "repo", ",", "number", ",", "labels", ".", "ClaYes", ")", ";", "err", "!=", "nil", "{", "l", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "labels", ".", "ClaYes", ")", "\n", "}", "\n", "continue", "\n", "}", "\n\n", "// If we end up here, the status is a failure/error.", "if", "hasCncfYes", "{", "if", "err", ":=", "gc", ".", "RemoveLabel", "(", "org", ",", "repo", ",", "number", ",", "labels", ".", "ClaYes", ")", ";", "err", "!=", "nil", "{", "l", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "labels", ".", "ClaYes", ")", "\n", "}", "\n", "}", "\n", "if", "err", ":=", "gc", ".", "CreateComment", "(", "org", ",", "repo", ",", "number", ",", "fmt", ".", "Sprintf", "(", "cncfclaNotFoundMessage", ",", "plugins", ".", "AboutThisBot", ")", ")", ";", "err", "!=", "nil", "{", "l", ".", "WithError", "(", "err", ")", ".", "Warning", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "err", ":=", "gc", ".", "AddLabel", "(", "org", ",", "repo", ",", "number", ",", "labels", ".", "ClaNo", ")", ";", "err", "!=", "nil", "{", "l", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "labels", ".", "ClaNo", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,549
all-19550
[ "generateUUID", "is", "used", "to", "generate", "a", "random", "UUID", "." ]
[ "func", "generateUUID", "(", ")", "string", "{", "buf", ":=", "<mask>", "(", "[", "]", "byte", ",", "16", ")", "\n", "if", "_", ",", "err", ":=", "crand", ".", "Read", "(", "buf", ")", ";", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "}", "\n\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "buf", "[", "0", ":", "4", "]", ",", "buf", "[", "4", ":", "6", "]", ",", "buf", "[", "6", ":", "8", "]", ",", "buf", "[", "8", ":", "10", "]", ",", "buf", "[", "10", ":", "16", "]", ")", "\n", "}" ]
19,550
all-19551
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventCharacterDataModified", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom66", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
19,551
all-19552
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StopRuleUsageTrackingParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss7", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
19,552
all-19553
[ "GetTitleOk", "returns", "a", "tuple", "with", "the", "Title", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HeatmapDefinition", ")", "GetTitleOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "h", "==", "nil", "||", "h", ".", "Title", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "h", ".", "Title", ",", "<mask>", "\n", "}" ]
19,553
all-19554
[ "Next", "returns", "the", "next", "page", "of", "resources", ".", "If", "there", "are", "no", "more", "resources", "NoMoreResults", "is", "returned", "." ]
[ "func", "(", "c", "*", "KeyPageIterator", ")", "Next", "(", "ctx", "<mask>", ".", "Context", ")", "(", "*", "KeyPage", ",", "error", ")", "{", "kp", ":=", "new", "(", "KeyPage", ")", "\n", "err", ":=", "c", ".", "p", ".", "Next", "(", "ctx", ",", "kp", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "p", ".", "SetNextPageURI", "(", "kp", ".", "NextPageURI", ")", "\n", "return", "kp", ",", "nil", "\n", "}" ]
19,554
all-19555
[ "Failf", "outputs", "formatted", "Failed", "log" ]
[ "func", "Failf", "(", "format", "string", ",", "val", "...", "<mask>", "{", "}", ")", "error", "{", "return", "glg", ".", "out", "(", "FAIL", ",", "format", ",", "val", "...", ")", "\n", "}" ]
19,555
all-19556
[ "Do", "executes", "Emulation", ".", "canEmulate", "against", "the", "provided", "context", ".", "returns", ":", "result", "-", "True", "if", "emulation", "is", "supported", "." ]
[ "func", "(", "p", "*", "CanEmulateParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "result", "bool", ",", "err", "error", ")", "{", "// execute", "var", "res", "CanEmulateReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandCanEmulate", ",", "nil", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Result", ",", "nil", "\n", "}" ]
19,556
all-19557
[ "Renew", "renews", "an", "existing", "lease", ".", "If", "the", "given", "lease", "does", "not", "exist", "or", "has", "expired", "an", "error", "will", "be", "returned", "." ]
[ "func", "(", "le", "*", "lessor", ")", "Renew", "(", "id", "LeaseID", ")", "(", "int64", ",", "error", ")", "{", "le", ".", "mu", ".", "RLock", "(", ")", "\n", "if", "!", "le", ".", "isPrimary", "(", ")", "{", "// forward renew request to primary instead of returning error.", "le", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "-", "1", ",", "ErrNotPrimary", "\n", "}", "\n\n", "demotec", ":=", "le", ".", "demotec", "\n\n", "l", ":=", "le", ".", "leaseMap", "[", "<mask>", "]", "\n", "if", "l", "==", "nil", "{", "le", ".", "mu", ".", "RUnlock", "(", ")", "\n", "return", "-", "1", ",", "ErrLeaseNotFound", "\n", "}", "\n", "// Clear remaining TTL when we renew if it is set", "clearRemainingTTL", ":=", "le", ".", "cp", "!=", "nil", "&&", "l", ".", "remainingTTL", ">", "0", "\n\n", "le", ".", "mu", ".", "RUnlock", "(", ")", "\n", "if", "l", ".", "expired", "(", ")", "{", "select", "{", "// A expired lease might be pending for revoking or going through", "// quorum to be revoked. To be accurate, renew request must wait for the", "// deletion to complete.", "case", "<-", "l", ".", "revokec", ":", "return", "-", "1", ",", "ErrLeaseNotFound", "\n", "// The expired lease might fail to be revoked if the primary changes.", "// The caller will retry on ErrNotPrimary.", "case", "<-", "demotec", ":", "return", "-", "1", ",", "ErrNotPrimary", "\n", "case", "<-", "le", ".", "stopC", ":", "return", "-", "1", ",", "ErrNotPrimary", "\n", "}", "\n", "}", "\n\n", "// Clear remaining TTL when we renew if it is set", "// By applying a RAFT entry only when the remainingTTL is already set, we limit the number", "// of RAFT entries written per lease to a max of 2 per checkpoint interval.", "if", "clearRemainingTTL", "{", "le", ".", "cp", "(", "context", ".", "Background", "(", ")", ",", "&", "pb", ".", "LeaseCheckpointRequest", "{", "Checkpoints", ":", "[", "]", "*", "pb", ".", "LeaseCheckpoint", "{", "{", "ID", ":", "int64", "(", "l", ".", "ID", ")", ",", "Remaining_TTL", ":", "0", "}", "}", "}", ")", "\n", "}", "\n\n", "le", ".", "mu", ".", "Lock", "(", ")", "\n", "l", ".", "refresh", "(", "0", ")", "\n", "item", ":=", "&", "LeaseWithTime", "{", "id", ":", "l", ".", "ID", ",", "time", ":", "l", ".", "expiry", ".", "UnixNano", "(", ")", "}", "\n", "heap", ".", "Push", "(", "&", "le", ".", "leaseHeap", ",", "item", ")", "\n", "le", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "leaseRenewed", ".", "Inc", "(", ")", "\n", "return", "l", ".", "ttl", ",", "nil", "\n", "}" ]
19,557
all-19558
[ "InterleavedKVToFields", "converts", "keyValues", "a", "la", "Span", ".", "LogKV", "()", "to", "a", "Field", "slice", "a", "la", "Span", ".", "LogFields", "()", "." ]
[ "func", "InterleavedKVToFields", "(", "keyValues", "...", "interface", "{", "}", ")", "(", "[", "]", "Field", ",", "error", ")", "{", "if", "len", "(", "keyValues", ")", "%", "2", "!=", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "keyValues", ")", ")", "\n", "}", "\n", "fields", ":=", "make", "(", "[", "]", "Field", ",", "len", "(", "keyValues", ")", "/", "2", ")", "\n", "for", "i", ":=", "0", ";", "i", "*", "2", "<", "len", "(", "keyValues", ")", ";", "i", "++", "{", "key", ",", "ok", ":=", "keyValues", "[", "i", "*", "2", "]", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ",", "keyValues", "[", "i", "*", "2", "]", ")", "\n", "}", "\n", "switch", "typedVal", ":=", "keyValues", "[", "i", "*", "2", "+", "1", "]", ".", "(", "type", ")", "{", "case", "bool", ":", "fields", "[", "i", "]", "=", "Bool", "(", "key", ",", "typedVal", ")", "\n", "case", "string", ":", "fields", "[", "i", "]", "=", "String", "(", "key", ",", "typedVal", ")", "\n", "case", "int", ":", "fields", "[", "i", "]", "=", "Int", "(", "key", ",", "typedVal", ")", "\n", "case", "int8", ":", "fields", "[", "i", "]", "=", "Int32", "(", "key", ",", "int32", "(", "typedVal", ")", ")", "\n", "case", "int16", ":", "fields", "[", "i", "]", "=", "Int32", "(", "key", ",", "int32", "(", "typedVal", ")", ")", "\n", "case", "int32", ":", "fields", "[", "i", "]", "=", "Int32", "(", "key", ",", "typedVal", ")", "\n", "case", "int64", ":", "fields", "[", "i", "]", "=", "Int64", "(", "key", ",", "typedVal", ")", "\n", "case", "uint", ":", "fields", "[", "i", "]", "=", "Uint64", "(", "key", ",", "uint64", "(", "typedVal", ")", ")", "\n", "case", "uint64", ":", "fields", "[", "i", "]", "=", "Uint64", "(", "key", ",", "typedVal", ")", "\n", "<mask>", "uint8", ":", "fields", "[", "i", "]", "=", "Uint32", "(", "key", ",", "uint32", "(", "typedVal", ")", ")", "\n", "case", "uint16", ":", "fields", "[", "i", "]", "=", "Uint32", "(", "key", ",", "uint32", "(", "typedVal", ")", ")", "\n", "case", "uint32", ":", "fields", "[", "i", "]", "=", "Uint32", "(", "key", ",", "typedVal", ")", "\n", "case", "float32", ":", "fields", "[", "i", "]", "=", "Float32", "(", "key", ",", "typedVal", ")", "\n", "case", "float64", ":", "fields", "[", "i", "]", "=", "Float64", "(", "key", ",", "typedVal", ")", "\n", "default", ":", "// When in doubt, coerce to a string", "fields", "[", "i", "]", "=", "String", "(", "key", ",", "fmt", ".", "Sprint", "(", "typedVal", ")", ")", "\n", "}", "\n", "}", "\n", "return", "fields", ",", "nil", "\n", "}" ]
19,558
all-19559
[ "Str", "takes", "a", "null", "-", "terminated", "Go", "string", "and", "returns", "its", "GL", "-", "compatible", "address", ".", "This", "function", "reaches", "into", "Go", "string", "storage", "in", "an", "unsafe", "way", "so", "the", "caller", "must", "ensure", "the", "string", "is", "not", "garbage", "collected", "." ]
[ "func", "Str", "(", "str", "string", ")", "*", "uint8", "{", "if", "!", "strings", ".", "HasSuffix", "(", "str", ",", "\"", "\\x00", "\"", ")", "{", "panic", "(", "\"", "\"", "+", "str", ")", "\n", "}", "\n", "<mask>", ":=", "(", "*", "reflect", ".", "StringHeader", ")", "(", "unsafe", ".", "Pointer", "(", "&", "str", ")", ")", "\n", "return", "(", "*", "uint8", ")", "(", "unsafe", ".", "Pointer", "(", "header", ".", "Data", ")", ")", "\n", "}" ]
19,559
all-19560
[ "Scalar", "returns", "a", "Scalar", "value", ".", "An", "error", "is", "returned", "if", "the", "result", "was", "an", "error", "or", "the", "result", "value", "is", "not", "a", "Scalar", "." ]
[ "func", "(", "r", "*", "Result", ")", "Scalar", "(", ")", "(", "Scalar", ",", "error", ")", "{", "if", "r", ".", "Err", "!=", "nil", "{", "return", "Scalar", "{", "}", ",", "r", ".", "Err", "\n", "}", "\n", "v", ",", "ok", ":=", "r", ".", "Value", ".", "(", "Scalar", ")", "\n", "if", "!", "ok", "{", "return", "Scalar", "{", "}", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "v", ",", "nil", "\n", "}" ]
19,560
all-19561
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "TouchType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "<mask>", "(", "string", "(", "t", ")", ")", "\n", "}" ]
19,561
all-19562
[ "Delete", "deletes", "the", "virtual", "disk", "at", "the", "specified", "datastore", "path", "." ]
[ "func", "Delete", "(", "client", "*", "govmomi", ".", "Client", ",", "name", "string", ",", "dc", "*", "object", ".", "Datacenter", ")", "error", "{", "if", "dc", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "name", ",", "dc", ")", "\n", "vdm", ":=", "object", ".", "NewVirtualDiskManager", "(", "client", ".", "Client", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "task", ",", "err", ":=", "vdm", ".", "DeleteVirtualDisk", "(", "ctx", ",", "<mask>", ",", "dc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "tctx", ",", "tcancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "tcancel", "(", ")", "\n", "if", "err", ":=", "task", ".", "Wait", "(", "tctx", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "name", ",", "dc", ")", "\n", "return", "nil", "\n", "}" ]
19,562
all-19563
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StyleDeclarationEdit", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
19,563
all-19564
[ "NewPlanValue", "builds", "a", "sqltypes", ".", "PlanValue", "from", "an", "Expr", "." ]
[ "func", "NewPlanValue", "(", "node", "Expr", ")", "(", "sqltypes", ".", "PlanValue", ",", "error", ")", "{", "switch", "node", ":=", "node", ".", "(", "type", ")", "{", "case", "*", "SQLVal", ":", "switch", "node", ".", "Type", "{", "case", "ValArg", ":", "return", "sqltypes", ".", "PlanValue", "{", "Key", ":", "string", "(", "node", ".", "Val", "[", "1", ":", "]", ")", "}", ",", "nil", "\n", "case", "IntVal", ":", "n", ",", "err", ":=", "sqltypes", ".", "NewIntegral", "(", "string", "(", "node", ".", "Val", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "sqltypes", ".", "PlanValue", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "sqltypes", ".", "PlanValue", "{", "Value", ":", "n", "}", ",", "nil", "\n", "case", "StrVal", ":", "return", "sqltypes", ".", "PlanValue", "{", "Value", ":", "sqltypes", ".", "MakeTrusted", "(", "sqltypes", ".", "VarBinary", ",", "node", ".", "Val", ")", "}", ",", "nil", "\n", "case", "HexVal", ":", "v", ",", "err", ":=", "node", ".", "HexDecode", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "sqltypes", ".", "PlanValue", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "sqltypes", ".", "PlanValue", "{", "Value", ":", "sqltypes", ".", "MakeTrusted", "(", "sqltypes", ".", "VarBinary", ",", "v", ")", "}", ",", "nil", "\n", "}", "\n", "case", "ListArg", ":", "return", "sqltypes", ".", "PlanValue", "{", "ListKey", ":", "string", "(", "node", "[", "2", ":", "]", ")", "}", ",", "nil", "\n", "case", "ValTuple", ":", "pv", ":=", "sqltypes", ".", "PlanValue", "{", "Values", ":", "make", "(", "[", "]", "sqltypes", ".", "PlanValue", ",", "0", ",", "len", "(", "node", ")", ")", ",", "}", "\n", "for", "_", ",", "val", ":=", "range", "node", "{", "innerpv", ",", "err", ":=", "NewPlanValue", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "sqltypes", ".", "PlanValue", "{", "}", ",", "err", "\n", "}", "\n", "if", "innerpv", ".", "ListKey", "!=", "\"", "\"", "||", "innerpv", ".", "Values", "!=", "nil", "{", "return", "sqltypes", ".", "PlanValue", "{", "}", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "pv", ".", "Values", "=", "append", "(", "pv", ".", "Values", ",", "innerpv", ")", "\n", "}", "\n", "return", "pv", ",", "nil", "\n", "case", "*", "NullVal", ":", "return", "sqltypes", ".", "PlanValue", "{", "}", ",", "nil", "\n", "}", "\n", "return", "sqltypes", ".", "PlanValue", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "String", "(", "<mask>", ")", ")", "\n", "}" ]
19,564
all-19565
[ "SendSystemError", "sends", "an", "error", "frame", "for", "the", "given", "system", "error", "." ]
[ "func", "(", "c", "*", "Connection", ")", "SendSystemError", "(", "id", "uint32", ",", "span", "Span", ",", "err", "error", ")", "error", "{", "frame", ":=", "c", ".", "opts", ".", "FramePool", ".", "Get", "(", ")", "\n\n", "if", "err", ":=", "frame", ".", "write", "(", "&", "errorMessage", "{", "id", ":", "<mask>", ",", "errCode", ":", "GetSystemErrorCode", "(", "err", ")", ",", "tracing", ":", "span", ",", "message", ":", "GetSystemErrorMessage", "(", "err", ")", ",", "}", ")", ";", "err", "!=", "nil", "{", "// This shouldn't happen - it means writing the errorMessage is broken.", "c", ".", "log", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "c", ".", "remotePeerInfo", "}", ",", "LogField", "{", "\"", "\"", ",", "id", "}", ",", "ErrField", "(", "err", ")", ",", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "// When sending errors, we hold the state rlock to ensure that sendCh is not closed", "// as we are sending the frame.", "return", "c", ".", "withStateRLock", "(", "func", "(", ")", "error", "{", "// Errors cannot be sent if the connection has been closed.", "if", "c", ".", "state", "==", "connectionClosed", "{", "c", ".", "log", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "c", ".", "remotePeerInfo", "}", ",", "LogField", "{", "\"", "\"", ",", "id", "}", ",", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ".", "state", ")", "\n", "}", "\n\n", "select", "{", "case", "c", ".", "sendCh", "<-", "frame", ":", "// Good to go", "return", "nil", "\n", "default", ":", "// If the send buffer is full, log and return an error.", "}", "\n", "c", ".", "log", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "c", ".", "remotePeerInfo", "}", ",", "LogField", "{", "\"", "\"", ",", "id", "}", ",", "ErrField", "(", "err", ")", ",", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", ")", "\n", "}" ]
19,565
all-19566
[ "Fix", "coerces", "types", "that", "cannot", "be", "formatted", "by", "messageformat", "to", "string" ]
[ "func", "fix", "(", "v", "interface", "{", "}", ")", "<mask>", "{", "}", "{", "if", "v", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "switch", "reflect", ".", "TypeOf", "(", "v", ")", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Bool", ":", "case", "reflect", ".", "Int", ":", "case", "reflect", ".", "Int8", ":", "case", "reflect", ".", "Int16", ":", "case", "reflect", ".", "Int32", ":", "case", "reflect", ".", "Int64", ":", "case", "reflect", ".", "Uint", ":", "case", "reflect", ".", "Uint8", ":", "case", "reflect", ".", "Uint16", ":", "case", "reflect", ".", "Uint32", ":", "case", "reflect", ".", "Uint64", ":", "case", "reflect", ".", "Uintptr", ":", "case", "reflect", ".", "Float32", ":", "case", "reflect", ".", "Float64", ":", "return", "v", "\n", "case", "reflect", ".", "Ptr", ":", "// dereference and fix", "return", "fix", "(", "reflect", ".", "ValueOf", "(", "v", ")", ".", "Elem", "(", ")", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ")", "\n", "}" ]
19,566
all-19567
[ "UpsertObject", "inserts", "or", "replaces", "a", "new", "row", "with", "the", "given", "column", "values", "to", "the", "given", "table", "using", "columns", "order", ".", "For", "example", ":", "UpsertObject", "(", "tx", "cars", "[]", "string", "{", "id", "brand", "}", "[]", "interface", "{}", "{", "1", "ferrari", "}", ")", "The", "number", "of", "elements", "in", "columns", "must", "match", "the", "one", "in", "values", "." ]
[ "func", "UpsertObject", "(", "tx", "*", "sql", ".", "Tx", ",", "table", "string", ",", "columns", "[", "]", "string", ",", "values", "[", "]", "interface", "{", "}", ")", "(", "int64", ",", "error", ")", "{", "n", ":=", "len", "(", "columns", ")", "\n", "if", "n", "==", "0", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "n", "!=", "len", "(", "values", ")", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "stmt", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "table", ",", "strings", ".", "Join", "(", "columns", ",", "\"", "\"", ")", ",", "Params", "(", "n", ")", ")", "\n", "<mask>", ",", "err", ":=", "tx", ".", "Exec", "(", "stmt", ",", "values", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "err", "\n", "}", "\n", "id", ",", "err", ":=", "result", ".", "LastInsertId", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "err", "\n", "}", "\n", "return", "id", ",", "nil", "\n", "}" ]
19,567
all-19568
[ "Parse", "a", "Java", "resource", "special", "-", "name", "." ]
[ "func", "(", "st", "*", "state", ")", "javaResource", "(", ")", "AST", "{", "off", ":=", "st", ".", "off", "\n", "ln", ":=", "st", ".", "number", "(", ")", "\n", "if", "ln", "<=", "1", "{", "st", ".", "failEarlier", "(", "\"", "\"", ",", "st", ".", "off", "-", "off", ")", "\n", "}", "\n", "if", "len", "(", "st", ".", "str", ")", "==", "0", "||", "st", ".", "str", "[", "0", "]", "!=", "'_'", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "st", ".", "advance", "(", "1", ")", "\n", "ln", "--", "\n", "if", "len", "(", "st", ".", "str", ")", "<", "ln", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n", "str", ":=", "st", ".", "str", "[", ":", "ln", "]", "\n", "final", ":=", "\"", "\"", "\n", "st", ".", "advance", "(", "ln", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "str", ")", ";", "i", "++", "{", "if", "str", "[", "i", "]", "!=", "'$'", "{", "final", "+=", "string", "(", "str", "[", "i", "]", ")", "\n", "}", "else", "{", "if", "len", "(", "str", ")", "<=", "i", "+", "1", "{", "st", ".", "failEarlier", "(", "\"", "\"", ",", "1", ")", "\n", "}", "\n", "i", "++", "\n", "r", ",", "ok", ":=", "map", "[", "byte", "]", "string", "{", "'S'", ":", "\"", "\"", ",", "'_'", ":", "\"", "\"", ",", "'$'", ":", "\"", "\"", ",", "}", "[", "str", "[", "i", "]", "]", "\n", "if", "!", "ok", "{", "st", ".", "failEarlier", "(", "\"", "\"", ",", "ln", "-", "i", "-", "1", ")", "\n", "}", "\n", "final", "+=", "r", "\n", "}", "\n", "}", "\n", "return", "&", "Special", "{", "Prefix", ":", "\"", "\"", ",", "Val", ":", "&", "Name", "{", "Name", ":", "<mask>", "}", "}", "\n", "}" ]
19,568
all-19569
[ "re", "-", "implementation", "of", "private", "function", "in", "https", ":", "//", "github", ".", "com", "/", "golang", "/", "go", "/", "blob", "/", "master", "/", "src", "/", "syscall", "/", "syscall_windows", ".", "go#L945" ]
[ "func", "getProcessEntry", "(", "pid", "int", ")", "(", "pe", "*", "syscall", ".", "ProcessEntry32", ",", "err", "error", ")", "{", "snapshot", ",", "err", ":=", "syscall", ".", "CreateToolhelp32Snapshot", "(", "syscall", ".", "TH32CS_SNAPPROCESS", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "syscall", ".", "CloseHandle", "(", "syscall", ".", "Handle", "(", "snapshot", ")", ")", "\n\n", "<mask>", "processEntry", "syscall", ".", "ProcessEntry32", "\n", "processEntry", ".", "Size", "=", "uint32", "(", "unsafe", ".", "Sizeof", "(", "processEntry", ")", ")", "\n", "err", "=", "syscall", ".", "Process32First", "(", "snapshot", ",", "&", "processEntry", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "{", "if", "processEntry", ".", "ProcessID", "==", "uint32", "(", "pid", ")", "{", "pe", "=", "&", "processEntry", "\n", "return", "\n", "}", "\n\n", "err", "=", "syscall", ".", "Process32Next", "(", "snapshot", ",", "&", "processEntry", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "}" ]
19,569
all-19570
[ "Bytes", "returns", "the", "mail", "data" ]
[ "func", "(", "m", "*", "Message", ")", "Bytes", "(", ")", "[", "]", "byte", "{", "buf", ":=", "bytes", ".", "NewBuffer", "(", "nil", ")", "\n\n", "buf", ".", "WriteString", "(", "\"", "\"", "+", "m", ".", "From", ".", "String", "(", ")", "+", "\"", "\\r", "\\n", "\"", ")", "\n\n", "t", ":=", "time", ".", "Now", "(", ")", "\n", "buf", ".", "WriteString", "(", "\"", "\"", "+", "t", ".", "Format", "(", "time", ".", "RFC1123Z", ")", "+", "\"", "\\r", "\\n", "\"", ")", "\n\n", "buf", ".", "WriteString", "(", "\"", "\"", "+", "strings", ".", "Join", "(", "m", ".", "To", ",", "\"", "\"", ")", "+", "\"", "\\r", "\\n", "\"", ")", "\n", "if", "len", "(", "m", ".", "Cc", ")", ">", "0", "{", "buf", ".", "WriteString", "(", "\"", "\"", "+", "strings", ".", "Join", "(", "m", ".", "Cc", ",", "\"", "\"", ")", "+", "\"", "\\r", "\\n", "\"", ")", "\n", "}", "\n\n", "//fix Encode", "var", "coder", "=", "base64", ".", "StdEncoding", "\n", "var", "subject", "=", "\"", "\"", "+", "coder", ".", "EncodeToString", "(", "[", "]", "byte", "(", "m", ".", "Subject", ")", ")", "+", "\"", "\"", "\n", "buf", ".", "WriteString", "(", "\"", "\"", "+", "subject", "+", "\"", "\\r", "\\n", "\"", ")", "\n\n", "if", "len", "(", "m", ".", "ReplyTo", ")", ">", "0", "{", "buf", ".", "WriteString", "(", "\"", "\"", "+", "m", ".", "ReplyTo", "+", "\"", "\\r", "\\n", "\"", ")", "\n", "}", "\n\n", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", ")", "\n\n", "// Add custom headers", "if", "len", "(", "m", ".", "Headers", ")", ">", "0", "{", "for", "_", ",", "header", ":=", "range", "m", ".", "Headers", "{", "buf", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\\r", "\\n", "\"", ",", "<mask>", ".", "Key", ",", "header", ".", "Value", ")", ")", "\n", "}", "\n", "}", "\n\n", "boundary", ":=", "\"", "\"", "\n\n", "if", "len", "(", "m", ".", "Attachments", ")", ">", "0", "{", "buf", ".", "WriteString", "(", "\"", "\"", "+", "boundary", "+", "\"", "\\r", "\\n", "\"", ")", "\n", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", "+", "boundary", "+", "\"", "\\r", "\\n", "\"", ")", "\n", "}", "\n\n", "buf", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\\r", "\\n", "\\r", "\\n", "\"", ",", "m", ".", "BodyContentType", ")", ")", "\n", "buf", ".", "WriteString", "(", "m", ".", "Body", ")", "\n", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", ")", "\n\n", "if", "len", "(", "m", ".", "Attachments", ")", ">", "0", "{", "for", "_", ",", "attachment", ":=", "range", "m", ".", "Attachments", "{", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\\r", "\\n", "\"", "+", "boundary", "+", "\"", "\\r", "\\n", "\"", ")", "\n\n", "if", "attachment", ".", "Inline", "{", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", ")", "\n", "buf", ".", "WriteString", "(", "\"", "\\\"", "\"", "+", "attachment", ".", "Filename", "+", "\"", "\\\"", "\\r", "\\n", "\\r", "\\n", "\"", ")", "\n\n", "buf", ".", "Write", "(", "attachment", ".", "Data", ")", "\n", "}", "else", "{", "ext", ":=", "filepath", ".", "Ext", "(", "attachment", ".", "Filename", ")", "\n", "mimetype", ":=", "mime", ".", "TypeByExtension", "(", "ext", ")", "\n", "if", "mimetype", "!=", "\"", "\"", "{", "mime", ":=", "fmt", ".", "Sprintf", "(", "\"", "\\r", "\\n", "\"", ",", "mimetype", ")", "\n", "buf", ".", "WriteString", "(", "mime", ")", "\n", "}", "else", "{", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", ")", "\n", "}", "\n", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", ")", "\n\n", "buf", ".", "WriteString", "(", "\"", "\\\"", "\"", ")", "\n", "buf", ".", "WriteString", "(", "coder", ".", "EncodeToString", "(", "[", "]", "byte", "(", "attachment", ".", "Filename", ")", ")", ")", "\n", "buf", ".", "WriteString", "(", "\"", "\\\"", "\\r", "\\n", "\\r", "\\n", "\"", ")", "\n\n", "b", ":=", "make", "(", "[", "]", "byte", ",", "base64", ".", "StdEncoding", ".", "EncodedLen", "(", "len", "(", "attachment", ".", "Data", ")", ")", ")", "\n", "base64", ".", "StdEncoding", ".", "Encode", "(", "b", ",", "attachment", ".", "Data", ")", "\n\n", "// write base64 content in lines of up to 76 chars", "for", "i", ",", "l", ":=", "0", ",", "len", "(", "b", ")", ";", "i", "<", "l", ";", "i", "++", "{", "buf", ".", "WriteByte", "(", "b", "[", "i", "]", ")", "\n", "if", "(", "i", "+", "1", ")", "%", "76", "==", "0", "{", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "buf", ".", "WriteString", "(", "\"", "\\r", "\\n", "\"", "+", "boundary", ")", "\n", "}", "\n\n", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "buf", ".", "Bytes", "(", ")", "\n", "}" ]
19,570
all-19571
[ "NewDiscovery", "returns", "a", "new", "file", "discovery", "for", "the", "given", "paths", "." ]
[ "func", "NewDiscovery", "(", "conf", "*", "SDConfig", ",", "logger", "log", ".", "Logger", ")", "*", "Discovery", "{", "if", "logger", "==", "nil", "{", "logger", "=", "<mask>", ".", "NewNopLogger", "(", ")", "\n", "}", "\n\n", "disc", ":=", "&", "Discovery", "{", "paths", ":", "conf", ".", "Files", ",", "interval", ":", "time", ".", "Duration", "(", "conf", ".", "RefreshInterval", ")", ",", "timestamps", ":", "make", "(", "map", "[", "string", "]", "float64", ")", ",", "logger", ":", "logger", ",", "}", "\n", "fileSDTimeStamp", ".", "addDiscoverer", "(", "disc", ")", "\n", "return", "disc", "\n", "}" ]
19,571
all-19572
[ "NewLinkedList", "instantiates", "a", "new", "LinkedList", "with", "the", "entries", "provided", "." ]
[ "func", "NewLinkedList", "(", "entries", "...", "interface", "{", "}", ")", "*", "LinkedList", "{", "list", ":=", "&", "LinkedList", "{", "}", "\n\n", "for", "_", ",", "entry", ":=", "<mask>", "entries", "{", "list", ".", "AddBack", "(", "entry", ")", "\n", "}", "\n\n", "return", "list", "\n", "}" ]
19,572
all-19573
[ "CheckRules", "validates", "rule", "files", "." ]
[ "func", "CheckRules", "(", "files", "...", "string", ")", "int", "{", "failed", ":=", "<mask>", "\n\n", "for", "_", ",", "f", ":=", "range", "files", "{", "if", "n", ",", "errs", ":=", "checkRules", "(", "f", ")", ";", "errs", "!=", "nil", "{", "fmt", ".", "Fprintln", "(", "os", ".", "Stderr", ",", "\"", "\"", ")", "\n", "for", "_", ",", "e", ":=", "range", "errs", "{", "fmt", ".", "Fprintln", "(", "os", ".", "Stderr", ",", "e", ".", "Error", "(", ")", ")", "\n", "}", "\n", "failed", "=", "true", "\n", "}", "else", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "n", ")", "\n", "}", "\n", "fmt", ".", "Println", "(", ")", "\n", "}", "\n", "if", "failed", "{", "return", "1", "\n", "}", "\n", "return", "0", "\n", "}" ]
19,573
all-19574
[ "DirCopy", "copies", "a", "directory", "recursively", "overwriting", "the", "target", "if", "it", "exists", "." ]
[ "func", "DirCopy", "(", "source", "string", ",", "dest", "string", ")", "error", "{", "// Get info about source.", "info", ",", "err", ":=", "os", ".", "Stat", "(", "source", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "!", "info", ".", "IsDir", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Remove dest if it already exists.", "if", "PathExists", "(", "dest", ")", "{", "err", ":=", "os", ".", "RemoveAll", "(", "dest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "dest", ")", "\n", "}", "\n", "}", "\n\n", "// Create dest.", "err", "=", "os", ".", "MkdirAll", "(", "dest", ",", "info", ".", "Mode", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "dest", ")", "\n", "}", "\n\n", "// Copy all files.", "entries", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "source", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "source", ")", "\n", "}", "\n\n", "for", "_", ",", "entry", ":=", "range", "entries", "{", "sourcePath", ":=", "filepath", ".", "Join", "(", "source", ",", "entry", ".", "Name", "(", ")", ")", "\n", "destPath", ":=", "filepath", ".", "Join", "(", "dest", ",", "entry", ".", "Name", "(", ")", ")", "\n\n", "if", "entry", ".", "IsDir", "(", ")", "{", "err", ":=", "DirCopy", "(", "sourcePath", ",", "destPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "sourcePath", ",", "destPath", ")", "\n", "}", "\n", "}", "else", "{", "err", ":=", "FileCopy", "(", "sourcePath", ",", "destPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "sourcePath", ",", "destPath", ")", "\n", "}", "\n", "}", "\n\n", "}", "\n\n", "return", "nil", "\n", "}" ]
19,574
all-19575
[ "ValidEnum", "validates", "a", "proposed", "value", "for", "this", "enum", ".", "Implements", "the", "Enum", "interface", "for", "ManageOfferResultCode" ]
[ "func", "(", "e", "ManageOfferResultCode", ")", "ValidEnum", "(", "v", "int32", ")", "bool", "{", "_", ",", "ok", ":=", "manageOfferResultCodeMap", "[", "v", "]", "\n", "return", "<mask>", "\n", "}" ]
19,575
all-19576
[ "GetIssueLabels", "gets", "labels", "on", "an", "issue" ]
[ "func", "(", "f", "*", "FakeClient", ")", "GetIssueLabels", "(", "owner", ",", "repo", "string", ",", "<mask>", "int", ")", "(", "[", "]", "github", ".", "Label", ",", "error", ")", "{", "re", ":=", "regexp", ".", "MustCompile", "(", "fmt", ".", "Sprintf", "(", "`^%s/%s#%d:(.*)$`", ",", "owner", ",", "repo", ",", "number", ")", ")", "\n", "la", ":=", "[", "]", "github", ".", "Label", "{", "}", "\n", "allLabels", ":=", "sets", ".", "NewString", "(", "f", ".", "IssueLabelsExisting", "...", ")", "\n", "allLabels", ".", "Insert", "(", "f", ".", "IssueLabelsAdded", "...", ")", "\n", "allLabels", ".", "Delete", "(", "f", ".", "IssueLabelsRemoved", "...", ")", "\n", "for", "_", ",", "l", ":=", "range", "allLabels", ".", "List", "(", ")", "{", "groups", ":=", "re", ".", "FindStringSubmatch", "(", "l", ")", "\n", "if", "groups", "!=", "nil", "{", "la", "=", "append", "(", "la", ",", "github", ".", "Label", "{", "Name", ":", "groups", "[", "1", "]", "}", ")", "\n", "}", "\n", "}", "\n", "return", "la", ",", "nil", "\n", "}" ]
19,576
all-19577
[ "NewClient", "creates", "a", "new", "client" ]
[ "func", "NewClient", "(", "<mask>", "string", ")", "*", "Client", "{", "return", "&", "Client", "{", "URL", ":", "url", ",", "Connection", ":", "&", "http", ".", "Client", "{", "}", ",", "Headers", ":", "make", "(", "map", "[", "string", "]", "string", ")", ",", "subscribed", ":", "make", "(", "map", "[", "chan", "*", "Event", "]", "chan", "bool", ")", ",", "}", "\n", "}" ]
19,577
all-19578
[ "init", "inits", "world", "with", "a", "random", "state", "." ]
[ "func", "(", "w", "*", "World", ")", "init", "(", "maxLiveCells", "int", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "maxLiveCells", ";", "i", "++", "{", "x", ":=", "rand", ".", "Intn", "(", "w", ".", "width", ")", "\n", "y", ":=", "rand", ".", "Intn", "(", "w", ".", "height", ")", "\n", "w", ".", "area", "[", "y", "*", "w", ".", "width", "+", "x", "]", "=", "<mask>", "\n", "}", "\n", "}" ]
19,578
all-19579
[ "CommitAt", "commits", "the", "transaction", "following", "the", "same", "logic", "as", "Commit", "()", "but", "at", "the", "given", "commit", "timestamp", ".", "This", "will", "panic", "if", "not", "used", "with", "managed", "transactions", ".", "This", "is", "only", "useful", "for", "databases", "built", "on", "top", "of", "Badger", "(", "like", "Dgraph", ")", "and", "can", "be", "ignored", "by", "most", "users", "." ]
[ "func", "(", "txn", "*", "Txn", ")", "CommitAt", "(", "commitTs", "uint64", ",", "callback", "func", "(", "error", ")", ")", "error", "{", "if", "!", "txn", ".", "db", ".", "opt", ".", "managedTxns", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "txn", ".", "commitTs", "=", "commitTs", "\n", "if", "callback", "==", "nil", "{", "return", "txn", ".", "Commit", "(", ")", "\n", "}", "\n", "txn", ".", "CommitWith", "(", "<mask>", ")", "\n", "return", "nil", "\n", "}" ]
19,579
all-19580
[ "SetFromResource", "()", "is", "a", "wrapper", "around", "gtk_image_set_from_resource", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetFromResource", "(", "resourcePath", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "resourcePath", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_image_set_from_resource", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
19,580
all-19581
[ "NewSniffer", "creates", "a", "new", "sniffer", "instance", ".", "The", "conn", "parameter", "is", "the", "net", ".", "Conn", "connection", "where", "the", "Sniffer", "is", "listening", "for", "hdb", "protocol", "calls", ".", "The", "dbAddr", "is", "the", "hdb", "host", "port", "address", "in", "host", ":", "port", "format", "." ]
[ "func", "NewSniffer", "(", "conn", "net", ".", "Conn", ",", "dbAddr", "string", ")", "(", "*", "Sniffer", ",", "error", ")", "{", "s", ":=", "&", "Sniffer", "{", "conn", ":", "conn", ",", "dbAddr", ":", "dbAddr", ",", "clRd", ":", "bufio", ".", "NewReader", "(", "<mask>", ")", ",", "clWr", ":", "bufio", ".", "NewWriter", "(", "conn", ")", ",", "mh", ":", "&", "messageHeader", "{", "}", ",", "sh", ":", "&", "segmentHeader", "{", "}", ",", "ph", ":", "&", "partHeader", "{", "}", ",", "buf", ":", "make", "(", "[", "]", "byte", ",", "0", ")", ",", "}", "\n\n", "dbConn", ",", "err", ":=", "net", ".", "Dial", "(", "\"", "\"", ",", "s", ".", "dbAddr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "s", ".", "dbRd", "=", "bufio", ".", "NewReader", "(", "dbConn", ")", "\n", "s", ".", "dbWr", "=", "bufio", ".", "NewWriter", "(", "dbConn", ")", "\n", "s", ".", "dbConn", "=", "dbConn", "\n", "return", "s", ",", "nil", "\n", "}" ]
19,581
all-19582
[ "GetPaletteFlipOk", "returns", "a", "tuple", "with", "the", "PaletteFlip", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefStyle", ")", "GetPaletteFlipOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "PaletteFlip", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "t", ".", "PaletteFlip", ",", "<mask>", "\n", "}" ]
19,582
all-19583
[ "SetPopup", "is", "a", "wrapper", "around", "gtk_menu_button_set_popup", "()", "." ]
[ "func", "(", "v", "*", "MenuButton", ")", "SetPopup", "(", "menu", "IMenu", ")", "{", "C", ".", "gtk_menu_button_set_popup", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ")", "\n", "}" ]
19,583
all-19584
[ "Flip", "is", "a", "wrapper", "around", "gdk_pixbuf_flip", "()", "." ]
[ "func", "(", "v", "*", "Pixbuf", ")", "Flip", "(", "horizontal", "bool", ")", "(", "*", "Pixbuf", ",", "error", ")", "{", "c", ":=", "C", ".", "gdk_pixbuf_flip", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "horizontal", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "obj", ":=", "&", "glib", ".", "Object", "{", "glib", ".", "ToGObject", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", "\n", "p", ":=", "&", "Pixbuf", "{", "obj", "}", "\n", "//obj.Ref()", "runtime", ".", "SetFinalizer", "(", "p", ",", "func", "(", "_", "<mask>", "{", "}", ")", "{", "obj", ".", "Unref", "(", ")", "}", ")", "\n", "return", "p", ",", "nil", "\n", "}" ]
19,584
all-19585
[ "Users", "returns", "a", "slice", "of", "all", "users", "." ]
[ "func", "(", "m", "MongoDb", ")", "Users", "(", "filter", "interface", "{", "}", ")", "(", "us", "[", "]", "<mask>", ".", "User", ",", "e", "error", ")", "{", "c", ":=", "m", ".", "Connect", "(", "models", ".", "COLL_NAME_USER", ")", "\n", "defer", "m", ".", "Close", "(", "c", ")", "\n\n", "err", ":=", "c", ".", "Find", "(", "filter", ")", ".", "All", "(", "&", "us", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Get", "(", ")", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "return", "us", ",", "mkmgoerror", "(", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "us", ",", "nil", "\n", "}" ]
19,585
all-19586
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetMatchedStylesForNodeParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss42", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
19,586
all-19587
[ "decodeName", "decodes", "a", "non", "-", "unicode", "filename", "from", "a", "file", "header", "." ]
[ "func", "decodeName", "(", "buf", "[", "]", "byte", ")", "string", "{", "i", ":=", "bytes", ".", "IndexByte", "(", "buf", ",", "0", ")", "\n", "if", "i", "<", "0", "{", "return", "string", "(", "buf", ")", "// filename is UTF-8", "\n", "}", "\n\n", "name", ":=", "buf", "[", ":", "i", "]", "\n", "encName", ":=", "readBuf", "(", "buf", "[", "i", "+", "1", ":", "]", ")", "\n", "if", "len", "(", "encName", ")", "<", "2", "{", "return", "\"", "\"", "// invalid encoding", "\n", "}", "\n", "highByte", ":=", "uint16", "(", "encName", ".", "byte", "(", ")", ")", "<<", "8", "\n", "flags", ":=", "encName", ".", "byte", "(", ")", "\n", "flagBits", ":=", "8", "\n", "var", "wchars", "[", "]", "uint16", "// decoded characters are UTF-16", "\n", "for", "len", "(", "wchars", ")", "<", "len", "(", "name", ")", "&&", "len", "(", "encName", ")", ">", "0", "{", "if", "flagBits", "==", "0", "{", "flags", "=", "encName", ".", "byte", "(", ")", "\n", "flagBits", "=", "8", "\n", "if", "len", "(", "encName", ")", "==", "0", "{", "break", "\n", "}", "\n", "}", "\n", "switch", "flags", ">>", "6", "{", "case", "0", ":", "wchars", "=", "append", "(", "wchars", ",", "uint16", "(", "encName", ".", "byte", "(", ")", ")", ")", "\n", "case", "1", ":", "wchars", "=", "append", "(", "wchars", ",", "uint16", "(", "encName", ".", "byte", "(", ")", ")", "|", "highByte", ")", "\n", "case", "2", ":", "if", "len", "(", "encName", ")", "<", "2", "{", "break", "\n", "}", "\n", "wchars", "=", "append", "(", "wchars", ",", "encName", ".", "uint16", "(", ")", ")", "\n", "case", "3", ":", "n", ":=", "encName", ".", "<mask>", "(", ")", "\n", "b", ":=", "name", "[", "len", "(", "wchars", ")", ":", "]", "\n", "if", "l", ":=", "int", "(", "n", "&", "0x7f", ")", "+", "2", ";", "l", "<", "len", "(", "b", ")", "{", "b", "=", "b", "[", ":", "l", "]", "\n", "}", "\n", "if", "n", "&", "0x80", ">", "0", "{", "if", "len", "(", "encName", ")", "<", "1", "{", "break", "\n", "}", "\n", "ec", ":=", "encName", ".", "byte", "(", ")", "\n", "for", "_", ",", "c", ":=", "range", "b", "{", "wchars", "=", "append", "(", "wchars", ",", "uint16", "(", "c", "+", "ec", ")", "|", "highByte", ")", "\n", "}", "\n", "}", "else", "{", "for", "_", ",", "c", ":=", "range", "b", "{", "wchars", "=", "append", "(", "wchars", ",", "uint16", "(", "c", ")", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "flags", "<<=", "2", "\n", "flagBits", "-=", "2", "\n", "}", "\n", "return", "string", "(", "utf16", ".", "Decode", "(", "wchars", ")", ")", "\n", "}" ]
19,587
all-19588
[ "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", "(", "c", "*", "Comment", ")", "GetIdOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Id", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "c", ".", "Id", ",", "<mask>", "\n", "}" ]
19,588
all-19589
[ "HasMessage", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "HasMessage", "(", ")", "bool", "{", "if", "d", "!=", "nil", "&&", "d", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
19,589
all-19590
[ "searchIndex", "returns", "the", "last", "array", "index", "of", "names", "whose", "raft", "index", "section", "is", "equal", "to", "or", "smaller", "than", "the", "given", "index", ".", "The", "given", "names", "MUST", "be", "sorted", "." ]
[ "func", "searchIndex", "(", "lg", "*", "zap", ".", "Logger", ",", "names", "[", "]", "string", ",", "index", "uint64", ")", "(", "int", ",", "bool", ")", "{", "for", "i", ":=", "len", "(", "names", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "name", ":=", "names", "[", "i", "]", "\n", "_", ",", "curIndex", ",", "err", ":=", "parseWALName", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "<mask>", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "index", ">=", "curIndex", "{", "return", "i", ",", "true", "\n", "}", "\n", "}", "\n", "return", "-", "1", ",", "false", "\n", "}" ]
19,590
all-19591
[ "CancelableDownload", "performs", "an", "http", "request", "and", "allows", "for", "it", "to", "be", "canceled", "at", "any", "time" ]
[ "func", "CancelableDownload", "(", "c", "*", "Canceler", ",", "client", "*", "http", ".", "Client", ",", "req", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "Response", ",", "chan", "bool", ",", "error", ")", "{", "chDone", ":=", "make", "(", "chan", "bool", ")", "\n", "chCancel", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "if", "c", "!=", "nil", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "c", ".", "reqChCancel", "[", "req", "]", "=", "chCancel", "\n", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "}", "\n", "req", ".", "Cancel", "=", "chCancel", "\n\n", "<mask>", "func", "(", ")", "{", "<-", "chDone", "\n", "if", "c", "!=", "nil", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "delete", "(", "c", ".", "reqChCancel", ",", "req", ")", "\n", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "resp", ",", "err", ":=", "client", ".", "Do", "(", "req", ")", "\n", "return", "resp", ",", "chDone", ",", "err", "\n", "}" ]
19,591
all-19592
[ "CopyFile", "copies", "the", "entire", "database", "to", "file", "at", "the", "given", "path", ".", "A", "reader", "transaction", "is", "maintained", "during", "the", "copy", "so", "it", "is", "safe", "to", "continue", "using", "the", "database", "while", "a", "copy", "is", "in", "progress", "." ]
[ "func", "(", "tx", "Tx", ")", "CopyFile", "(", "path", "string", ",", "mode", "os", ".", "FileMode", ")", "error", "{", "return", "errorsp", ".", "WithStacks", "(", "<mask>", ".", "Tx", ".", "CopyFile", "(", "path", ",", "mode", ")", ")", "\n", "}" ]
19,592
all-19593
[ "Release", "unsets", "owner", "for", "target", "resource", "and", "move", "it", "to", "a", "new", "state", ".", "In", ":", "name", "-", "name", "of", "the", "target", "resource", "dest", "-", "destination", "state", "of", "the", "resource", "owner", "-", "owner", "of", "the", "resource", "Out", ":", "nil", "on", "success", "or", "OwnerNotMatch", "error", "if", "owner", "does", "not", "match", "current", "owner", "of", "the", "resource", "or", "ResourceNotFound", "error", "if", "target", "named", "resource", "does", "not", "exist", "." ]
[ "func", "(", "r", "*", "Ranch", ")", "Release", "(", "name", ",", "dest", ",", "owner", "string", ")", "error", "{", "r", ".", "resourcesLock", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "resourcesLock", ".", "Unlock", "(", ")", "\n\n", "res", ",", "err", ":=", "r", ".", "Storage", ".", "GetResource", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "return", "&", "ResourceNotFound", "{", "name", "}", "\n", "}", "\n", "if", "owner", "!=", "res", ".", "Owner", "{", "return", "&", "OwnerNotMatch", "{", "owner", ":", "owner", ",", "request", ":", "res", ".", "Owner", "}", "\n", "}", "\n", "res", ".", "LastUpdate", "=", "r", ".", "UpdateTime", "(", ")", "\n", "res", ".", "Owner", "=", "\"", "\"", "\n", "res", ".", "State", "=", "dest", "\n", "if", "err", ":=", "r", ".", "Storage", ".", "UpdateResource", "(", "res", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "res", ".", "Name", ")", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,593
all-19594
[ "getLabelsFromGenericMatches", "returns", "label", "matches", "with", "extra", "labels", "if", "those", "have", "been", "configured", "in", "the", "plugin", "config", "." ]
[ "func", "getLabelsFromGenericMatches", "(", "matches", "[", "]", "[", "]", "string", ",", "additionalLabels", "[", "]", "string", ")", "[", "]", "string", "{", "if", "len", "(", "additionalLabels", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "var", "labels", "[", "]", "string", "\n", "for", "_", ",", "match", ":=", "range", "matches", "{", "parts", ":=", "strings", ".", "Split", "(", "match", "[", "0", "]", ",", "\"", "\"", ")", "\n", "if", "(", "(", "parts", "[", "0", "]", "!=", "\"", "\"", ")", "&&", "(", "parts", "[", "0", "]", "!=", "\"", "\"", ")", ")", "||", "len", "(", "parts", ")", "!=", "2", "{", "continue", "\n", "}", "\n", "for", "_", ",", "l", ":=", "range", "additionalLabels", "{", "if", "l", "==", "parts", "[", "1", "]", "{", "labels", "=", "append", "(", "labels", ",", "<mask>", "[", "1", "]", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "labels", "\n", "}" ]
19,594
all-19595
[ "MarshalJSON", "is", "used", "to", "serialize", "the", "type", "to", "json", "per", "the", "Marshaller", "interface" ]
[ "func", "(", "b", "Conditional", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "switch", "b", "{", "case", "ExplicitlyEnabled", ":", "return", "json", ".", "Marshal", "(", "true", ")", "\n", "case", "ExplicitlyDisabled", ":", "return", "json", ".", "Marshal", "(", "false", ")", "\n", "default", ":", "return", "json", ".", "Marshal", "(", "nil", ")", "\n", "}", "\n", "}" ]
19,595
all-19596
[ "buildContext", "returns", "the", "context", "for", "building", "the", "source", "." ]
[ "func", "buildContext", "(", "tags", "[", "]", "string", ")", "*", "build", ".", "Context", "{", "return", "&", "build", ".", "Context", "{", "GOARCH", ":", "<mask>", ".", "Default", ".", "GOARCH", ",", "GOOS", ":", "build", ".", "Default", ".", "GOOS", ",", "GOROOT", ":", "build", ".", "Default", ".", "GOROOT", ",", "GOPATH", ":", "build", ".", "Default", ".", "GOPATH", ",", "Compiler", ":", "build", ".", "Default", ".", "Compiler", ",", "BuildTags", ":", "append", "(", "build", ".", "Default", ".", "BuildTags", ",", "tags", "...", ")", ",", "}", "\n", "}" ]
19,596
all-19597
[ "GetNumberUpLayout", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_number_up_layout", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "GetNumberUpLayout", "(", ")", "NumberUpLayout", "{", "c", ":=", "C", ".", "gtk_print_settings_get_number_up_layout", "(", "<mask>", ".", "native", "(", ")", ")", "\n", "return", "NumberUpLayout", "(", "c", ")", "\n", "}" ]
19,597
all-19598
[ "Create", "performs", "resource", "creation" ]
[ "func", "(", "vol", "*", "VolumeResource", ")", "Create", "(", ")", "error", "{", "seelog", ".", "Debugf", "(", "\"", "\"", ",", "vol", ".", "VolumeConfig", ".", "DockerVolumeName", ",", "vol", ".", "VolumeConfig", ".", "Driver", ")", "\n", "volumeResponse", ":=", "vol", ".", "client", ".", "CreateVolume", "(", "vol", ".", "ctx", ",", "vol", ".", "VolumeConfig", ".", "DockerVolumeName", ",", "vol", ".", "VolumeConfig", ".", "Driver", ",", "vol", ".", "VolumeConfig", ".", "DriverOpts", ",", "vol", ".", "VolumeConfig", ".", "Labels", ",", "dockerclient", ".", "CreateVolumeTimeout", ")", "\n\n", "if", "volumeResponse", ".", "<mask>", "!=", "nil", "{", "return", "volumeResponse", ".", "Error", "\n", "}", "\n\n", "// set readonly field after creation", "vol", ".", "setMountPoint", "(", "volumeResponse", ".", "DockerVolume", ".", "Name", ")", "\n", "return", "nil", "\n", "}" ]
19,598
all-19599
[ "Returns", "the", "country", "code", "and", "region", "code", "for", "an", "IP", "address", ".", "Requires", "the", "GeoIP", "Region", "database", "." ]
[ "func", "(", "gi", "*", "GeoIP", ")", "GetRegion", "(", "ip", "string", ")", "(", "string", ",", "string", ")", "{", "if", "gi", ".", "db", "==", "nil", "{", "return", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n\n", "cip", ":=", "C", ".", "CString", "(", "ip", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cip", ")", ")", "\n\n", "gi", ".", "mu", ".", "Lock", "(", ")", "\n", "region", ":=", "C", ".", "GeoIP_region_by_addr", "(", "gi", ".", "db", ",", "cip", ")", "\n", "gi", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "\"", "\"", "\n", "}", "\n\n", "countryCode", ":=", "C", ".", "GoString", "(", "&", "region", ".", "country_code", "[", "0", "]", ")", "\n", "regionCode", ":=", "C", ".", "GoString", "(", "&", "region", ".", "region", "[", "0", "]", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "region", ")", ")", "\n\n", "return", "countryCode", ",", "regionCode", "\n", "}" ]
19,599
all-19600
[ "GetResourceContent", "returns", "content", "of", "the", "given", "resource", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Page#method", "-", "getResourceContent", "parameters", ":", "frameID", "-", "Frame", "id", "to", "get", "resource", "for", ".", "url", "-", "URL", "of", "the", "resource", "to", "get", "content", "for", "." ]
[ "func", "GetResourceContent", "(", "frameID", "cdp", ".", "FrameID", ",", "<mask>", "string", ")", "*", "GetResourceContentParams", "{", "return", "&", "GetResourceContentParams", "{", "FrameID", ":", "frameID", ",", "URL", ":", "url", ",", "}", "\n", "}" ]