id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
12,400
all-12401
[ "commit", "loop", "triggered", "by", "the", "mainLoop" ]
[ "func", "(", "c", "*", "Consumer", ")", "cmLoop", "(", "stopped", "<-", "chan", "none", ")", "{", "ticker", ":=", "time", ".", "NewTicker", "(", "c", ".", "client", ".", "config", ".", "Consumer", ".", "Offsets", ".", "CommitInterval", ")", "\n", "defer", "ticker", ".", "Stop", "(", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "ticker", ".", "C", ":", "if", "err", ":=", "c", ".", "commitOffsetsWithRetry", "(", "c", ".", "<mask>", ".", "config", ".", "Group", ".", "Offsets", ".", "Retry", ".", "Max", ")", ";", "err", "!=", "nil", "{", "c", ".", "handleError", "(", "&", "Error", "{", "Ctx", ":", "\"", "\"", ",", "error", ":", "err", "}", ")", "\n", "return", "\n", "}", "\n", "case", "<-", "stopped", ":", "return", "\n", "case", "<-", "c", ".", "dying", ":", "return", "\n", "}", "\n", "}", "\n", "}" ]
12,401
all-12402
[ "startStreamWriter", "creates", "a", "streamWrite", "and", "starts", "a", "long", "running", "go", "-", "routine", "that", "accepts", "messages", "and", "writes", "to", "the", "attached", "outgoing", "connection", "." ]
[ "func", "startStreamWriter", "(", "lg", "*", "zap", ".", "Logger", ",", "local", ",", "<mask>", "types", ".", "ID", ",", "status", "*", "peerStatus", ",", "fs", "*", "stats", ".", "FollowerStats", ",", "r", "Raft", ")", "*", "streamWriter", "{", "w", ":=", "&", "streamWriter", "{", "lg", ":", "lg", ",", "localID", ":", "local", ",", "peerID", ":", "id", ",", "status", ":", "status", ",", "fs", ":", "fs", ",", "r", ":", "r", ",", "msgc", ":", "make", "(", "chan", "raftpb", ".", "Message", ",", "streamBufSize", ")", ",", "connc", ":", "make", "(", "chan", "*", "outgoingConn", ")", ",", "stopc", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "done", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n", "go", "w", ".", "run", "(", ")", "\n", "return", "w", "\n", "}" ]
12,402
all-12403
[ "SetWriteDeadline", "indicates", "an", "expected", "call", "of", "SetWriteDeadline" ]
[ "func", "(", "mr", "*", "MockWebsocketConnMockRecorder", ")", "SetWriteDeadline", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockWebsocketConn", ")", "(", "nil", ")", ".", "SetWriteDeadline", ")", ",", "arg0", ")", "\n", "}" ]
12,403
all-12404
[ "resourceVSphereComputeClusterApplyFolderChange", "applies", "any", "changes", "to", "a", "ClusterComputeResource", "s", "folder", "location", "." ]
[ "func", "resourceVSphereComputeClusterApplyFolderChange", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "interface", "{", "}", ",", "cluster", "*", "object", ".", "ClusterComputeResource", ",", ")", "(", "*", "object", ".", "ClusterComputeResource", ",", "error", ")", "{", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereComputeClusterIDString", "(", "d", ")", ",", "cluster", ".", "InventoryPath", ",", ")", "\n\n", "var", "changed", "bool", "\n", "var", "err", "error", "\n\n", "if", "d", ".", "HasChange", "(", "\"", "\"", ")", "{", "f", ":=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "\n", "client", ":=", "meta", ".", "(", "*", "VSphereClient", ")", ".", "vimClient", "\n", "if", "err", "=", "clustercomputeresource", ".", "MoveToFolder", "(", "client", ",", "cluster", ",", "f", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "f", ",", "err", ")", "\n", "}", "\n", "changed", "=", "true", "\n", "}", "\n\n", "if", "changed", "{", "// Update the cluster so that we have the new inventory path for logging and", "// other things", "cluster", ",", "err", "=", "resourceVSphereComputeClusterGetCluster", "(", "d", ",", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereComputeClusterIDString", "(", "d", ")", ",", "cluster", ".", "InventoryPath", ",", ")", "\n", "}", "\n\n", "return", "cluster", ",", "nil", "\n", "}" ]
12,404
all-12405
[ "Parse", "splitting", "&", "decoding", "compact", "serialized", "json", "web", "token", "returns", "slice", "of", "byte", "arrays", "each", "representing", "part", "of", "token" ]
[ "func", "Parse", "(", "token", "string", ")", "(", "result", "[", "]", "[", "]", "byte", ",", "e", "error", ")", "{", "parts", ":=", "strings", ".", "Split", "(", "<mask>", ",", "\"", "\"", ")", "\n\n", "result", "=", "make", "(", "[", "]", "[", "]", "byte", ",", "len", "(", "parts", ")", ")", "\n\n", "for", "i", ",", "part", ":=", "range", "parts", "{", "if", "result", "[", "i", "]", ",", "e", "=", "base64url", ".", "Decode", "(", "part", ")", ";", "e", "!=", "nil", "{", "return", "nil", ",", "e", "\n", "}", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
12,405
all-12406
[ "dnsimpleSuitableZone", "returns", "the", "most", "suitable", "zone", "for", "a", "given", "hostname", "and", "a", "set", "of", "zones", "." ]
[ "func", "dnsimpleSuitableZone", "(", "hostname", "string", ",", "zones", "map", "[", "string", "]", "dnsimple", ".", "Zone", ")", "*", "dnsimple", ".", "Zone", "{", "var", "zone", "*", "dnsimple", ".", "Zone", "\n", "for", "_", ",", "z", ":=", "range", "zones", "{", "if", "strings", ".", "HasSuffix", "(", "hostname", ",", "z", ".", "Name", ")", "{", "if", "zone", "==", "nil", "||", "len", "(", "z", ".", "<mask>", ")", ">", "len", "(", "zone", ".", "Name", ")", "{", "newZ", ":=", "z", "\n", "zone", "=", "&", "newZ", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "zone", "\n", "}" ]
12,406
all-12407
[ "EnvelopeFromPart", "uses", "the", "provided", "Part", "tree", "to", "build", "an", "Envelope", "downconverting", "HTML", "to", "plain", "text", "if", "needed", "and", "sorting", "the", "attachments", "inlines", "and", "other", "parts", "into", "their", "respective", "slices", ".", "Errors", "are", "collected", "from", "all", "Parts", "and", "placed", "into", "the", "Envelopes", "Errors", "slice", "." ]
[ "func", "EnvelopeFromPart", "(", "root", "*", "Part", ")", "(", "*", "Envelope", ",", "error", ")", "{", "e", ":=", "&", "Envelope", "{", "Root", ":", "root", ",", "header", ":", "&", "root", ".", "Header", ",", "}", "\n\n", "if", "detectMultipartMessage", "(", "root", ")", "{", "// Multi-part message (message with attachments, etc)", "if", "err", ":=", "parseMultiPartBody", "(", "root", ",", "e", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "if", "detectBinaryBody", "(", "root", ")", "{", "// Attachment only, no text", "if", "root", ".", "Disposition", "==", "cdInline", "{", "e", ".", "Inlines", "=", "append", "(", "e", ".", "Inlines", ",", "root", ")", "\n", "}", "else", "{", "e", ".", "Attachments", "=", "append", "(", "e", ".", "Attachments", ",", "root", ")", "\n", "}", "\n", "}", "else", "{", "// Only text, no attachments", "if", "err", ":=", "parseTextOnlyBody", "(", "root", ",", "e", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Down-convert HTML to text if necessary", "if", "e", ".", "Text", "==", "\"", "\"", "&&", "e", ".", "HTML", "!=", "\"", "\"", "{", "// We always warn when this happens", "e", ".", "Root", ".", "addWarning", "(", "ErrorPlainTextFromHTML", ",", "\"", "\"", ")", "\n", "var", "err", "error", "\n", "if", "e", ".", "Text", ",", "err", "=", "html2text", ".", "FromString", "(", "e", ".", "HTML", ")", ";", "err", "!=", "nil", "{", "// Downcoversion shouldn't fail", "e", ".", "<mask>", "=", "\"", "\"", "\n", "p", ":=", "e", ".", "Root", ".", "BreadthMatchFirst", "(", "matchHTMLBodyPart", ")", "\n", "p", ".", "addError", "(", "ErrorPlainTextFromHTML", ",", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "// Copy part errors into Envelope.", "if", "e", ".", "Root", "!=", "nil", "{", "_", "=", "e", ".", "Root", ".", "DepthMatchAll", "(", "func", "(", "part", "*", "Part", ")", "bool", "{", "// Using DepthMatchAll to traverse all parts, don't care about result.", "for", "i", ":=", "range", "part", ".", "Errors", "{", "// Range index is needed to get the correct address, because range value points to", "// a locally scoped variable.", "e", ".", "Errors", "=", "append", "(", "e", ".", "Errors", ",", "part", ".", "Errors", "[", "i", "]", ")", "\n", "}", "\n", "return", "false", "\n", "}", ")", "\n", "}", "\n\n", "return", "e", ",", "nil", "\n", "}" ]
12,407
all-12408
[ "SetSection", "is", "a", "wrapper", "around", "g_menu_item_set_section", "()", "." ]
[ "func", "(", "v", "*", "MenuItem", ")", "SetSection", "(", "<mask>", "*", "MenuModel", ")", "{", "C", ".", "g_menu_item_set_section", "(", "v", ".", "native", "(", ")", ",", "section", ".", "native", "(", ")", ")", "\n", "}" ]
12,408
all-12409
[ "AllocateIDs", "returns", "a", "range", "of", "n", "integer", "IDs", "with", "the", "given", "kind", "and", "parent", "combination", ".", "kind", "cannot", "be", "empty", ";", "parent", "may", "be", "nil", ".", "The", "IDs", "in", "the", "range", "returned", "will", "not", "be", "used", "by", "the", "datastore", "s", "automatic", "ID", "sequence", "generator", "and", "may", "be", "used", "with", "NewKey", "without", "conflict", ".", "The", "range", "is", "inclusive", "at", "the", "low", "end", "and", "exclusive", "at", "the", "high", "end", ".", "In", "other", "words", "valid", "intIDs", "x", "satisfy", "low", "<", "=", "x", "&&", "x", "<", "high", ".", "If", "no", "error", "is", "returned", "low", "+", "n", "==", "high", "." ]
[ "func", "AllocateIDs", "(", "c", "context", ".", "Context", ",", "kind", "string", ",", "parent", "*", "<mask>", ",", "n", "int", ")", "(", "low", ",", "high", "int64", ",", "err", "error", ")", "{", "if", "kind", "==", "\"", "\"", "{", "return", "0", ",", "0", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "n", "<", "0", "{", "return", "0", ",", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n", "if", "n", "==", "0", "{", "return", "0", ",", "0", ",", "nil", "\n", "}", "\n", "req", ":=", "&", "pb", ".", "AllocateIdsRequest", "{", "ModelKey", ":", "keyToProto", "(", "\"", "\"", ",", "NewIncompleteKey", "(", "c", ",", "kind", ",", "parent", ")", ")", ",", "Size", ":", "proto", ".", "Int64", "(", "int64", "(", "n", ")", ")", ",", "}", "\n", "res", ":=", "&", "pb", ".", "AllocateIdsResponse", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "0", ",", "err", "\n", "}", "\n", "// The protobuf is inclusive at both ends. Idiomatic Go (e.g. slices, for loops)", "// is inclusive at the low end and exclusive at the high end, so we add 1.", "low", "=", "res", ".", "GetStart", "(", ")", "\n", "high", "=", "res", ".", "GetEnd", "(", ")", "+", "1", "\n", "if", "low", "+", "int64", "(", "n", ")", "!=", "high", "{", "return", "0", ",", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n", "return", "low", ",", "high", ",", "nil", "\n", "}" ]
12,409
all-12410
[ "HasMustShowDistribution", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasMustShowDistribution", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "MustShowDistribution", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
12,410
all-12411
[ "MeanStdDevWithMask", "calculates", "mean", "and", "standard", "deviation", "of", "pixel", "values", "with", "mask" ]
[ "func", "MeanStdDevWithMask", "(", "src", ",", "mask", "*", "IplImage", ")", "(", "Scalar", ",", "Scalar", ")", "{", "var", "mean", ",", "stdDev", "Scalar", "\n", "C", ".", "cvAvgSdv", "(", "unsafe", ".", "Pointer", "(", "src", ")", ",", "(", "*", "C", ".", "CvScalar", ")", "(", "&", "mean", ")", ",", "(", "*", "C", ".", "CvScalar", ")", "(", "&", "stdDev", ")", ",", "unsafe", ".", "Pointer", "(", "mask", ")", ",", ")", "\n\n", "return", "<mask>", ",", "stdDev", "\n", "}" ]
12,411
all-12412
[ "Connect", "adds", "a", "new", "outbound", "connection", "to", "the", "peer", "." ]
[ "func", "(", "p", "*", "Peer", ")", "Connect", "(", "ctx", "context", ".", "<mask>", ")", "(", "*", "Connection", ",", "error", ")", "{", "return", "p", ".", "channel", ".", "Connect", "(", "ctx", ",", "p", ".", "hostPort", ")", "\n", "}" ]
12,412
all-12413
[ "Fetches", "latest", "committed", "offsets", "for", "all", "subscriptions" ]
[ "func", "(", "c", "*", "Consumer", ")", "fetchOffsets", "(", "subs", "map", "[", "string", "]", "[", "]", "int32", ")", "(", "map", "[", "string", "]", "map", "[", "int32", "]", "offsetInfo", ",", "error", ")", "{", "offsets", ":=", "make", "(", "map", "[", "string", "]", "map", "[", "int32", "]", "offsetInfo", ",", "len", "(", "subs", ")", ")", "\n", "req", ":=", "&", "sarama", ".", "OffsetFetchRequest", "{", "Version", ":", "1", ",", "ConsumerGroup", ":", "c", ".", "groupID", ",", "}", "\n\n", "for", "topic", ",", "partitions", ":=", "range", "subs", "{", "offsets", "[", "topic", "]", "=", "make", "(", "map", "[", "int32", "]", "offsetInfo", ",", "len", "(", "partitions", ")", ")", "\n", "for", "_", ",", "partition", ":=", "<mask>", "partitions", "{", "offsets", "[", "topic", "]", "[", "partition", "]", "=", "offsetInfo", "{", "Offset", ":", "-", "1", "}", "\n", "req", ".", "AddPartition", "(", "topic", ",", "partition", ")", "\n", "}", "\n", "}", "\n\n", "broker", ",", "err", ":=", "c", ".", "client", ".", "Coordinator", "(", "c", ".", "groupID", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "closeCoordinator", "(", "broker", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "resp", ",", "err", ":=", "broker", ".", "FetchOffset", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "closeCoordinator", "(", "broker", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "topic", ",", "partitions", ":=", "range", "subs", "{", "for", "_", ",", "partition", ":=", "range", "partitions", "{", "block", ":=", "resp", ".", "GetBlock", "(", "topic", ",", "partition", ")", "\n", "if", "block", "==", "nil", "{", "return", "nil", ",", "sarama", ".", "ErrIncompleteResponse", "\n", "}", "\n\n", "if", "block", ".", "Err", "==", "sarama", ".", "ErrNoError", "{", "offsets", "[", "topic", "]", "[", "partition", "]", "=", "offsetInfo", "{", "Offset", ":", "block", ".", "Offset", ",", "Metadata", ":", "block", ".", "Metadata", "}", "\n", "}", "else", "{", "return", "nil", ",", "block", ".", "Err", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "offsets", ",", "nil", "\n", "}" ]
12,413
all-12414
[ "takeAction", "adds", "or", "removes", "the", "needs", "-", "rebase", "label", "based", "on", "the", "current", "state", "of", "the", "PR", "(", "hasLabel", "and", "mergeable", ")", ".", "It", "also", "handles", "adding", "and", "removing", "GitHub", "comments", "notifying", "the", "PR", "author", "that", "a", "rebase", "is", "needed", "." ]
[ "func", "takeAction", "(", "log", "*", "logrus", ".", "Entry", ",", "ghc", "githubClient", ",", "org", ",", "repo", "string", ",", "num", "int", ",", "author", "string", ",", "hasLabel", ",", "mergeable", "bool", ")", "error", "{", "if", "!", "mergeable", "&&", "!", "hasLabel", "{", "if", "err", ":=", "ghc", ".", "AddLabel", "(", "org", ",", "repo", ",", "num", ",", "labels", ".", "NeedsRebase", ")", ";", "err", "!=", "nil", "{", "log", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "labels", ".", "NeedsRebase", ")", "\n", "}", "\n", "msg", ":=", "plugins", ".", "FormatSimpleResponse", "(", "author", ",", "needsRebaseMessage", ")", "\n", "return", "ghc", ".", "CreateComment", "(", "org", ",", "repo", ",", "num", ",", "<mask>", ")", "\n", "}", "else", "if", "mergeable", "&&", "hasLabel", "{", "// remove label and prune comment", "if", "err", ":=", "ghc", ".", "RemoveLabel", "(", "org", ",", "repo", ",", "num", ",", "labels", ".", "NeedsRebase", ")", ";", "err", "!=", "nil", "{", "log", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "labels", ".", "NeedsRebase", ")", "\n", "}", "\n", "botName", ",", "err", ":=", "ghc", ".", "BotName", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "ghc", ".", "DeleteStaleComments", "(", "org", ",", "repo", ",", "num", ",", "nil", ",", "shouldPrune", "(", "botName", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,414
all-12415
[ "determine", "if", "a", "name", "corresponds", "to", "a", "sync", "object" ]
[ "func", "IsSync", "(", "sync", "uintptr", ")", "bool", "{", "<mask>", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpIsSync", ",", "1", ",", "uintptr", "(", "sync", ")", ",", "0", ",", "0", ")", "\n", "return", "ret", "!=", "0", "\n", "}" ]
12,415
all-12416
[ "Exists", "returns", "true", "if", "the", "domain" ]
[ "func", "(", "dom", "Domain", ")", "Exists", "(", ")", "(", "bool", ",", "error", ")", "{", "var", "d", "dictionary", "\n", "err", ":=", "dom", ".", "cgp", ".", "request", "(", "getDomainSettings", "{", "<mask>", ":", "dom", ".", "Name", "}", ",", "&", "d", ")", "\n", "if", "_", ",", "ok", ":=", "err", ".", "(", "SOAPNotFoundError", ")", ";", "ok", "{", "return", "false", ",", "nil", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}" ]
12,416
all-12417
[ "Emergencyf", "logs", "provided", "message", "with", "formatting", "in", "EMERGENCY", "level", "." ]
[ "func", "(", "logger", "*", "Logger", ")", "Emergencyf", "(", "format", "string", ",", "a", "...", "interface", "{", "}", ")", "{", "logger", ".", "log", "(", "EMERGENCY", ",", "<mask>", ",", "a", "...", ")", "\n", "}" ]
12,417
all-12418
[ "Execute", "-", "initializes", "cf", "-", "mgmt", "configuration" ]
[ "func", "(", "c", "*", "InitConfigurationCommand", ")", "Execute", "(", "[", "]", "<mask>", ")", "error", "{", "lo", ".", "G", ".", "Warning", "(", "\"", "\"", ")", "\n", "lo", ".", "G", ".", "Infof", "(", "\"", "\"", ",", "c", ".", "ConfigDirectory", ")", "\n", "configManager", ":=", "config", ".", "NewManager", "(", "c", ".", "ConfigDirectory", ")", "\n", "return", "configManager", ".", "CreateConfigIfNotExists", "(", "\"", "\"", ")", "\n", "}" ]
12,418
all-12419
[ "Jobs", "returns", "a", "Collection", "of", "jobs" ]
[ "func", "Jobs", "(", "etcdClient", "*", "etcd", ".", "Client", ",", "etcdPrefix", "string", ")", "col", ".", "Collection", "{", "return", "col", ".", "NewCollection", "(", "etcdClient", ",", "<mask>", ".", "Join", "(", "etcdPrefix", ",", "jobsPrefix", ")", ",", "[", "]", "*", "col", ".", "Index", "{", "JobsPipelineIndex", ",", "JobsOutputIndex", "}", ",", "&", "pps", ".", "EtcdJobInfo", "{", "}", ",", "nil", ",", "nil", ",", ")", "\n", "}" ]
12,419
all-12420
[ "exists", "checks", "if", "a", "hostport", "exists", "in", "the", "peer", "list", "." ]
[ "func", "(", "l", "*", "PeerList", ")", "exists", "(", "hostPort", "string", ")", "(", "*", "peerScore", ",", "bool", ")", "{", "l", ".", "RLock", "(", ")", "\n", "ps", ",", "ok", ":=", "l", ".", "peersByHostPort", "[", "hostPort", "]", "\n", "l", ".", "RUnlock", "(", ")", "\n\n", "return", "ps", ",", "<mask>", "\n", "}" ]
12,420
all-12421
[ "DeleteGetStartedButton", "delets", "a", "button", "set", "by", "SetGetStartedButton" ]
[ "func", "(", "m", "*", "Messenger", ")", "DeleteGetStartedButton", "(", ")", "error", "{", "result", ",", "err", ":=", "m", ".", "changeThreadSettings", "(", "<mask>", ".", "MethodDelete", ",", "&", "threadSettings", "{", "Type", ":", "settingTypeCallToActions", ",", "State", ":", "threadStateNew", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "result", ".", "Result", "!=", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "result", ".", "Result", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,421
all-12422
[ "DefaultDevicesFromReference", "fetches", "the", "default", "virtual", "device", "list", "for", "a", "specific", "compute", "resource", "from", "a", "supplied", "managed", "object", "reference", "." ]
[ "func", "DefaultDevicesFromReference", "(", "client", "*", "govmomi", ".", "Client", ",", "ref", "types", ".", "ManagedObjectReference", ",", "guest", "string", ")", "(", "object", ".", "VirtualDeviceList", ",", "error", ")", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "ref", ".", "Value", ",", "guest", ")", "\n", "b", ",", "err", ":=", "EnvironmentBrowserFromReference", "(", "client", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "return", "b", ".", "DefaultDevices", "(", "ctx", ",", "\"", "\"", ",", "nil", ")", "\n", "}" ]
12,422
all-12423
[ "apply", "recordset", "changes", "by", "inserting", "/", "updating", "/", "deleting", "recordsets" ]
[ "func", "(", "p", "designateProvider", ")", "upsertRecordSet", "(", "rs", "*", "recordSet", ",", "managedZones", "map", "[", "string", "]", "string", ")", "error", "{", "if", "rs", ".", "zoneID", "==", "\"", "\"", "{", "var", "err", "error", "\n", "rs", ".", "zoneID", ",", "err", "=", "p", ".", "getHostZoneID", "(", "rs", ".", "dnsName", ",", "managedZones", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "rs", ".", "zoneID", "==", "\"", "\"", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "rs", ".", "dnsName", ")", "\n", "return", "nil", "\n", "}", "\n", "}", "\n", "<mask>", "records", "[", "]", "string", "\n", "for", "rec", ",", "v", ":=", "range", "rs", ".", "names", "{", "if", "v", "{", "records", "=", "append", "(", "records", ",", "rec", ")", "\n", "}", "\n", "}", "\n", "if", "rs", ".", "recordSetID", "==", "\"", "\"", "&&", "records", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "rs", ".", "recordSetID", "==", "\"", "\"", "{", "opts", ":=", "recordsets", ".", "CreateOpts", "{", "Name", ":", "rs", ".", "dnsName", ",", "Type", ":", "rs", ".", "recordType", ",", "Records", ":", "records", ",", "}", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "rs", ".", "dnsName", ",", "rs", ".", "recordType", ",", "strings", ".", "Join", "(", "records", ",", "\"", "\"", ")", ")", "\n", "if", "p", ".", "dryRun", "{", "return", "nil", "\n", "}", "\n", "_", ",", "err", ":=", "p", ".", "client", ".", "CreateRecordSet", "(", "rs", ".", "zoneID", ",", "opts", ")", "\n", "return", "err", "\n", "}", "else", "if", "len", "(", "records", ")", "==", "0", "{", "log", ".", "Infof", "(", "\"", "\"", ",", "rs", ".", "dnsName", ",", "rs", ".", "recordType", ")", "\n", "if", "p", ".", "dryRun", "{", "return", "nil", "\n", "}", "\n", "return", "p", ".", "client", ".", "DeleteRecordSet", "(", "rs", ".", "zoneID", ",", "rs", ".", "recordSetID", ")", "\n", "}", "else", "{", "opts", ":=", "recordsets", ".", "UpdateOpts", "{", "Records", ":", "records", ",", "}", "\n", "log", ".", "Infof", "(", "\"", "\"", ",", "rs", ".", "dnsName", ",", "rs", ".", "recordType", ",", "strings", ".", "Join", "(", "records", ",", "\"", "\"", ")", ")", "\n", "if", "p", ".", "dryRun", "{", "return", "nil", "\n", "}", "\n", "return", "p", ".", "client", ".", "UpdateRecordSet", "(", "rs", ".", "zoneID", ",", "rs", ".", "recordSetID", ",", "opts", ")", "\n", "}", "\n", "}" ]
12,423
all-12424
[ "EnableSvcNotifications", "creates", "a", "new", "ENABLE_SVC_NOTIFICATIONS", "Nagios", "command", ".", "Enables", "notifications", "for", "a", "particular", "service", ".", "Notifications", "will", "be", "sent", "out", "for", "the", "service", "only", "if", "notifications", "are", "enabled", "on", "a", "program", "-", "wide", "basis", "as", "well", "." ]
[ "func", "EnableSvcNotifications", "(", "host_name", "string", ",", "service_description", "<mask>", ",", ")", "*", "livestatus", ".", "Command", "{", "return", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "host_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "service_description", ")", ",", ")", "\n", "}" ]
12,424
all-12425
[ "NewMockLicenseProvider", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockLicenseProvider", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockLicenseProvider", "{", "mock", ":=", "&", "MockLicenseProvider", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockLicenseProviderMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
12,425
all-12426
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "ImageReference", "." ]
[ "func", "(", "t", "archiveTransport", ")", "ParseReference", "(", "<mask>", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "return", "ParseReference", "(", "reference", ")", "\n", "}" ]
12,426
all-12427
[ "Value", "implements", "the", "driver", "Valuer", "interface", "." ]
[ "func", "(", "n", "NullBytes", ")", "Value", "(", ")", "(", "<mask>", ".", "Value", ",", "error", ")", "{", "if", "!", "n", ".", "Valid", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "n", ".", "Bytes", ",", "nil", "\n", "}" ]
12,427
all-12428
[ "ValidateConfig", "validates", "config", "with", "existing", "resources", "In", ":", "configs", "-", "a", "list", "of", "resources", "configs", "resources", "-", "a", "list", "of", "resources", "Out", ":", "nil", "on", "success", "error", "on", "failure" ]
[ "func", "ValidateConfig", "(", "configs", "[", "]", "common", ".", "ResourcesConfig", ",", "resources", "[", "]", "common", ".", "Resource", ")", "error", "{", "resourcesNeeds", ":=", "map", "[", "string", "]", "int", "{", "}", "\n", "actualResources", ":=", "map", "[", "string", "]", "int", "{", "}", "\n\n", "configNames", ":=", "map", "[", "string", "]", "map", "[", "string", "]", "int", "{", "}", "\n", "for", "_", ",", "c", ":=", "range", "configs", "{", "_", ",", "alreadyExists", ":=", "configNames", "[", "c", ".", "Name", "]", "\n", "if", "alreadyExists", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "c", ".", "Name", ")", "\n", "}", "\n", "configNames", "[", "c", ".", "Name", "]", "=", "c", ".", "Needs", "\n", "}", "\n\n", "for", "_", ",", "res", ":=", "range", "resources", "{", "_", ",", "useConfig", ":=", "configNames", "[", "res", ".", "Type", "]", "\n", "if", "useConfig", "{", "c", ",", "ok", ":=", "configNames", "[", "res", ".", "Type", "]", "\n", "if", "!", "ok", "{", "err", ":=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "res", ".", "Type", ")", "\n", "logrus", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "return", "err", "\n", "}", "\n", "// Updating resourceNeeds", "for", "k", ",", "v", ":=", "range", "c", "{", "resourcesNeeds", "[", "k", "]", "+=", "v", "\n", "}", "\n", "}", "\n", "actualResources", "[", "res", ".", "Type", "]", "++", "\n", "}", "\n\n", "for", "rType", ",", "needs", ":=", "range", "resourcesNeeds", "{", "actual", ",", "ok", ":=", "actualResources", "[", "rType", "]", "\n", "if", "!", "<mask>", "{", "err", ":=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "rType", ")", "\n", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "err", "\n", "}", "\n", "if", "needs", ">", "actual", "{", "err", ":=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "rType", ")", "\n", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,428
all-12429
[ "Wait", "for", "the", "raft", "node", "to", "become", "leader", ".", "Should", "only", "be", "used", "by", "Bootstrap", "since", "we", "know", "that", "we", "ll", "self", "elect", "." ]
[ "func", "(", "g", "*", "Gateway", ")", "waitLeadership", "(", ")", "error", "{", "n", ":=", "80", "\n", "sleep", ":=", "250", "*", "time", ".", "Millisecond", "\n", "for", "i", ":=", "0", ";", "i", "<", "n", ";", "i", "++", "{", "if", "g", ".", "raft", ".", "raft", ".", "State", "(", ")", "==", "raft", ".", "Leader", "{", "return", "nil", "\n", "}", "\n", "time", ".", "Sleep", "(", "<mask>", ")", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "time", ".", "Duration", "(", "n", ")", "*", "sleep", ")", "\n", "}" ]
12,429
all-12430
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TextBoxSnapshot", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomsnapshot", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
12,430
all-12431
[ "createAccessController", "wraps", "HTTP", "multiplexer", ":", "-", "mutate", "gRPC", "gateway", "request", "paths", "-", "check", "hostname", "whitelist", "client", "HTTP", "requests", "goes", "here", "first" ]
[ "func", "createAccessController", "(", "lg", "*", "zap", ".", "Logger", ",", "s", "*", "etcdserver", ".", "EtcdServer", ",", "mux", "*", "http", ".", "ServeMux", ")", "<mask>", ".", "Handler", "{", "return", "&", "accessController", "{", "lg", ":", "lg", ",", "s", ":", "s", ",", "mux", ":", "mux", "}", "\n", "}" ]
12,431
all-12432
[ "NewGoogleClientFromEnv", "creates", "a", "Google", "client", "based", "on", "environment", "variables", "." ]
[ "func", "NewGoogleClientFromEnv", "(", ")", "(", "<mask>", ",", "error", ")", "{", "bucket", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "GoogleBucketEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "GoogleBucketEnvVar", ")", "\n", "}", "\n", "creds", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "GoogleCredEnvVar", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "GoogleCredEnvVar", ")", "\n", "}", "\n", "opts", ":=", "[", "]", "option", ".", "ClientOption", "{", "option", ".", "WithCredentialsJSON", "(", "[", "]", "byte", "(", "creds", ")", ")", "}", "\n", "return", "NewGoogleClient", "(", "bucket", ",", "opts", ")", "\n", "}" ]
12,432
all-12433
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetAttributeValueParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom9", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
12,433
all-12434
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetMaxCallStackSizeToCaptureParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,434
all-12435
[ "bmw256", "calculates", "and", "returns", "bmw256", "of", "input", ".", "length", "of", "input", "must", "be", "32", "bytes", "." ]
[ "func", "bmw256", "(", "input", "[", "]", "byte", ")", "[", "]", "byte", "{", "b", ":=", "new", "(", "", ")", "\n", "buf", ":=", "make", "(", "[", "]", "byte", ",", "64", ")", "\n", "copy", "(", "buf", ",", "input", ")", "\n", "buf", "[", "len", "(", "input", ")", "]", "=", "0x80", "\n", "bitLen", ":=", "uint64", "(", "len", "(", "input", ")", ")", "<<", "3", "\n", "binary", ".", "LittleEndian", ".", "PutUint64", "(", "buf", "[", "56", ":", "]", ",", "bitLen", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "16", ";", "i", "++", "{", "b", ".", "m", "[", "i", "]", "=", "binary", ".", "LittleEndian", ".", "Uint32", "(", "buf", "[", "i", "*", "4", ":", "]", ")", "\n", "}", "\n", "b", ".", "compress", "(", "b", ".", "m", ")", "\n", "b", ".", "h", ",", "b", ".", "h2", "=", "b", ".", "h2", ",", "b", ".", "h", "\n", "copy", "(", "b", ".", "h", ",", "final", ")", "\n", "b", ".", "compress", "(", "b", ".", "h2", ")", "\n", "output", ":=", "make", "(", "[", "]", "byte", ",", "32", ")", "\n", "outlen", ":=", "len", "(", "<mask>", ")", ">>", "2", "\n", "for", "i", ":=", "0", ";", "i", "<", "outlen", ";", "i", "++", "{", "j", ":=", "16", "-", "outlen", "+", "i", "\n", "binary", ".", "LittleEndian", ".", "PutUint32", "(", "output", "[", "4", "*", "i", ":", "]", ",", "b", ".", "h", "[", "j", "]", ")", "\n", "}", "\n", "return", "output", "\n", "}" ]
12,435
all-12436
[ "SlicePtr", "returns", "the", "pointer", "inside", "a", "slice", ".", "r", "must", "contain", "a", "slice", "." ]
[ "func", "(", "r", "region", ")", "SlicePtr", "(", ")", "region", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindSlice", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "region", "{", "p", ":", "r", ".", "p", ",", "a", ":", "r", ".", "a", ",", "typ", ":", "&", "Type", "{", "<mask>", ":", "\"", "\"", "+", "r", ".", "typ", ".", "Name", "[", "2", ":", "]", ",", "Size", ":", "r", ".", "p", ".", "proc", ".", "PtrSize", "(", ")", ",", "Kind", ":", "KindPtr", ",", "Elem", ":", "r", ".", "typ", ".", "Elem", "}", "}", "\n", "}" ]
12,436
all-12437
[ "Txn", "implements", "gRPC", "KVServer", ".", "Txn", "processes", "all", "the", "requests", "in", "one", "transaction", ".", "A", "txn", "request", "increases", "the", "revision", "of", "the", "store", "and", "generates", "events", "with", "the", "same", "revision", "in", "the", "event", "history", ".", "It", "is", "not", "allowed", "to", "modify", "the", "same", "key", "several", "times", "within", "one", "txn", "." ]
[ "func", "(", "s", "*", "etcdStore", ")", "Txn", "(", "ctx", "context", ".", "<mask>", ",", "req", "*", "etcdserverpb", ".", "TxnRequest", ")", "(", "*", "etcdserverpb", ".", "TxnResponse", ",", "error", ")", "{", "ireq", ":=", "etcdserverpb", ".", "InternalRaftRequest", "{", "ID", ":", "<-", "s", ".", "idgen", ",", "Txn", ":", "req", "}", "\n", "msgc", ",", "errc", ",", "err", ":=", "s", ".", "proposeInternalRaftRequest", "(", "ireq", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "s", ".", "cancelInternalRaftRequest", "(", "ireq", ")", "\n", "return", "nil", ",", "ctx", ".", "Err", "(", ")", "\n", "case", "msg", ":=", "<-", "msgc", ":", "return", "msg", ".", "(", "*", "etcdserverpb", ".", "TxnResponse", ")", ",", "nil", "\n", "case", "err", ":=", "<-", "errc", ":", "return", "nil", ",", "err", "\n", "case", "<-", "s", ".", "quitc", ":", "return", "nil", ",", "errStopped", "\n", "}", "\n", "}" ]
12,437
all-12438
[ "GetInstanceIdentityDocument", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockHttpClient", ")", "GetInstanceIdentityDocument", "(", ")", "(", "ec2metadata", ".", "EC2InstanceIdentityDocument", ",", "error", ")", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "ec2metadata", ".", "EC2InstanceIdentityDocument", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
12,438
all-12439
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CaptureScreenshotParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage80", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
12,439
all-12440
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "prm", "*", "prmMatchExact", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "*", "prm", "=", "prmMatchExact", "{", "}", "\n", "var", "tmp", "prmMatchExact", "\n", "if", "err", ":=", "paranoidUnmarshalJSONObjectExactFields", "(", "data", ",", "<mask>", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "&", "tmp", ".", "Type", ",", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "tmp", ".", "Type", "!=", "prmTypeMatchExact", "{", "return", "InvalidPolicyFormatError", "(", "fmt", ".", "Sprintf", "(", "\"", "\\\"", "\\\"", "\"", ",", "tmp", ".", "Type", ")", ")", "\n", "}", "\n", "*", "prm", "=", "*", "newPRMMatchExact", "(", ")", "\n", "return", "nil", "\n", "}" ]
12,440
all-12441
[ "DeleteAll", "deletes", "everything", "in", "the", "cluster", ".", "Use", "with", "caution", "there", "is", "no", "undo", "." ]
[ "func", "(", "c", "APIClient", ")", "DeleteAll", "(", ")", "error", "{", "if", "_", ",", "err", ":=", "c", ".", "AuthAPIClient", ".", "Deactivate", "(", "c", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "DeactivateRequest", "{", "}", ",", ")", ";", "err", "!=", "nil", "&&", "!", "auth", ".", "IsErrNotActivated", "(", "err", ")", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "_", ",", "err", ":=", "c", ".", "PpsAPIClient", ".", "DeleteAll", "(", "c", ".", "Ctx", "(", ")", ",", "&", "types", ".", "Empty", "{", "}", ",", ")", ";", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "_", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "DeleteAll", "(", "c", ".", "Ctx", "(", ")", ",", "&", "<mask>", ".", "Empty", "{", "}", ",", ")", ";", "err", "!=", "nil", "{", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,441
all-12442
[ "MarshalEasyJSON", "writes", "the", "Base64", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "b", "Base64", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "Writer", ")", "{", "w", ".", "<mask>", "(", "base64", ".", "StdEncoding", ".", "EncodeToString", "(", "[", "]", "byte", "(", "b", ")", ")", ")", "\n", "}" ]
12,442
all-12443
[ "ListFileHistory", "returns", "info", "about", "all", "files", "and", "their", "history", "in", "a", "Commit", "under", "path", "." ]
[ "func", "(", "c", "APIClient", ")", "ListFileHistory", "(", "repoName", "string", ",", "commitID", "string", ",", "path", "string", ",", "history", "int64", ")", "(", "[", "]", "*", "pfs", ".", "FileInfo", ",", "error", ")", "{", "var", "<mask>", "[", "]", "*", "pfs", ".", "FileInfo", "\n", "if", "err", ":=", "c", ".", "ListFileF", "(", "repoName", ",", "commitID", ",", "path", ",", "history", ",", "func", "(", "fi", "*", "pfs", ".", "FileInfo", ")", "error", "{", "result", "=", "append", "(", "result", ",", "fi", ")", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n", "}" ]
12,443
all-12444
[ "Query", "executes", "a", "single", "GraphQL", "query", "request", "with", "a", "query", "derived", "from", "q", "populating", "the", "response", "into", "it", ".", "q", "should", "be", "a", "pointer", "to", "struct", "that", "corresponds", "to", "the", "GitHub", "GraphQL", "schema", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "Query", "(", "ctx", "context", ".", "Context", ",", "q", "interface", "{", "}", ",", "variables", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "return", "c", ".", "client", ".", "Query", "(", "ctx", ",", "q", ",", "variables", ")", "\n", "}" ]
12,444
all-12445
[ "GetQuery", "returns", "the", "Query", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "GetQuery", "(", ")", "string", "{", "if", "m", "==", "nil", "||", "m", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "m", ".", "Query", "\n", "}" ]
12,445
all-12446
[ "NewList", "is", "the", "List", "initializer", ".", "This", "call", "implements", "the", "NewWidget", "convention", "by", "taking", "a", "*", "Window", "and", "and", "an", "anchor", "point", "to", "render", "the", "widget", "." ]
[ "func", "NewList", "(", "w", "*", "Window", ",", "x", ",", "y", "int", ")", "(", "Widgeter", ",", "error", ")", "{", "return", "&", "<mask>", "{", "Widget", ":", "MakeWidget", "(", "w", ",", "x", ",", "y", ")", ",", "}", ",", "nil", "\n", "}" ]
12,446
all-12447
[ "parseTemplates", "returns", "a", "list", "of", "Templates", "that", "must", "be", "rendered", "given", "the", "template", "files", "." ]
[ "func", "parseTemplates", "(", "skipTChannel", "bool", ",", "templateFiles", "[", "]", "string", ")", "(", "[", "]", "*", "Template", ",", "error", ")", "{", "var", "templates", "[", "]", "*", "Template", "\n\n", "if", "!", "skipTChannel", "{", "templates", "=", "append", "(", "templates", ",", "&", "Template", "{", "<mask>", ":", "\"", "\"", ",", "template", ":", "template", ".", "Must", "(", "parseTemplate", "(", "tchannelTmpl", ")", ")", ",", "}", ")", "\n", "}", "\n\n", "for", "_", ",", "f", ":=", "range", "templateFiles", "{", "t", ",", "err", ":=", "parseTemplateFile", "(", "f", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "templates", "=", "append", "(", "templates", ",", "t", ")", "\n", "}", "\n\n", "return", "templates", ",", "nil", "\n", "}" ]
12,447
all-12448
[ "MustIpv4", "retrieves", "the", "Ipv4", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "PeerAddressIp", ")", "MustIpv4", "(", ")", "[", "4", "]", "byte", "{", "val", ",", "<mask>", ":=", "u", ".", "GetIpv4", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
12,448
all-12449
[ "GetContainersFull", "returns", "a", "list", "of", "containers", "including", "snapshots", "backups", "and", "state" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetContainersFull", "(", ")", "(", "[", "]", "api", ".", "ContainerFull", ",", "error", ")", "{", "containers", ":=", "[", "]", "api", ".", "ContainerFull", "{", "}", "\n\n", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Fetch the raw value", "_", ",", "<mask>", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ",", "&", "containers", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "containers", ",", "nil", "\n", "}" ]
12,449
all-12450
[ "WithCtx", "returns", "a", "new", "APIClient", "that", "uses", "ctx", "for", "requests", "it", "sends", ".", "Note", "that", "the", "new", "APIClient", "will", "still", "use", "the", "authentication", "token", "and", "metrics", "metadata", "of", "this", "client", "so", "this", "is", "only", "useful", "for", "propagating", "other", "context", "-", "associated", "metadata", "." ]
[ "func", "(", "c", "*", "APIClient", ")", "WithCtx", "(", "ctx", "context", ".", "Context", ")", "*", "APIClient", "{", "result", ":=", "*", "c", "// copy c", "\n", "<mask>", ".", "ctx", "=", "ctx", "\n", "return", "&", "result", "\n", "}" ]
12,450
all-12451
[ "mapSet", "is", "sets", "the", "value", "in", "the", "map", "overwriting", "if", "o", "is", "true", ".", "This", "function", "does", "not", "perform", "locking", ";", "callers", "should", "lock", "before", "invoking", "." ]
[ "func", "(", "s", "*", "Scratch", ")", "mapSet", "(", "k", ",", "mk", "string", ",", "v", "interface", "{", "}", ",", "o", "bool", ")", "(", "string", ",", "error", ")", "{", "if", "_", ",", "<mask>", ":=", "s", ".", "values", "[", "k", "]", ";", "!", "ok", "{", "s", ".", "values", "[", "k", "]", "=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "}", "\n\n", "typed", ",", "ok", ":=", "s", ".", "values", "[", "k", "]", ".", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "k", ")", "\n", "}", "\n\n", "if", "_", ",", "ok", ":=", "typed", "[", "mk", "]", ";", "o", "||", "!", "ok", "{", "typed", "[", "mk", "]", "=", "v", "\n", "}", "\n", "return", "\"", "\"", ",", "nil", "\n", "}" ]
12,451
all-12452
[ "Do", "executes", "HeapProfiler", ".", "takeHeapSnapshot", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "TakeHeapSnapshotParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandTakeHeapSnapshot", ",", "p", ",", "nil", ")", "\n", "}" ]
12,452
all-12453
[ "AccessToken", "generates", "an", "OAuth2", "access", "token", "for", "the", "specified", "scopes", "on", "behalf", "of", "service", "account", "of", "this", "application", ".", "This", "token", "will", "expire", "after", "the", "returned", "time", "." ]
[ "func", "AccessToken", "(", "c", "context", ".", "Context", ",", "scopes", "...", "string", ")", "(", "token", "string", ",", "expiry", "time", ".", "Time", ",", "err", "error", ")", "{", "req", ":=", "&", "pb", ".", "GetAccessTokenRequest", "{", "Scope", ":", "scopes", "}", "\n", "res", ":=", "&", "pb", ".", "GetAccessTokenResponse", "{", "}", "\n\n", "err", "=", "<mask>", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "time", ".", "Time", "{", "}", ",", "err", "\n", "}", "\n", "return", "res", ".", "GetAccessToken", "(", ")", ",", "time", ".", "Unix", "(", "res", ".", "GetExpirationTime", "(", ")", ",", "0", ")", ",", "nil", "\n", "}" ]
12,453
all-12454
[ "ServerTLSConfig", "returns", "a", "new", "server", "-", "side", "tls", ".", "Config", "generated", "from", "the", "give", "certificate", "info", "." ]
[ "func", "ServerTLSConfig", "(", "cert", "*", "shared", ".", "CertInfo", ")", "*", "tls", ".", "Config", "{", "config", ":=", "shared", ".", "InitTLSConfig", "(", ")", "\n", "config", ".", "ClientAuth", "=", "tls", ".", "RequestClientCert", "\n", "config", ".", "Certificates", "=", "[", "]", "tls", ".", "Certificate", "{", "cert", ".", "KeyPair", "(", ")", "}", "\n", "config", ".", "NextProtos", "=", "[", "]", "string", "{", "\"", "\"", "}", "// Required by gRPC", "\n\n", "if", "cert", ".", "CA", "(", ")", "!=", "nil", "{", "pool", ":=", "x509", ".", "NewCertPool", "(", ")", "\n", "pool", ".", "AddCert", "(", "<mask>", ".", "CA", "(", ")", ")", "\n", "config", ".", "RootCAs", "=", "pool", "\n", "config", ".", "ClientCAs", "=", "pool", "\n\n", "logger", ".", "Infof", "(", "\"", "\"", ")", "\n", "}", "\n\n", "config", ".", "BuildNameToCertificate", "(", ")", "\n", "return", "config", "\n", "}" ]
12,454
all-12455
[ "Ask", "a", "question", "on", "the", "output", "stream", "and", "read", "the", "answer", "from", "the", "input", "stream" ]
[ "func", "askQuestion", "(", "question", ",", "defaultAnswer", "string", ")", "string", "{", "fmt", ".", "Printf", "(", "<mask>", ")", "\n\n", "return", "readAnswer", "(", "defaultAnswer", ")", "\n", "}" ]
12,455
all-12456
[ "readExtTimes", "reads", "and", "parses", "the", "optional", "extra", "time", "field", "from", "the", "file", "header", "." ]
[ "func", "readExtTimes", "(", "f", "*", "fileBlockHeader", ",", "b", "*", "readBuf", ")", "{", "if", "len", "(", "*", "b", ")", "<", "2", "{", "return", "// invalid, not enough data", "\n", "}", "\n", "flags", ":=", "b", ".", "uint16", "(", ")", "\n\n", "ts", ":=", "[", "]", "*", "time", ".", "Time", "{", "&", "f", ".", "ModificationTime", ",", "&", "f", ".", "CreationTime", ",", "&", "f", ".", "AccessTime", "}", "\n\n", "for", "i", ",", "t", ":=", "range", "ts", "{", "n", ":=", "flags", ">>", "uint", "(", "(", "3", "-", "i", ")", "*", "4", ")", "\n", "if", "n", "&", "0x8", "==", "0", "{", "<mask>", "\n", "}", "\n", "if", "i", "!=", "0", "{", "// ModificationTime already read so skip", "if", "len", "(", "*", "b", ")", "<", "4", "{", "return", "// invalid, not enough data", "\n", "}", "\n", "*", "t", "=", "parseDosTime", "(", "b", ".", "uint32", "(", ")", ")", "\n", "}", "\n", "if", "n", "&", "0x4", ">", "0", "{", "*", "t", "=", "t", ".", "Add", "(", "time", ".", "Second", ")", "\n", "}", "\n", "n", "&=", "0x3", "\n", "if", "n", "==", "0", "{", "continue", "\n", "}", "\n", "if", "len", "(", "*", "b", ")", "<", "int", "(", "n", ")", "{", "return", "// invalid, not enough data", "\n", "}", "\n", "// add extra time data in 100's of nanoseconds", "d", ":=", "time", ".", "Duration", "(", "0", ")", "\n", "for", "j", ":=", "3", "-", "n", ";", "j", "<", "n", ";", "j", "++", "{", "d", "|=", "time", ".", "Duration", "(", "b", ".", "byte", "(", ")", ")", "<<", "(", "j", "*", "8", ")", "\n", "}", "\n", "d", "*=", "100", "\n", "*", "t", "=", "t", ".", "Add", "(", "d", ")", "\n", "}", "\n", "}" ]
12,456
all-12457
[ "parse", "parses", "the", "given", "string", "and", "returns", "a", "map", "listing", "the", "values", "specified", "for", "each", "key", "." ]
[ "func", "parse", "(", "s", "string", ")", "map", "[", "string", "]", "[", "]", "string", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "string", ")", "\n", "for", "s", "!=", "\"", "\"", "{", "key", ":=", "s", "\n", "if", "i", ":=", "strings", ".", "IndexAny", "(", "key", ",", "\"", "\"", ")", ";", "i", ">=", "0", "{", "key", ",", "s", "=", "key", "[", ":", "i", "]", ",", "key", "[", "i", "+", "1", ":", "]", "\n", "}", "else", "{", "s", "=", "\"", "\"", "\n", "}", "\n", "if", "key", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "value", ":=", "\"", "\"", "\n", "if", "i", ":=", "strings", ".", "Index", "(", "key", ",", "\"", "\"", ")", ";", "i", ">=", "0", "{", "key", ",", "value", "=", "key", "[", ":", "i", "]", ",", "<mask>", "[", "i", "+", "1", ":", "]", "\n", "}", "\n", "m", "[", "key", "]", "=", "append", "(", "m", "[", "key", "]", ",", "value", ")", "\n", "}", "\n", "return", "m", "\n", "}" ]
12,457
all-12458
[ "GetLastNoDataTs", "returns", "the", "LastNoDataTs", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "g", "*", "GroupData", ")", "GetLastNoDataTs", "(", ")", "int", "{", "if", "g", "==", "nil", "||", "g", ".", "LastNoDataTs", "==", "nil", "{", "<mask>", "0", "\n", "}", "\n", "return", "*", "g", ".", "LastNoDataTs", "\n", "}" ]
12,458
all-12459
[ "MarshalJSON", "overrides", "the", "logic", "for", "JSON", "-", "encoding", "the", "TaskStatus", "type" ]
[ "func", "(", "ts", "*", "TaskStatus", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "<mask>", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "[", "]", "byte", "(", "`\"`", "+", "ts", ".", "String", "(", ")", "+", "`\"`", ")", ",", "nil", "\n", "}" ]
12,459
all-12460
[ "CertificatesGet", "returns", "all", "certificates", "from", "the", "DB", "as", "CertBaseInfo", "objects", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "CertificatesGet", "(", ")", "(", "certs", "[", "]", "*", "CertInfo", ",", "err", "error", ")", "{", "err", "=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "rows", ",", "err", ":=", "tx", ".", "tx", ".", "<mask>", "(", "\"", "\"", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "defer", "rows", ".", "Close", "(", ")", "\n\n", "for", "rows", ".", "Next", "(", ")", "{", "cert", ":=", "new", "(", "CertInfo", ")", "\n", "rows", ".", "Scan", "(", "&", "cert", ".", "ID", ",", "&", "cert", ".", "Fingerprint", ",", "&", "cert", ".", "Type", ",", "&", "cert", ".", "Name", ",", "&", "cert", ".", "Certificate", ",", ")", "\n", "certs", "=", "append", "(", "certs", ",", "cert", ")", "\n", "}", "\n\n", "return", "rows", ".", "Err", "(", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "certs", ",", "err", "\n", "}", "\n\n", "return", "certs", ",", "nil", "\n", "}" ]
12,460
all-12461
[ "MoveVisually", "is", "a", "wrapper", "around", "gtk_text_view_move_visually", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "MoveVisually", "(", "iter", "*", "TextIter", ",", "count", "int", ")", "bool", "{", "return", "gobool", "(", "C", ".", "gtk_text_view_move_visually", "(", "v", ".", "native", "(", ")", ",", "iter", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", ")", "\n", "}" ]
12,461
all-12462
[ "parseDosTime", "converts", "a", "32bit", "DOS", "time", "value", "to", "time", ".", "Time" ]
[ "func", "parseDosTime", "(", "t", "uint32", ")", "time", ".", "Time", "{", "n", ":=", "int", "(", "t", ")", "\n", "sec", ":=", "n", "&", "0x1f", "<<", "1", "\n", "min", ":=", "n", ">>", "5", "&", "0x3f", "\n", "hr", ":=", "n", ">>", "11", "&", "0x1f", "\n", "day", ":=", "n", ">>", "16", "&", "0x1f", "\n", "mon", ":=", "time", ".", "Month", "(", "n", ">>", "21", "&", "0x0f", ")", "\n", "yr", ":=", "n", ">>", "25", "&", "0x7f", "+", "1980", "\n", "return", "<mask>", ".", "Date", "(", "yr", ",", "mon", ",", "day", ",", "hr", ",", "min", ",", "sec", ",", "0", ",", "time", ".", "Local", ")", "\n", "}" ]
12,462
all-12463
[ "waitOnLowest", "will", "wait", "on", "the", "last", "key", "with", "a", "revision", "<", "rwm", ".", "myKey", ".", "Revision", "with", "a", "given", "prefix", ".", "If", "there", "are", "no", "keys", "left", "to", "wait", "on", "return", "true", "." ]
[ "func", "(", "rwm", "*", "RWMutex", ")", "waitOnLastRev", "(", "pfx", "string", ")", "(", "bool", ",", "error", ")", "{", "client", ":=", "rwm", ".", "s", ".", "Client", "(", ")", "\n", "// get key that's blocking myKey", "opts", ":=", "append", "(", "v3", ".", "WithLastRev", "(", ")", ",", "v3", ".", "WithMaxModRev", "(", "rwm", ".", "myKey", ".", "Revision", "(", ")", "-", "1", ")", ")", "\n", "lastKey", ",", "err", ":=", "client", ".", "Get", "(", "rwm", ".", "ctx", ",", "pfx", ",", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "if", "len", "(", "lastKey", ".", "Kvs", ")", "==", "0", "{", "return", "true", ",", "nil", "\n", "}", "\n", "// wait for release on blocking key", "_", ",", "err", "=", "WaitEvents", "(", "<mask>", ",", "string", "(", "lastKey", ".", "Kvs", "[", "0", "]", ".", "Key", ")", ",", "rwm", ".", "myKey", ".", "Revision", "(", ")", ",", "[", "]", "mvccpb", ".", "Event_EventType", "{", "mvccpb", ".", "DELETE", "}", ")", "\n", "return", "false", ",", "err", "\n", "}" ]
12,463
all-12464
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ContextRealtimeData", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoWebaudio7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,464
all-12465
[ "Hijack", "will", "hijack", "the", "underlying", "TCP", "connection", "if", "available", "in", "the", "ResponseWriter", "." ]
[ "func", "(", "w", "*", "FlushingWriter", ")", "Hijack", "(", ")", "(", "net", ".", "Conn", ",", "*", "bufio", ".", "ReadWriter", ",", "error", ")", "{", "if", "hijacker", ",", "ok", ":=", "w", ".", "ResponseWriter", ".", "(", "http", ".", "Hijacker", ")", ";", "ok", "{", "return", "hijacker", ".", "Hijack", "(", ")", "\n", "}", "\n", "return", "nil", ",", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
12,465
all-12466
[ "StartTimer", "starts", "the", "ack", "timer", "to", "record", "the", "expiration", "of", "ENI", "attachment" ]
[ "func", "(", "eni", "*", "ENIAttachment", ")", "StartTimer", "(", "timeoutFunc", "func", "(", ")", ")", "error", "{", "eni", ".", "guard", ".", "Lock", "(", ")", "\n", "defer", "eni", ".", "guard", ".", "Unlock", "(", ")", "\n\n", "if", "eni", ".", "ackTimer", "!=", "nil", "{", "// The timer has already been initialized, do nothing", "return", "nil", "\n", "}", "\n", "now", ":=", "time", ".", "Now", "(", ")", "\n", "<mask>", ":=", "eni", ".", "ExpiresAt", ".", "Sub", "(", "now", ")", "\n", "if", "duration", "<=", "0", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "eni", ".", "ExpiresAt", ".", "String", "(", ")", ",", "now", ".", "String", "(", ")", ")", "\n", "}", "\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "duration", ".", "String", "(", ")", ",", "eni", ".", "stringUnsafe", "(", ")", ")", "\n", "eni", ".", "ackTimer", "=", "time", ".", "AfterFunc", "(", "duration", ",", "timeoutFunc", ")", "\n", "return", "nil", "\n", "}" ]
12,466
all-12467
[ "Fsync", "flushes", "in", "-", "memory", "writes", "to", "disk", "on", "the", "server", "the", "session", "is", "established", "with", ".", "If", "async", "is", "true", "the", "call", "returns", "immediately", "otherwise", "it", "returns", "after", "the", "flush", "has", "been", "made", "." ]
[ "func", "(", "s", "*", "<mask>", ")", "Fsync", "(", "async", "bool", ")", "error", "{", "return", "s", ".", "Run", "(", "bson", ".", "D", "{", "{", "\"", "\"", ",", "1", "}", ",", "{", "\"", "\"", ",", "async", "}", "}", ",", "nil", ")", "\n", "}" ]
12,467
all-12468
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ScrollRect", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
12,468
all-12469
[ "compute", "iterates", "over", "floors", "and", "lines", "to", "generate", "the", "output", "of", "the", "sapin", "." ]
[ "func", "(", "s", "*", "Sapin", ")", "compute", "(", ")", "{", "if", "s", ".", "output", "!=", "\"", "\"", "{", "return", "\n", "}", "\n", "// size of the last line of the last floor", "maxSize", ":=", "s", ".", "GetMaxSize", "(", ")", "\n\n", "// each floor in the floors", "for", "floor", ":=", "0", ";", "floor", "<", "s", ".", "Size", ";", "<mask>", "++", "{", "// each line in the lines of the floor", "for", "line", ":=", "0", ";", "line", "<", "floor", "+", "4", ";", "line", "++", "{", "// size of the current line", "lineSize", ":=", "s", ".", "GetLineSize", "(", "floor", ",", "line", ")", "\n\n", "// pad left with spaces", "for", "i", ":=", "(", "maxSize", "-", "lineSize", ")", "/", "2", "-", "1", ";", "i", ">", "0", ";", "i", "--", "{", "s", ".", "putchar", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// draw the body", "for", "i", ":=", "0", ";", "i", "<", "lineSize", ";", "i", "++", "{", "s", ".", "putchar", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// new line", "s", ".", "putchar", "(", "\"", "\\n", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// the trunc", "for", "i", ":=", "0", ";", "i", "<", "s", ".", "Size", ";", "i", "++", "{", "lineSize", ":=", "s", ".", "Size", "+", "(", "s", ".", "Size", "+", "1", ")", "%", "2", "\n\n", "// pad left with spaces", "for", "i", ":=", "(", "maxSize", "-", "lineSize", ")", "/", "2", "-", "1", ";", "i", ">", "0", ";", "i", "--", "{", "s", ".", "putchar", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// draw the body", "for", "i", ":=", "0", ";", "i", "<", "lineSize", ";", "i", "++", "{", "s", ".", "putchar", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// new line", "s", ".", "putchar", "(", "\"", "\\n", "\"", ")", "\n", "}", "\n", "}" ]
12,469
all-12470
[ "recover", "is", "the", "handler", "that", "turns", "panics", "into", "returns", "from", "the", "top", "level", "of", "Parse", "." ]
[ "func", "(", "p", "*", "parser", ")", "recover", "(", "errp", "*", "error", ")", "{", "e", ":=", "recover", "(", ")", "\n", "if", "_", ",", "ok", ":=", "e", ".", "(", "runtime", ".", "<mask>", ")", ";", "ok", "{", "// Print the stack trace but do not inhibit the running application.", "buf", ":=", "make", "(", "[", "]", "byte", ",", "64", "<<", "10", ")", "\n", "buf", "=", "buf", "[", ":", "runtime", ".", "Stack", "(", "buf", ",", "false", ")", "]", "\n\n", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\"", ",", "e", ",", "buf", ")", "\n", "*", "errp", "=", "errUnexpected", "\n", "}", "else", "if", "e", "!=", "nil", "{", "*", "errp", "=", "e", ".", "(", "error", ")", "\n", "}", "\n", "p", ".", "lex", ".", "close", "(", ")", "\n", "}" ]
12,470
all-12471
[ "GetFontName", "is", "a", "wrapper", "around", "gtk_font_button_get_font_name", "()", "." ]
[ "func", "(", "v", "*", "FontButton", ")", "GetFontName", "(", ")", "<mask>", "{", "c", ":=", "C", ".", "gtk_font_button_get_font_name", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "goString", "(", "c", ")", "\n", "}" ]
12,471
all-12472
[ "Defaults", "returns", "a", "map", "of", "all", "key", "names", "in", "the", "schema", "along", "with", "their", "default", "values", "." ]
[ "func", "(", "s", "Schema", ")", "Defaults", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "values", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ",", "len", "(", "s", ")", ")", "\n", "for", "name", ",", "key", ":=", "<mask>", "s", "{", "values", "[", "name", "]", "=", "key", ".", "Default", "\n", "}", "\n", "return", "values", "\n", "}" ]
12,472
all-12473
[ "FindVirtualDevice", "will", "attempt", "to", "find", "an", "address", "by", "its", "device", "key", "if", "it", "is", ">", "0", "otherwise", "it", "will", "attempt", "to", "locate", "it", "by", "its", "device", "address", "." ]
[ "func", "(", "r", "*", "Subresource", ")", "FindVirtualDevice", "(", "l", "object", ".", "VirtualDeviceList", ")", "(", "types", ".", "BaseVirtualDevice", ",", "error", ")", "{", "if", "key", ":=", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ";", "key", ">", "0", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "key", ")", "\n", "if", "dev", ":=", "l", ".", "FindByKey", "(", "int32", "(", "<mask>", ")", ")", ";", "dev", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "l", ".", "Name", "(", "dev", ")", ")", "\n", "return", "dev", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "key", ")", "\n", "}", "\n", "return", "r", ".", "FindVirtualDeviceByAddr", "(", "l", ")", "\n", "}" ]
12,473
all-12474
[ "GetTimeframeOk", "returns", "a", "tuple", "with", "the", "Timeframe", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "r", "*", "Rule", ")", "GetTimeframeOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "r", "==", "nil", "||", "r", ".", "Timeframe", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "r", ".", "Timeframe", ",", "<mask>", "\n", "}" ]
12,474
all-12475
[ "RerunPipeline", "reruns", "a", "pipeline", "over", "a", "given", "set", "of", "commits", ".", "Exclude", "and", "include", "are", "filters", "that", "either", "include", "or", "exclude", "the", "ancestors", "of", "the", "given", "commits", ".", "A", "commit", "is", "considered", "the", "ancestor", "of", "itself", ".", "The", "behavior", "is", "the", "same", "as", "that", "of", "ListCommit", "." ]
[ "func", "(", "c", "APIClient", ")", "RerunPipeline", "(", "name", "string", ",", "<mask>", "[", "]", "*", "pfs", ".", "Commit", ",", "exclude", "[", "]", "*", "pfs", ".", "Commit", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "PpsAPIClient", ".", "RerunPipeline", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pps", ".", "RerunPipelineRequest", "{", "Pipeline", ":", "NewPipeline", "(", "name", ")", ",", "Include", ":", "include", ",", "Exclude", ":", "exclude", ",", "}", ",", ")", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}" ]
12,475
all-12476
[ "AssignIssue", "adds", "logins", "to", "org", "/", "repo#number", "returning", "an", "error", "if", "any", "login", "is", "missing", "after", "making", "the", "call", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "issues", "/", "assignees", "/", "#add", "-", "assignees", "-", "to", "-", "an", "-", "issue" ]
[ "func", "(", "c", "*", "Client", ")", "AssignIssue", "(", "org", ",", "repo", "string", ",", "number", "int", ",", "logins", "[", "]", "string", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ",", "logins", ")", "\n", "assigned", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "var", "i", "Issue", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPost", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ")", ",", "requestBody", ":", "map", "[", "string", "]", "[", "]", "string", "{", "\"", "\"", ":", "logins", "}", ",", "exitCodes", ":", "[", "]", "int", "{", "201", "}", ",", "}", ",", "&", "i", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "assignee", ":=", "range", "i", ".", "Assignees", "{", "assigned", "[", "NormLogin", "(", "assignee", ".", "Login", ")", "]", "=", "<mask>", "\n", "}", "\n", "missing", ":=", "MissingUsers", "{", "action", ":", "\"", "\"", "}", "\n", "for", "_", ",", "login", ":=", "range", "logins", "{", "if", "!", "assigned", "[", "NormLogin", "(", "login", ")", "]", "{", "missing", ".", "Users", "=", "append", "(", "missing", ".", "Users", ",", "login", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "missing", ".", "Users", ")", ">", "0", "{", "return", "missing", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,476
all-12477
[ "NewTgzWalker", "creates", "a", "new", "Walker", "instance", "that", "can", "read", "a", ".", "tgz", "stream" ]
[ "func", "NewTgzWalker", "(", "pkgReader", "<mask>", ".", "Reader", ")", "Walker", "{", "return", "tgzWalker", "{", "pkgReader", ":", "pkgReader", ",", "callbacks", ":", "make", "(", "map", "[", "*", "regexp", ".", "Regexp", "]", "WalkFunc", ")", ",", "}", "\n", "}" ]
12,477
all-12478
[ "HasDefault", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TemplateVariable", ")", "HasDefault", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Default", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
12,478
all-12479
[ "Do", "executes", "ApplicationCache", ".", "getApplicationCacheForFrame", "against", "the", "provided", "context", ".", "returns", ":", "applicationCache", "-", "Relevant", "application", "cache", "data", "for", "the", "document", "in", "given", "frame", "." ]
[ "func", "(", "p", "*", "GetApplicationCacheForFrameParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "applicationCache", "*", "ApplicationCache", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetApplicationCacheForFrameReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetApplicationCacheForFrame", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "ApplicationCache", ",", "nil", "\n", "}" ]
12,479
all-12480
[ "CreateWorksheet", "creates", "a", "new", "worksheet", "." ]
[ "func", "(", "a", "*", "API", ")", "CreateWorksheet", "(", "cfg", "*", "Worksheet", ")", "(", "*", "Worksheet", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "jsonCfg", ",", "err", ":=", "json", ".", "Marshal", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "a", ".", "Debug", "{", "a", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "string", "(", "jsonCfg", ")", ")", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "a", ".", "Post", "(", "config", ".", "WorksheetPrefix", ",", "jsonCfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "worksheet", ":=", "&", "Worksheet", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "worksheet", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "worksheet", ",", "nil", "\n", "}" ]
12,480
all-12481
[ "Register", "makes", "a", "number", "of", "Go", "values", "available", "in", "Lua", "code", "as", "proxies", ".", "values", "is", "a", "map", "of", "strings", "to", "Go", "values", ".", "-", "If", "table", "is", "non", "-", "nil", "then", "create", "or", "reuse", "a", "global", "table", "of", "that", "name", "and", "put", "the", "values", "in", "it", ".", "-", "If", "table", "is", "then", "put", "the", "values", "in", "the", "global", "table", "(", "_G", ")", ".", "-", "If", "table", "is", "*", "then", "assume", "that", "the", "table", "is", "already", "on", "the", "stack", ".", "See", "GoToLuaProxy", "s", "documentation", "." ]
[ "func", "Register", "(", "L", "*", "lua", ".", "State", ",", "table", "string", ",", "values", "Map", ")", "{", "pop", ":=", "true", "\n", "if", "table", "==", "\"", "\"", "{", "pop", "=", "<mask>", "\n", "}", "else", "if", "len", "(", "table", ")", ">", "0", "{", "L", ".", "GetGlobal", "(", "table", ")", "\n", "if", "L", ".", "IsNil", "(", "-", "1", ")", "{", "L", ".", "Pop", "(", "1", ")", "\n", "L", ".", "NewTable", "(", ")", "\n", "L", ".", "SetGlobal", "(", "table", ")", "\n", "L", ".", "GetGlobal", "(", "table", ")", "\n", "}", "\n", "}", "else", "{", "L", ".", "GetGlobal", "(", "\"", "\"", ")", "\n", "}", "\n", "for", "name", ",", "val", ":=", "range", "values", "{", "GoToLuaProxy", "(", "L", ",", "val", ")", "\n", "L", ".", "SetField", "(", "-", "2", ",", "name", ")", "\n", "}", "\n", "if", "pop", "{", "L", ".", "Pop", "(", "1", ")", "\n", "}", "\n", "}" ]
12,481
all-12482
[ "Merge", "an", "incoming", "update", "with", "our", "own", "topology", ".", "We", "add", "peers", "hitherto", "unknown", "to", "us", "and", "update", "peers", "for", "which", "the", "update", "contains", "a", "more", "recent", "version", "than", "known", "to", "us", ".", "The", "return", "value", "is", "a", ")", "a", "representation", "of", "the", "received", "update", "and", "b", ")", "an", "improved", "update", "containing", "just", "these", "new", "/", "updated", "elements", "." ]
[ "func", "(", "peers", "*", "Peers", ")", "applyUpdate", "(", "update", "[", "]", "byte", ")", "(", "peerNameSet", ",", "peerNameSet", ",", "error", ")", "{", "peers", ".", "Lock", "(", ")", "\n", "var", "pending", "peersPendingNotifications", "\n", "defer", "peers", ".", "unlockAndNotify", "(", "&", "pending", ")", "\n\n", "newPeers", ",", "decodedUpdate", ",", "decodedConns", ",", "err", ":=", "peers", ".", "decodeUpdate", "(", "update", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "// Add new peers", "for", "name", ",", "newPeer", ":=", "range", "newPeers", "{", "peers", ".", "byName", "[", "name", "]", "=", "newPeer", "\n", "peers", ".", "addByShortID", "(", "newPeer", ",", "&", "pending", ")", "\n", "}", "\n\n", "// Now apply the updates", "newUpdate", ":=", "peers", ".", "applyDecodedUpdate", "(", "decodedUpdate", ",", "decodedConns", ",", "&", "pending", ")", "\n", "peers", ".", "garbageCollect", "(", "&", "pending", ")", "\n", "for", "_", ",", "peerRemoved", ":=", "range", "pending", ".", "removed", "{", "delete", "(", "newUpdate", ",", "peerRemoved", ".", "<mask>", ")", "\n", "}", "\n\n", "updateNames", ":=", "make", "(", "peerNameSet", ")", "\n", "for", "_", ",", "peer", ":=", "range", "decodedUpdate", "{", "updateNames", "[", "peer", ".", "Name", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n\n", "return", "updateNames", ",", "newUpdate", ",", "nil", "\n", "}" ]
12,482
all-12483
[ "Reset", "will", "scan", "all", "boskos", "resources", "of", "type", "in", "state", "last", "updated", "before", "expire", "and", "set", "them", "to", "dest", "state", ".", "Returns", "a", "map", "of", "{", "resourceName", ":", "owner", "}", "for", "further", "actions", "." ]
[ "func", "(", "c", "*", "Client", ")", "Reset", "(", "rtype", ",", "state", "string", ",", "expire", "<mask>", ".", "Duration", ",", "dest", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "return", "c", ".", "reset", "(", "rtype", ",", "state", ",", "expire", ",", "dest", ")", "\n", "}" ]
12,483
all-12484
[ "CertAtuh", "is", "TLS", "client", "-", "certificate", "authentication", ".", "If", "successful", "certificate", "common", "name", "will", "stored", "with", "the", "key", "userid", "in", "session", ".", "If", "unsuccessful", "connection", "will", "be", "closed", "right", "away", "." ]
[ "func", "CertAtuh", "(", "ctx", "*", "neptulon", ".", "ReqCtx", ")", "error", "{", "if", "_", ",", "ok", ":=", "ctx", ".", "Session", ".", "GetOk", "(", "\"", "\"", ")", ";", "<mask>", "{", "return", "ctx", ".", "Next", "(", ")", "\n", "}", "\n\n", "// if provided, client certificate is verified by the TLS listener so the peerCerts list in the connection is trusted", "// connState, _ := ctx.Conn.ConnectionState()", "// certs := connState.PeerCertificates", "// if len(certs) == 0 {", "// \tlog.Println(\"Invalid client-certificate authentication attempt:\", ctx.Conn.RemoteAddr())", "// \tctx.Conn.Close()", "// \treturn nil", "// }", "//", "// userID := certs[0].Subject.CommonName", "// ctx.Session.Set(\"userid\", userID)", "// log.Printf(\"Client authenticated. TLS/IP: %v, User ID: %v, Conn ID: %v\\n\", ctx.Conn.RemoteAddr(), userID, ctx.Conn.ID)", "return", "ctx", ".", "Next", "(", ")", "\n", "}" ]
12,484
all-12485
[ "NewMeasuredReader", "wraps", "a", "reader", "." ]
[ "func", "NewMeasuredReader", "(", "r", "<mask>", ".", "Reader", ")", "*", "MeasuredReader", "{", "return", "&", "MeasuredReader", "{", "wrap", ":", "r", ",", "rate", ":", "newCounter", "(", ")", "}", "\n", "}" ]
12,485
all-12486
[ "GetRequestStatus", "retursn", "status", "of", "the", "request" ]
[ "func", "(", "c", "*", "<mask>", ")", "GetRequestStatus", "(", "path", "string", ")", "(", "*", "RequestStatus", ",", "error", ")", "{", "url", ":=", "path", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "RequestStatus", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "GetRequestStatus", "(", "url", ",", "ret", ",", "http", ".", "StatusOK", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
12,486
all-12487
[ "WithFileFindFunc", "sets", "the", "function", "that", "will", "return", "the", "file", "path", "on", "disk", "based", "on", "filename", "provided", "from", "files", "defind", "using", "WithTemplateFromFile", "or", "WithTemplateFromFiles", "." ]
[ "func", "WithFileFindFunc", "(", "fn", "func", "(", "<mask>", "string", ")", "string", ")", "Option", "{", "return", "func", "(", "o", "*", "Options", ")", "{", "o", ".", "fileFindFunc", "=", "fn", "}", "\n", "}" ]
12,487
all-12488
[ "If", "no", "profile", "is", "specified", "then", "it", "uses", "the", "default", "profile", "and", "load", "the", "config", "data", "that", "s", "marked", "as", "default", ".", "Profile", "can", "be", "set", "using", "2", "ways", ":", "1", ".", "Environment", "variable", "GC_PROFILE", "eg", ":", "export", "GC_PROFILE", "=", "dev", "2", ".", "Command", "line", "argument", "profile", "eg", ":", "go", "run", "myserver", ".", "go", "-", "profile", "=", "dev" ]
[ "func", "loadProfile", "(", ")", "string", "{", "p", ":=", "\"", "\"", "\n", "if", "len", "(", "*", "profile", ")", "==", "0", "{", "//Load application profile from environment variable", "p", "=", "<mask>", ".", "Getenv", "(", "\"", "\"", ")", "\n", "}", "else", "{", "p", "=", "*", "profile", "\n", "}", "\n", "return", "s", ".", "ToLower", "(", "p", ")", "\n", "}" ]
12,488
all-12489
[ "NodeUpdate", "updates", "the", "name", "an", "address", "of", "a", "node", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "NodeUpdate", "(", "id", "int64", ",", "name", "string", ",", "address", "string", ")", "error", "{", "result", ",", "err", ":=", "c", ".", "tx", ".", "Exec", "(", "\"", "\"", ",", "name", ",", "address", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "n", ",", "err", ":=", "result", ".", "RowsAffected", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "n", "!=", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "n", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
12,489
all-12490
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "Alert", ")", "GetName", "(", ")", "string", "{", "if", "a", "==", "nil", "||", "a", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "a", ".", "Name", "\n", "}" ]
12,490
all-12491
[ "Kind", "reports", "the", "kind", "of", "value", "underlying", "v", "." ]
[ "func", "(", "v", "Value", ")", "Kind", "(", ")", "ValueKind", "{", "switch", "v", ".", "data", ".", "(", "type", ")", "{", "default", ":", "return", "Null", "\n", "case", "bool", ":", "return", "Bool", "\n", "case", "int64", ":", "return", "Integer", "\n", "case", "float64", ":", "return", "Real", "\n", "<mask>", "string", ":", "return", "String", "\n", "case", "name", ":", "return", "Name", "\n", "case", "dict", ":", "return", "Dict", "\n", "case", "array", ":", "return", "Array", "\n", "case", "stream", ":", "return", "Stream", "\n", "}", "\n", "}" ]
12,491
all-12492
[ "hasNextEnts", "returns", "if", "there", "is", "any", "available", "entries", "for", "execution", ".", "This", "is", "a", "fast", "check", "without", "heavy", "raftLog", ".", "slice", "()", "in", "raftLog", ".", "nextEnts", "()", "." ]
[ "func", "(", "l", "*", "raftLog", ")", "hasNextEnts", "(", ")", "bool", "{", "off", ":=", "<mask>", "(", "l", ".", "applied", "+", "1", ",", "l", ".", "firstIndex", "(", ")", ")", "\n", "return", "l", ".", "committed", "+", "1", ">", "off", "\n", "}" ]
12,492
all-12493
[ "IsEV", "returns", "true", "if", "the", "input", "is", "a", "known", "Extended", "Validation", "OID", "." ]
[ "func", "IsEV", "(", "in", "[", "]", "asn1", ".", "ObjectIdentifier", ")", "bool", "{", "for", "_", ",", "oid", ":=", "range", "in", "{", "if", "_", ",", "<mask>", ":=", "evoids", "[", "oid", ".", "String", "(", ")", "]", ";", "ok", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
12,493
all-12494
[ "SafeCreateS3Bucket", "creates", "an", "s3", "bucket", "for", "storing", "files", "to", "an", "s3", "-", "compatible", "blobstore" ]
[ "func", "SafeCreateS3Bucket", "(", "domain", ",", "bucket", ",", "accessKey", ",", "secretKey", "string", ")", "(", "*", "S3Bucket", ",", "error", ")", "{", "s", ":=", "&", "S3Bucket", "{", "Bucket", ":", "bucket", ",", "<mask>", ":", "\"", "\"", ",", "Domain", ":", "domain", ",", "AccessKey", ":", "accessKey", ",", "SecretKey", ":", "secretKey", ",", "}", "\n", "if", "s", ".", "Bucket", "==", "\"", "\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "k", "s3gof3r", ".", "Keys", "\n", "var", "err", "error", "\n\n", "if", "s", ".", "AccessKey", "==", "\"", "\"", "||", "s", ".", "SecretKey", "==", "\"", "\"", "{", "k", ",", "err", "=", "s3gof3r", ".", "EnvKeys", "(", ")", "// get S3 keys from environment", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "{", "k", "=", "s3gof3r", ".", "Keys", "{", "AccessKey", ":", "s", ".", "AccessKey", ",", "SecretKey", ":", "s", ".", "SecretKey", ",", "}", "\n", "}", "\n", "s3", ":=", "s3gof3r", ".", "New", "(", "s", ".", "Domain", ",", "k", ")", "\n", "s", ".", "bucket", "=", "s3", ".", "Bucket", "(", "s", ".", "Bucket", ")", "\n", "return", "s", ",", "nil", "\n", "}" ]
12,494
all-12495
[ "Deletes", "references", "to", "a", "document", "from", "its", "related", "documents" ]
[ "func", "CascadeDelete", "(", "collection", "*", "Collection", ",", "doc", "interface", "{", "}", ")", "{", "// Find out which properties to cascade", "if", "conv", ",", "ok", ":=", "doc", ".", "(", "interface", "{", "GetCascade", "(", "*", "Collection", ")", "[", "]", "*", "CascadeConfig", "\n", "}", ")", ";", "ok", "{", "toCascade", ":=", "conv", ".", "GetCascade", "(", "collection", ")", "\n\n", "// Get the ID", "for", "_", ",", "conf", ":=", "range", "toCascade", "{", "if", "len", "(", "conf", ".", "ReferenceQuery", ")", "==", "0", "{", "id", ",", "err", ":=", "reflections", ".", "GetField", "(", "doc", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "conf", ".", "ReferenceQuery", "=", "[", "]", "*", "ReferenceField", "{", "&", "ReferenceField", "{", "\"", "\"", ",", "<mask>", "}", "}", "\n", "}", "\n\n", "cascadeDeleteWithConfig", "(", "conf", ")", "\n\n", "}", "\n\n", "}", "\n", "}" ]
12,495
all-12496
[ "CreateContainerSnapshot", "requests", "that", "LXD", "creates", "a", "new", "snapshot", "for", "the", "container" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "CreateContainerSnapshot", "(", "containerName", "string", ",", "snapshot", "api", ".", "ContainerSnapshotsPost", ")", "(", "Operation", ",", "error", ")", "{", "// Validate the request", "if", "snapshot", ".", "ExpiresAt", "!=", "nil", "&&", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Send the request", "op", ",", "_", ",", "err", ":=", "r", ".", "queryOperation", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "QueryEscape", "(", "containerName", ")", ")", ",", "snapshot", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "op", ",", "nil", "\n", "}" ]
12,496
all-12497
[ "Close", "the", "connection", "to", "gRPC" ]
[ "func", "(", "c", "*", "APIClient", ")", "Close", "(", ")", "error", "{", "if", "err", ":=", "c", ".", "clientConn", ".", "Close", "(", ")", ";", "<mask>", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "c", ".", "portForwarder", "!=", "nil", "{", "c", ".", "portForwarder", ".", "Close", "(", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
12,497
all-12498
[ "Manifest", "overrides", "the", "UnparsedImage", ".", "Manifest", "to", "always", "use", "the", "fields", "which", "we", "have", "already", "fetched", "." ]
[ "func", "(", "i", "*", "sourcedImage", ")", "Manifest", "(", "ctx", "context", ".", "<mask>", ")", "(", "[", "]", "byte", ",", "string", ",", "error", ")", "{", "return", "i", ".", "manifestBlob", ",", "i", ".", "manifestMIMEType", ",", "nil", "\n", "}" ]
12,498
all-12499
[ "dockerStatsToContainerStats", "returns", "a", "new", "object", "of", "the", "ContainerStats", "object", "from", "docker", "stats", "." ]
[ "func", "dockerStatsToContainerStats", "(", "dockerStats", "*", "<mask>", ".", "StatsJSON", ")", "(", "*", "ContainerStats", ",", "error", ")", "{", "// The length of PercpuUsage represents the number of cores in an instance.", "if", "len", "(", "dockerStats", ".", "CPUStats", ".", "CPUUsage", ".", "PercpuUsage", ")", "==", "0", "||", "numCores", "==", "uint64", "(", "0", ")", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "cpuUsage", ":=", "dockerStats", ".", "CPUStats", ".", "CPUUsage", ".", "TotalUsage", "/", "numCores", "\n", "memoryUsage", ":=", "dockerStats", ".", "MemoryStats", ".", "Usage", "-", "dockerStats", ".", "MemoryStats", ".", "Stats", "[", "\"", "\"", "]", "\n", "return", "&", "ContainerStats", "{", "cpuUsage", ":", "cpuUsage", ",", "memoryUsage", ":", "memoryUsage", ",", "timestamp", ":", "dockerStats", ".", "Read", ",", "}", ",", "nil", "\n", "}" ]
12,499
all-12500
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform3i", "(", "program", "uint32", ",", "location", "int32", ",", "v0", "int32", ",", "v1", "int32", ",", "v2", "int32", ")", "{", "C", ".", "glowProgramUniform3i", "(", "gpProgramUniform3i", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLint", ")", "(", "v0", ")", ",", "(", "C", ".", "GLint", ")", "(", "v1", ")", ",", "(", "C", ".", "GLint", ")", "(", "v2", ")", ")", "\n", "}" ]