id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
24,700
all-24701
[ "Do", "executes", "Emulation", ".", "setDefaultBackgroundColorOverride", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetDefaultBackgroundColorOverrideParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetDefaultBackgroundColorOverride", ",", "p", ",", "nil", ")", "\n", "}" ]
24,701
all-24702
[ "StatusString", "returns", "a", "human", "readable", "string", "representation", "of", "this", "object" ]
[ "func", "(", "vs", "VolumeStatus", ")", "String", "(", ")", "string", "{", "for", "k", ",", "v", ":=", "range", "resourceStatusMap", "{", "if", "v", "==", "<mask>", "{", "return", "k", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
24,702
all-24703
[ "InStroke", "is", "a", "wrapper", "around", "cairo_in_stroke", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "InStroke", "(", "x", ",", "y", "float64", ")", "bool", "{", "c", ":=", "C", ".", "cairo_in_stroke", "(", "v", ".", "native", "(", ")", ",", "C", ".", "double", "(", "x", ")", ",", "C", ".", "double", "(", "y", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
24,703
all-24704
[ "ReadMessage", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockWebsocketConn", ")", "ReadMessage", "(", ")", "(", "int", ",", "[", "]", "byte", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "int", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "[", "]", "byte", ")", "\n", "ret2", ",", "_", ":=", "<mask>", "[", "2", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", ",", "ret2", "\n", "}" ]
24,704
all-24705
[ "Write", "rolls", "through", "the", "data", "written", "calling", "c", ".", "f", "when", "a", "chunk", "is", "found", ".", "Note", ":", "If", "making", "changes", "to", "this", "function", "be", "wary", "of", "the", "performance", "implications", "(", "check", "before", "and", "after", "performance", "with", "chunker", "benchmarks", ")", "." ]
[ "func", "(", "w", "*", "Writer", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "offset", ":=", "0", "\n", "size", ":=", "w", ".", "buf", ".", "Len", "(", ")", "\n", "for", "i", ",", "b", ":=", "range", "data", "{", "size", "++", "\n", "w", ".", "hash", ".", "Roll", "(", "b", ")", "\n", "if", "w", ".", "<mask>", ".", "Sum64", "(", ")", "&", "w", ".", "splitMask", "==", "0", "{", "w", ".", "buf", ".", "Write", "(", "data", "[", "offset", ":", "i", "+", "1", "]", ")", "\n", "if", "err", ":=", "w", ".", "put", "(", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "w", ".", "buf", ".", "Reset", "(", ")", "\n", "offset", "=", "i", "+", "1", "\n", "size", "=", "0", "\n", "}", "\n", "}", "\n", "w", ".", "buf", ".", "Write", "(", "data", "[", "offset", ":", "]", ")", "\n", "w", ".", "rangeSize", "+=", "int64", "(", "len", "(", "data", ")", ")", "\n", "return", "len", "(", "data", ")", ",", "nil", "\n", "}" ]
24,705
all-24706
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetStyleTextsReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,706
all-24707
[ "By", "adds", "a", "sort", "key", "to", "sort", "by", "the", "output", "of", "the", "specified", "less", "function", "." ]
[ "func", "(", "s", "*", "SortFilter", ")", "By", "(", "less", "func", "(", "a", ",", "b", "string", ")", "bool", ")", "*", "SortFilter", "{", "s", ".", "<mask>", "(", "func", "(", "a", ",", "b", "string", ")", "int", "{", "if", "less", "(", "a", ",", "b", ")", "{", "return", "-", "1", "\n", "}", "\n", "if", "less", "(", "b", ",", "a", ")", "{", "return", "+", "1", "\n", "}", "\n", "return", "0", "\n", "}", ")", "\n", "return", "s", "\n", "}" ]
24,707
all-24708
[ "GetLevel", "returns", "the", "highest", "level", "enabled", "by", "all", "backends", "." ]
[ "func", "(", "b", "*", "multiLogger", ")", "GetLevel", "(", "module", "string", ")", "Level", "{", "var", "<mask>", "Level", "\n", "for", "_", ",", "backend", ":=", "range", "b", ".", "backends", "{", "if", "backendLevel", ":=", "backend", ".", "GetLevel", "(", "module", ")", ";", "backendLevel", ">", "level", "{", "level", "=", "backendLevel", "\n", "}", "\n", "}", "\n", "return", "level", "\n", "}" ]
24,708
all-24709
[ "GetTrustLine", "retrieves", "the", "TrustLine", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "LedgerKey", ")", "GetTrustLine", "(", ")", "(", "result", "LedgerKeyTrustLine", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "<mask>", "=", "*", "u", ".", "TrustLine", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
24,709
all-24710
[ "Add", "a", "new", "network", "link", "of", "a", "specified", "type", ".", "This", "is", "identical", "to", "running", ":", "ip", "link", "add", "$name", "type", "$linkType" ]
[ "func", "NetworkLinkAdd", "(", "name", "string", ",", "linkType", "string", ")", "error", "{", "if", "name", "==", "\"", "\"", "||", "linkType", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "s", ",", "err", ":=", "getNetlinkSocket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "s", ".", "Close", "(", ")", "\n\n", "wb", ":=", "newNetlinkRequest", "(", "syscall", ".", "RTM_NEWLINK", ",", "syscall", ".", "NLM_F_CREATE", "|", "syscall", ".", "NLM_F_EXCL", "|", "syscall", ".", "NLM_F_ACK", ")", "\n\n", "msg", ":=", "newIfInfomsg", "(", "syscall", ".", "AF_UNSPEC", ")", "\n", "wb", ".", "AddData", "(", "<mask>", ")", "\n\n", "linkInfo", ":=", "newRtAttr", "(", "syscall", ".", "IFLA_LINKINFO", ",", "nil", ")", "\n", "newRtAttrChild", "(", "linkInfo", ",", "IFLA_INFO_KIND", ",", "nonZeroTerminated", "(", "linkType", ")", ")", "\n", "wb", ".", "AddData", "(", "linkInfo", ")", "\n\n", "nameData", ":=", "newRtAttr", "(", "syscall", ".", "IFLA_IFNAME", ",", "zeroTerminated", "(", "name", ")", ")", "\n", "wb", ".", "AddData", "(", "nameData", ")", "\n\n", "if", "err", ":=", "s", ".", "Send", "(", "wb", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "s", ".", "HandleAck", "(", "wb", ".", "Seq", ")", "\n", "}" ]
24,710
all-24711
[ "GetAPIKeys", "returns", "all", "API", "keys", "or", "error", "on", "failure" ]
[ "func", "(", "<mask>", "*", "Client", ")", "GetAPIKeys", "(", ")", "(", "[", "]", "APIKey", ",", "error", ")", "{", "var", "out", "reqAPIKeys", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "out", ".", "APIKeys", ",", "nil", "\n", "}" ]
24,711
all-24712
[ "Update", "updates", "the", "tile", "s", "animation", "states", "." ]
[ "func", "(", "t", "*", "Tile", ")", "Update", "(", ")", "error", "{", "switch", "{", "case", "0", "<", "t", ".", "movingCount", ":", "t", ".", "movingCount", "--", "\n", "if", "t", ".", "movingCount", "==", "0", "{", "if", "t", ".", "current", ".", "value", "!=", "t", ".", "next", ".", "value", "&&", "0", "<", "t", ".", "next", ".", "<mask>", "{", "t", ".", "poppingCount", "=", "maxPoppingCount", "\n", "}", "\n", "t", ".", "current", "=", "t", ".", "next", "\n", "t", ".", "next", "=", "TileData", "{", "}", "\n", "}", "\n", "case", "0", "<", "t", ".", "startPoppingCount", ":", "t", ".", "startPoppingCount", "--", "\n", "case", "0", "<", "t", ".", "poppingCount", ":", "t", ".", "poppingCount", "--", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,712
all-24713
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "f", "*", "FreeTextDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "f", "!=", "nil", "&&", "f", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,713
all-24714
[ "SendLinkCardMsg", "发送链接消息" ]
[ "func", "(", "w", "*", "Webhook", ")", "SendLinkCardMsg", "(", "msgs", "[", "]", "LinkMsg", ")", "<mask>", "{", "return", "w", ".", "SendPayload", "(", "&", "Payload", "{", "MsgType", ":", "\"", "\"", ",", "FeedCard", ":", "struct", "{", "Links", "[", "]", "LinkMsg", "`json:\"links\"`", "\n", "}", "{", "Links", ":", "msgs", ",", "}", ",", "}", ")", "\n", "}" ]
24,714
all-24715
[ "GetComments", "is", "a", "wrapper", "around", "gtk_about_dialog_get_comments", "()", "." ]
[ "func", "(", "v", "*", "AboutDialog", ")", "GetComments", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_about_dialog_get_comments", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
24,715
all-24716
[ "OnClosedContext", "derives", "a", "context", "from", "a", "given", "goprocess", "that", "will", "be", "Done", "when", "the", "process", "is", "closed" ]
[ "func", "OnClosedContext", "(", "p", "goprocess", ".", "Process", ")", "<mask>", ".", "Context", "{", "return", "&", "procContext", "{", "done", ":", "p", ".", "Closed", "(", ")", ",", "which", ":", "closed", ",", "}", "\n", "}" ]
24,716
all-24717
[ "refresh", "reads", "all", "files", "matching", "the", "discovery", "s", "patterns", "and", "sends", "the", "respective", "updated", "target", "groups", "through", "the", "channel", "." ]
[ "func", "(", "d", "*", "Discovery", ")", "refresh", "(", "ctx", "context", ".", "Context", ",", "ch", "chan", "<-", "[", "]", "*", "targetgroup", ".", "Group", ")", "{", "t0", ":=", "time", ".", "Now", "(", ")", "\n", "defer", "func", "(", ")", "{", "fileSDScanDuration", ".", "Observe", "(", "time", ".", "Since", "(", "t0", ")", ".", "Seconds", "(", ")", ")", "\n", "}", "(", ")", "\n", "ref", ":=", "map", "[", "string", "]", "int", "{", "}", "\n", "for", "_", ",", "p", ":=", "range", "d", ".", "listFiles", "(", ")", "{", "tgroups", ",", "err", ":=", "d", ".", "readFile", "(", "p", ")", "\n", "if", "err", "!=", "nil", "{", "fileSDReadErrorsCount", ".", "Inc", "(", ")", "\n\n", "level", ".", "Error", "(", "d", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "p", ",", "\"", "\"", ",", "err", ")", "\n", "// Prevent deletion down below.", "ref", "[", "p", "]", "=", "d", ".", "lastRefresh", "[", "p", "]", "\n", "continue", "\n", "}", "\n", "select", "{", "case", "ch", "<-", "tgroups", ":", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n\n", "ref", "[", "p", "]", "=", "len", "(", "tgroups", ")", "\n", "}", "\n", "// Send empty updates for sources that disappeared.", "for", "f", ",", "n", ":=", "range", "d", ".", "lastRefresh", "{", "m", ",", "ok", ":=", "ref", "[", "f", "]", "\n", "if", "!", "ok", "||", "n", ">", "m", "{", "level", ".", "Debug", "(", "d", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "f", ")", "\n", "d", ".", "deleteTimestamp", "(", "f", ")", "\n", "for", "i", ":=", "m", ";", "i", "<", "n", ";", "i", "++", "{", "<mask>", "{", "case", "ch", "<-", "[", "]", "*", "targetgroup", ".", "Group", "{", "{", "Source", ":", "fileSource", "(", "f", ",", "i", ")", "}", "}", ":", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "d", ".", "lastRefresh", "=", "ref", "\n\n", "d", ".", "watchFiles", "(", ")", "\n", "}" ]
24,717
all-24718
[ "ScheduledReportLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ScheduledReportLocator", "(", "href", "<mask>", ")", "*", "ScheduledReportLocator", "{", "return", "&", "ScheduledReportLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
24,718
all-24719
[ "Load", "loads", "the", "cedar", "from", "an", "io", ".", "Writer", "where", "dataType", "is", "either", "json", "or", "gob", "." ]
[ "func", "(", "da", "*", "Cedar", ")", "Load", "(", "in", "io", ".", "Reader", ",", "dataType", "string", ")", "error", "{", "switch", "dataType", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "dataDecoder", ":=", "gob", ".", "NewDecoder", "(", "in", ")", "\n", "return", "dataDecoder", ".", "Decode", "(", "da", ".", "cedar", ")", "\n", "case", "\"", "\"", ",", "\"", "\"", ":", "dataDecoder", ":=", "json", ".", "NewDecoder", "(", "<mask>", ")", "\n", "return", "dataDecoder", ".", "Decode", "(", "da", ".", "cedar", ")", "\n", "}", "\n", "return", "ErrInvalidDataType", "\n", "}" ]
24,719
all-24720
[ "Sync", "looks", "for", "newly", "made", "gerrit", "changes", "and", "creates", "prowjobs", "according", "to", "specs" ]
[ "func", "(", "c", "*", "Controller", ")", "Sync", "(", ")", "error", "{", "syncTime", ":=", "c", ".", "lastUpdate", "\n\n", "for", "instance", ",", "changes", ":=", "range", "c", ".", "gc", ".", "QueryChanges", "(", "c", ".", "lastUpdate", ",", "c", ".", "config", "(", ")", ".", "Gerrit", ".", "RateLimit", ")", "{", "for", "_", ",", "change", ":=", "range", "changes", "{", "if", "err", ":=", "c", ".", "ProcessChange", "(", "instance", ",", "change", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "change", ".", "CurrentRevision", ")", "\n", "}", "\n", "if", "syncTime", ".", "Before", "(", "<mask>", ".", "Updated", ".", "Time", ")", "{", "syncTime", "=", "change", ".", "Updated", ".", "Time", "\n", "}", "\n", "}", "\n\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "len", "(", "changes", ")", ",", "instance", ")", "\n", "}", "\n\n", "c", ".", "lastUpdate", "=", "syncTime", "\n", "if", "err", ":=", "c", ".", "SaveLastSync", "(", "syncTime", ")", ";", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "syncTime", ",", "c", ".", "lastSyncFallback", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
24,720
all-24721
[ "newFilteredRecords", "returns", "a", "collection", "of", "RecordSets", "based", "on", "the", "given", "endpoints", "and", "domainFilter", "." ]
[ "func", "(", "p", "*", "GoogleProvider", ")", "newFilteredRecords", "(", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", ")", "[", "]", "*", "dns", ".", "ResourceRecordSet", "{", "records", ":=", "[", "]", "*", "dns", ".", "ResourceRecordSet", "{", "}", "\n\n", "for", "_", ",", "endpoint", ":=", "<mask>", "endpoints", "{", "if", "p", ".", "domainFilter", ".", "Match", "(", "endpoint", ".", "DNSName", ")", "{", "records", "=", "append", "(", "records", ",", "newRecord", "(", "endpoint", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "records", "\n", "}" ]
24,721
all-24722
[ "GetURL", "returns", "a", "Docker", "compatible", "host", "URL", "for", "connecting", "to", "this", "host", "e", ".", "g", ".", "tcp", ":", "//", "1", ".", "2", ".", "3", ".", "4", ":", "2376" ]
[ "func", "(", "d", "*", "SerialDriver", ")", "GetURL", "(", ")", "(", "string", ",", "<mask>", ")", "{", "d", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "Unlock", "(", ")", "\n", "return", "d", ".", "Driver", ".", "GetURL", "(", ")", "\n", "}" ]
24,722
all-24723
[ "Relay", "all", "pending", "gossip", "data", "for", "each", "channel", "via", "random", "neighbours", "." ]
[ "func", "(", "router", "*", "Router", ")", "sendAllGossip", "(", ")", "{", "for", "channel", ":=", "range", "router", ".", "gossipChannelSet", "(", ")", "{", "if", "gossip", ":=", "channel", ".", "gossiper", ".", "Gossip", "(", ")", ";", "gossip", "!=", "nil", "{", "<mask>", ".", "Send", "(", "gossip", ")", "\n", "}", "\n", "}", "\n", "}" ]
24,723
all-24724
[ "AddRule", "adds", "a", "rule", "r", "to", "the", "index", ".", "The", "rule", "will", "only", "be", "indexed", "if", "there", "is", "a", "known", "resolver", "for", "the", "rule", "s", "kind", "and", "Resolver", ".", "Imports", "returns", "a", "non", "-", "nil", "slice", ".", "AddRule", "may", "only", "be", "called", "before", "Finish", "." ]
[ "func", "(", "ix", "*", "RuleIndex", ")", "AddRule", "(", "c", "*", "config", ".", "Config", ",", "r", "*", "rule", ".", "Rule", ",", "f", "*", "rule", ".", "File", ")", "{", "var", "imps", "[", "]", "ImportSpec", "\n", "if", "rslv", ":=", "ix", ".", "mrslv", "(", "r", ",", "f", ".", "Pkg", ")", ";", "rslv", "!=", "nil", "{", "imps", "=", "rslv", ".", "Imports", "(", "c", ",", "r", ",", "f", ")", "\n", "}", "\n", "// If imps == nil, the rule is not importable. If imps is the empty slice,", "// it may still be importable if it embeds importable libraries.", "if", "imps", "==", "nil", "{", "return", "\n", "}", "\n\n", "record", ":=", "&", "ruleRecord", "{", "rule", ":", "r", ",", "label", ":", "label", ".", "New", "(", "c", ".", "RepoName", ",", "f", ".", "Pkg", ",", "r", ".", "<mask>", "(", ")", ")", ",", "file", ":", "f", ",", "importedAs", ":", "imps", ",", "}", "\n", "if", "_", ",", "ok", ":=", "ix", ".", "labelMap", "[", "record", ".", "label", "]", ";", "ok", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "record", ".", "label", ")", "\n", "return", "\n", "}", "\n", "ix", ".", "rules", "=", "append", "(", "ix", ".", "rules", ",", "record", ")", "\n", "ix", ".", "labelMap", "[", "record", ".", "label", "]", "=", "record", "\n", "}" ]
24,724
all-24725
[ "AddBoshIOResource", "bosh", "io", "specific", "resource", "add" ]
[ "func", "(", "s", "*", "ConcoursePipeline", ")", "AddBoshIOResource", "(", "name", "string", ",", "source", "map", "[", "string", "]", "interface", "{", "}", ")", "{", "s", ".", "AddResource", "(", "<mask>", ",", "BoshIOResourceName", ",", "source", ")", "\n", "}" ]
24,725
all-24726
[ "Init", "initializes", "the", "Firebase", "client", "with", "a", "given", "root", "url", "and", "optional", "auth", "token", ".", "The", "initialization", "can", "also", "pass", "a", "mock", "api", "for", "testing", "purposes", "." ]
[ "func", "(", "c", "*", "Client", ")", "Init", "(", "root", ",", "auth", "string", ",", "api", "Api", ")", "{", "if", "api", "==", "nil", "{", "api", "=", "<mask>", "(", "f", ")", "\n", "}", "\n\n", "c", ".", "api", "=", "api", "\n", "c", ".", "Url", "=", "root", "\n", "c", ".", "Auth", "=", "auth", "\n", "}" ]
24,726
all-24727
[ "This", "is", "based", "on", "the", "standard", "library", "s", "fnv32a", "implementation", ".", "We", "copy", "it", "for", "a", "couple", "of", "reasons", ":", "1", ".", "Avoid", "allocations", "to", "create", "a", "hash", ".", "Hash32", "2", ".", "Avoid", "converting", "the", "[]", "byte", "to", "a", "string", "(", "another", "allocation", ")", "since", "the", "Hash32", "interface", "only", "supports", "writing", "bytes", "." ]
[ "func", "fnv32a", "(", "s", "string", ")", "uint32", "{", "const", "(", "initial", "=", "2166136261", "\n", "prime", "=", "16777619", "\n", ")", "\n\n", "hash", ":=", "uint32", "(", "initial", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "s", ")", ";", "i", "++", "{", "hash", "^=", "uint32", "(", "s", "[", "i", "]", ")", "\n", "hash", "*=", "prime", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
24,727
all-24728
[ "Handle", "satisfies", "hookHandler", "." ]
[ "func", "(", "g", "GitlabHook", ")", "Handle", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "repo", "*", "Repo", ")", "(", "int", ",", "error", ")", "{", "if", "r", ".", "Method", "!=", "\"", "\"", "{", "return", "http", ".", "StatusMethodNotAllowed", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "body", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "r", ".", "Body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "http", ".", "StatusRequestTimeout", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "err", "=", "g", ".", "handleToken", "(", "r", ",", "body", ",", "repo", ".", "Hook", ".", "Secret", ")", "\n", "if", "err", "!=", "nil", "{", "return", "http", ".", "StatusBadRequest", ",", "err", "\n", "}", "\n\n", "event", ":=", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "event", "==", "\"", "\"", "{", "return", "http", ".", "StatusBadRequest", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "switch", "event", "{", "case", "\"", "\"", ":", "err", "=", "g", ".", "handlePush", "(", "body", ",", "repo", ")", "\n", "if", "!", "hookIgnored", "(", "err", ")", "&&", "err", "!=", "nil", "{", "return", "http", ".", "StatusBadRequest", ",", "err", "\n", "}", "\n\n", "// return 400 if we do not handle the event type.", "default", ":", "return", "http", ".", "StatusBadRequest", ",", "nil", "\n", "}", "\n\n", "return", "http", ".", "StatusOK", ",", "err", "\n", "}" ]
24,728
all-24729
[ "ListPullRequestComments", "returns", "all", "*", "review", "*", "comments", "on", "a", "pull", "request", ".", "Multiple", "-", "pages", "of", "comments", "consumes", "multiple", "API", "tokens", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "pulls", "/", "comments", "/", "#list", "-", "comments", "-", "on", "-", "a", "-", "pull", "-", "request" ]
[ "func", "(", "c", "*", "Client", ")", "ListPullRequestComments", "(", "org", ",", "repo", "string", ",", "number", "int", ")", "(", "[", "]", "ReviewComment", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ")", "\n", "if", "c", ".", "fake", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "number", ")", "\n", "var", "comments", "[", "]", "ReviewComment", "\n", "err", ":=", "c", ".", "readPaginatedResults", "(", "path", ",", "acceptNone", ",", "func", "(", ")", "interface", "{", "}", "{", "return", "&", "[", "]", "ReviewComment", "{", "}", "\n", "}", ",", "func", "(", "obj", "<mask>", "{", "}", ")", "{", "comments", "=", "append", "(", "comments", ",", "*", "(", "obj", ".", "(", "*", "[", "]", "ReviewComment", ")", ")", "...", ")", "\n", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "comments", ",", "nil", "\n", "}" ]
24,729
all-24730
[ "NewDB", "creates", "a", "new", "data", "connection", "handle", "." ]
[ "func", "NewDB", "(", "conf", "*", "DBConfig", ")", "(", "*", "reform", ".", "DB", ",", "error", ")", "{", "conn", ",", "err", ":=", "dbConnect", "(", "conf", ".", "ConnStr", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "conn", ".", "SetMaxOpenConns", "(", "conf", ".", "MaxOpen", ")", "\n", "conn", ".", "SetMaxIdleConns", "(", "conf", ".", "MaxIddle", ")", "\n", "return", "newReform", "(", "<mask>", ")", ",", "nil", "\n", "}" ]
24,730
all-24731
[ "ComputeWIF", "returns", "the", "privKey", "in", "Wallet", "Import", "Format", "." ]
[ "func", "ComputeWIF", "(", "privKey", "<mask>", ",", "compress", "bool", ")", "string", "{", "return", "WIFFromPrivKeyBytes", "(", "HexDecode", "(", "privKey", ")", ",", "compress", ")", "\n", "}" ]
24,731
all-24732
[ "OCIConfig", "returns", "the", "image", "configuration", "as", "per", "OCI", "v1", "image", "-", "spec", ".", "Information", "about", "layers", "in", "the", "resulting", "configuration", "isn", "t", "guaranteed", "to", "be", "returned", "to", "due", "how", "old", "image", "manifests", "work", "(", "docker", "v2s1", "especially", ")", "." ]
[ "func", "(", "m", "*", "manifestOCI1", ")", "OCIConfig", "(", "ctx", "context", ".", "<mask>", ")", "(", "*", "imgspecv1", ".", "Image", ",", "error", ")", "{", "cb", ",", "err", ":=", "m", ".", "ConfigBlob", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "configOCI", ":=", "&", "imgspecv1", ".", "Image", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "cb", ",", "configOCI", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "configOCI", ",", "nil", "\n", "}" ]
24,732
all-24733
[ "NewRelay", "constructs", "a", "new", "relay", "." ]
[ "func", "NewRelay", "(", "ctx", "context", ".", "Context", ",", "h", "host", ".", "Host", ",", "upgrader", "*", "tptu", ".", "Upgrader", ",", "opts", "...", "RelayOpt", ")", "(", "*", "Relay", ",", "error", ")", "{", "r", ":=", "&", "Relay", "{", "upgrader", ":", "upgrader", ",", "host", ":", "h", ",", "ctx", ":", "ctx", ",", "self", ":", "h", ".", "ID", "(", ")", ",", "incoming", ":", "make", "(", "chan", "*", "Conn", ")", ",", "relays", ":", "make", "(", "map", "[", "peer", ".", "ID", "]", "struct", "{", "}", ")", ",", "liveHops", ":", "make", "(", "map", "[", "peer", ".", "ID", "]", "map", "[", "peer", ".", "ID", "]", "int", ")", ",", "}", "\n\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "switch", "opt", "{", "case", "OptActive", ":", "r", ".", "active", "=", "true", "\n", "case", "OptHop", ":", "r", ".", "hop", "=", "<mask>", "\n", "case", "OptDiscovery", ":", "r", ".", "discovery", "=", "true", "\n", "default", ":", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "opt", ")", "\n", "}", "\n", "}", "\n\n", "h", ".", "SetStreamHandler", "(", "ProtoID", ",", "r", ".", "handleNewStream", ")", "\n\n", "if", "r", ".", "discovery", "{", "h", ".", "Network", "(", ")", ".", "Notify", "(", "r", ".", "notifiee", "(", ")", ")", "\n", "}", "\n\n", "return", "r", ",", "nil", "\n", "}" ]
24,733
all-24734
[ "Dial", "connects", "to", "a", "single", "endpoint", "using", "the", "client", "s", "config", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "Dial", "(", "ep", "string", ")", "(", "*", "grpc", ".", "ClientConn", ",", "error", ")", "{", "creds", ":=", "c", ".", "directDialCreds", "(", "ep", ")", "\n", "// Use the grpc passthrough resolver to directly dial a single endpoint.", "// This resolver passes through the 'unix' and 'unixs' endpoints schemes used", "// by etcd without modification, allowing us to directly dial endpoints and", "// using the same dial functions that we use for load balancer dialing.", "return", "c", ".", "dial", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "ep", ")", ",", "creds", ")", "\n", "}" ]
24,734
all-24735
[ "Layout", ".", "GetSize", "is", "a", "wrapper", "around", "gtk_layout_get_size" ]
[ "func", "(", "v", "*", "Layout", ")", "GetSize", "(", ")", "(", "width", ",", "<mask>", "uint", ")", "{", "var", "w", ",", "h", "C", ".", "guint", "\n", "C", ".", "gtk_layout_get_size", "(", "v", ".", "native", "(", ")", ",", "&", "w", ",", "&", "h", ")", "\n", "return", "uint", "(", "w", ")", ",", "uint", "(", "h", ")", "\n", "}" ]
24,735
all-24736
[ "Do", "executes", "ServiceWorker", ".", "inspectWorker", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "InspectWorkerParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandInspectWorker", ",", "p", ",", "nil", ")", "\n", "}" ]
24,736
all-24737
[ "GetPaperWidth", "()", "is", "a", "wrapper", "around", "gtk_page_setup_get_paper_width", "()", "." ]
[ "func", "(", "ps", "*", "PageSetup", ")", "GetPaperWidth", "(", "<mask>", "Unit", ")", "float64", "{", "c", ":=", "C", ".", "gtk_page_setup_get_paper_width", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "GtkUnit", "(", "unit", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
24,737
all-24738
[ "breaks", "lines", "into", "important", "/", "unimportant", "groups" ]
[ "func", "groupLines", "(", "logLines", "[", "]", "LogLine", ")", "[", "]", "LineGroup", "{", "// show highlighted lines and their neighboring lines", "for", "i", ",", "line", ":=", "range", "logLines", "{", "if", "line", ".", "Highlighted", "{", "for", "d", ":=", "-", "neighborLines", ";", "d", "<=", "neighborLines", ";", "d", "++", "{", "if", "i", "+", "d", "<", "0", "{", "continue", "\n", "}", "\n", "if", "i", "+", "d", ">=", "len", "(", "logLines", ")", "{", "break", "\n", "}", "\n", "logLines", "[", "i", "+", "d", "]", ".", "Skip", "=", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "// break into groups", "currentOffset", ":=", "0", "\n", "previousOffset", ":=", "0", "\n", "var", "lineGroups", "[", "]", "LineGroup", "\n", "curGroup", ":=", "LineGroup", "{", "}", "\n", "for", "i", ",", "<mask>", ":=", "range", "logLines", "{", "if", "line", ".", "Skip", "==", "curGroup", ".", "Skip", "{", "curGroup", ".", "LogLines", "=", "append", "(", "curGroup", ".", "LogLines", ",", "line", ")", "\n", "currentOffset", "+=", "line", ".", "Length", "\n", "}", "else", "{", "curGroup", ".", "End", "=", "i", "\n", "curGroup", ".", "ByteLength", "=", "currentOffset", "-", "previousOffset", "-", "1", "// -1 for trailing newline", "\n", "previousOffset", "=", "currentOffset", "\n", "if", "curGroup", ".", "Skip", "{", "if", "curGroup", ".", "LinesSkipped", "(", ")", "<", "minLinesSkipped", "{", "curGroup", ".", "Skip", "=", "false", "\n", "}", "\n", "}", "\n", "if", "len", "(", "curGroup", ".", "LogLines", ")", ">", "0", "{", "lineGroups", "=", "append", "(", "lineGroups", ",", "curGroup", ")", "\n", "}", "\n", "curGroup", "=", "LineGroup", "{", "Skip", ":", "line", ".", "Skip", ",", "Start", ":", "i", ",", "LogLines", ":", "[", "]", "LogLine", "{", "line", "}", ",", "ByteOffset", ":", "currentOffset", ",", "}", "\n", "currentOffset", "+=", "line", ".", "Length", "\n", "}", "\n", "}", "\n", "curGroup", ".", "End", "=", "len", "(", "logLines", ")", "\n", "curGroup", ".", "ByteLength", "=", "currentOffset", "-", "previousOffset", "-", "1", "\n", "if", "curGroup", ".", "Skip", "{", "if", "curGroup", ".", "LinesSkipped", "(", ")", "<", "minLinesSkipped", "{", "curGroup", ".", "Skip", "=", "false", "\n", "}", "\n", "}", "\n", "if", "len", "(", "curGroup", ".", "LogLines", ")", ">", "0", "{", "lineGroups", "=", "append", "(", "lineGroups", ",", "curGroup", ")", "\n", "}", "\n", "return", "lineGroups", "\n", "}" ]
24,738
all-24739
[ "Repaint", "draws", "the", "control", "on", "its", "View", "surface" ]
[ "func", "(", "l", "*", "TableView", ")", "Draw", "(", ")", "{", "if", "l", ".", "<mask>", "{", "return", "\n", "}", "\n\n", "l", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "l", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "PushAttributes", "(", ")", "\n", "defer", "PopAttributes", "(", ")", "\n\n", "x", ",", "y", ":=", "l", ".", "Pos", "(", ")", "\n", "w", ",", "h", ":=", "l", ".", "Size", "(", ")", "\n\n", "if", "l", ".", "onBeforeDraw", "!=", "nil", "{", "firstCol", ",", "firstRow", ",", "colCount", ",", "rowCount", ":=", "l", ".", "VisibleArea", "(", ")", "\n", "l", ".", "onBeforeDraw", "(", "firstCol", ",", "firstRow", ",", "colCount", ",", "rowCount", ")", "\n", "}", "\n\n", "bg", ":=", "RealColor", "(", "l", ".", "bg", ",", "l", ".", "Style", "(", ")", ",", "ColorTableBack", ")", "\n", "SetBackColor", "(", "bg", ")", "\n", "FillRect", "(", "x", ",", "y", "+", "2", ",", "w", ",", "h", "-", "2", ",", "' '", ")", "\n", "l", ".", "drawHeader", "(", ")", "\n", "l", ".", "drawScroll", "(", ")", "\n", "l", ".", "drawCells", "(", ")", "\n", "}" ]
24,739
all-24740
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetShowFPSCounterParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
24,740
all-24741
[ "BasicAuth", "sets", "username", "and", "password", "for", "HTTP", "client" ]
[ "func", "BasicAuth", "(", "username", ",", "password", "string", ")", "ClientParam", "{", "return", "func", "(", "c", "*", "Client", ")", "error", "{", "c", ".", "auth", "=", "&", "basicAuth", "{", "username", ":", "username", ",", "password", ":", "<mask>", "}", "\n", "return", "nil", "\n", "}", "\n", "}" ]
24,741
all-24742
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GrantPermissionsParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
24,742
all-24743
[ "writeConfig", "writes", "uc", "to", "a", "file", "specified", "by", "path", "creating", "paret", "dirs", "along", "the", "way", ".", "If", "file", "does", "not", "exists", "it", "will", "be", "created", "with", "0600", "mod", ".", "This", "function", "does", "not", "store", "uc", ".", "key", ".", "func", "writeConfig", "(", "path", "string", "uc", "*", "userConfig", ")", "error", "{" ]
[ "func", "writeConfig", "(", "uc", "*", "userConfig", ")", "error", "{", "b", ",", "err", ":=", "json", ".", "MarshalIndent", "(", "uc", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "<mask>", ".", "MkdirAll", "(", "configDir", ",", "0700", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "ioutil", ".", "WriteFile", "(", "filepath", ".", "Join", "(", "configDir", ",", "accountFile", ")", ",", "b", ",", "0600", ")", "\n", "}" ]
24,743
all-24744
[ "Sample", "implements", "instruments", ".", "Reporter" ]
[ "func", "(", "r", "*", "Reporter", ")", "Sample", "(", "name", "string", ",", "<mask>", "[", "]", "string", ",", "dist", "instruments", ".", "Distribution", ")", "error", "{", "metric", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "strings", ".", "Join", "(", "tags", ",", "\"", "\"", ")", ",", "dist", ".", "Quantile", "(", "0.95", ")", ")", "\n", "r", ".", "metrics", "=", "append", "(", "r", ".", "metrics", ",", "metric", ")", "\n", "return", "nil", "\n", "}" ]
24,744
all-24745
[ "Create", "the", "actual", "bridge", "device", ".", "This", "is", "more", "backward", "-", "compatible", "than", "netlink", ".", "NetworkLinkAdd", "and", "works", "on", "RHEL", "6", "." ]
[ "func", "CreateBridge", "(", "name", "string", ",", "setMacAddr", "bool", ")", "error", "{", "if", "len", "(", "name", ")", ">=", "IFNAMSIZ", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n\n", "s", ",", "err", ":=", "getIfSocket", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "syscall", ".", "Close", "(", "s", ")", "\n\n", "nameBytePtr", ",", "err", ":=", "syscall", ".", "BytePtrFromString", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "_", ",", "_", ",", "err", ":=", "syscall", ".", "Syscall", "(", "syscall", ".", "SYS_IOCTL", ",", "uintptr", "(", "s", ")", ",", "SIOC_BRADDBR", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "nameBytePtr", ")", ")", ")", ";", "err", "!=", "0", "{", "return", "err", "\n", "}", "\n", "if", "setMacAddr", "{", "return", "SetMacAddress", "(", "<mask>", ",", "randMacAddr", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,745
all-24746
[ "Clear", "the", "current", "session" ]
[ "func", "(", "s", "*", "<mask>", ")", "Clear", "(", ")", "{", "for", "k", ":=", "range", "s", ".", "Session", ".", "Values", "{", "s", ".", "Delete", "(", "k", ")", "\n", "}", "\n", "}" ]
24,746
all-24747
[ "Reads", "the", "global", "registry", "file", "from", "the", "filesystem", ".", "Returns", "a", "byte", "array" ]
[ "func", "readRegistryConf", "(", "sys", "*", "types", ".", "SystemContext", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "return", "ioutil", ".", "ReadFile", "(", "RegistriesConfPath", "(", "sys", ")", ")", "\n", "}" ]
24,747
all-24748
[ "Return", "a", "generic", "vertex", "attribute", "parameter" ]
[ "func", "GetVertexAttribfv", "(", "index", "uint32", ",", "pname", "uint32", ",", "params", "*", "float32", ")", "{", "syscall", ".", "Syscall", "(", "gpGetVertexAttribfv", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
24,748
all-24749
[ "Do", "executes", "CSS", ".", "forcePseudoState", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "ForcePseudoStateParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandForcePseudoState", ",", "p", ",", "nil", ")", "\n", "}" ]
24,749
all-24750
[ "determine", "if", "a", "name", "corresponds", "to", "a", "buffer", "object" ]
[ "func", "IsBuffer", "(", "<mask>", "uint32", ")", "bool", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpIsBuffer", ",", "1", ",", "uintptr", "(", "buffer", ")", ",", "0", ",", "0", ")", "\n", "return", "ret", "!=", "0", "\n", "}" ]
24,750
all-24751
[ "Adds", "ka", "to", "new", "bucket", ".", "Returns", "false", "if", "it", "couldn", "t", "do", "it", "cuz", "buckets", "full", ".", "NOTE", ":", "currently", "it", "always", "returns", "true", "." ]
[ "func", "(", "a", "*", "AddrBook", ")", "addToNewBucket", "(", "ka", "*", "knownAddress", ",", "bucketIdx", "int", ")", "bool", "{", "// Sanity check", "if", "ka", ".", "isOld", "(", ")", "{", "<mask>", ".", "Warn", "(", "Fmt", "(", "\"", "\"", ",", "ka", ")", ")", "\n", "return", "false", "\n", "}", "\n\n", "addrStr", ":=", "ka", ".", "Addr", ".", "String", "(", ")", "\n", "bucket", ":=", "a", ".", "getBucket", "(", "bucketTypeNew", ",", "bucketIdx", ")", "\n\n", "// Already exists?", "if", "_", ",", "ok", ":=", "bucket", "[", "addrStr", "]", ";", "ok", "{", "return", "true", "\n", "}", "\n\n", "// Enforce max addresses.", "if", "len", "(", "bucket", ")", ">", "newBucketSize", "{", "log", ".", "Notice", "(", "\"", "\"", ")", "\n", "a", ".", "expireNew", "(", "bucketIdx", ")", "\n", "}", "\n\n", "// Add to bucket.", "bucket", "[", "addrStr", "]", "=", "ka", "\n", "if", "ka", ".", "addBucketRef", "(", "bucketIdx", ")", "==", "1", "{", "a", ".", "nNew", "++", "\n", "}", "\n\n", "// Ensure in addrLookup", "a", ".", "addrLookup", "[", "addrStr", "]", "=", "ka", "\n\n", "return", "true", "\n", "}" ]
24,751
all-24752
[ "PeekBytes", "returns", "header", "value", "for", "the", "given", "key", ".", "Returned", "value", "is", "valid", "until", "the", "next", "call", "to", "ResponseHeader", ".", "Do", "not", "store", "references", "to", "returned", "value", ".", "Make", "copies", "instead", "." ]
[ "func", "(", "h", "*", "ResponseHeader", ")", "PeekBytes", "(", "key", "[", "]", "byte", ")", "[", "]", "byte", "{", "h", ".", "bufKV", ".", "<mask>", "=", "append", "(", "h", ".", "bufKV", ".", "key", "[", ":", "0", "]", ",", "key", "...", ")", "\n", "normalizeHeaderKey", "(", "h", ".", "bufKV", ".", "key", ",", "h", ".", "disableNormalizing", ")", "\n", "return", "h", ".", "peek", "(", "h", ".", "bufKV", ".", "key", ")", "\n", "}" ]
24,752
all-24753
[ "Check", "Docker", "configs" ]
[ "func", "checkDocker", "(", ")", "error", "{", "if", "_", ",", "err", ":=", "config", ".", "Get", "(", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "err", ":=", "checkDockerBasicConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "checkScheduler", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "checkRouter", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "checkCluster", "(", ")", "\n", "}" ]
24,753
all-24754
[ "ResetTrap", "URL", "force", "request", "to", "the", "API", "for", "the", "submission", "URL", "and", "broker", "ca", "cert" ]
[ "func", "(", "cm", "*", "CheckManager", ")", "ResetTrap", "(", ")", "<mask>", "{", "if", "cm", ".", "trapURL", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "cm", ".", "trapURL", "=", "\"", "\"", "\n", "cm", ".", "certPool", "=", "nil", "// force re-fetching CA cert (if custom TLS config not supplied)", "\n", "return", "cm", ".", "initializeTrapURL", "(", ")", "\n", "}" ]
24,754
all-24755
[ "IsValid", "returns", "true", "iff", "kt", "is", "a", "recognized", "value" ]
[ "func", "(", "kt", "sbKeyType", ")", "IsValid", "(", ")", "bool", "{", "switch", "kt", "{", "case", "SBKeyTypeGPGKeys", ",", "SBKeyTypeSignedByGPGKeys", ",", "SBKeyTypeX509Certificates", ",", "SBKeyTypeSignedByX509CAs", ":", "return", "<mask>", "\n", "default", ":", "return", "false", "\n", "}", "\n", "}" ]
24,755
all-24756
[ "getMetadataFilePath", "gives", "the", "metadata", "file", "path", "for", "any", "agent", "-", "managed", "container" ]
[ "func", "getMetadataFilePath", "(", "taskARN", "string", ",", "containerName", "string", ",", "dataDir", "<mask>", ")", "(", "string", ",", "error", ")", "{", "taskID", ",", "err", ":=", "getTaskIDfromARN", "(", "taskARN", ")", "\n", "// Empty task ID indicates malformed ARN (Should not happen)", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "taskARN", ",", "containerName", ",", "err", ")", "\n", "}", "\n", "return", "filepath", ".", "Join", "(", "dataDir", ",", "metadataJoinSuffix", ",", "taskID", ",", "containerName", ")", ",", "nil", "\n", "}" ]
24,756
all-24757
[ "Logger", "returns", "the", "defaut", "Bambou", "logger", "." ]
[ "func", "Logger", "(", ")", "*", "logging", ".", "Logger", "{", "if", "defaultLogger", "==", "nil", "{", "logger", ",", "_", ":=", "logging", ".", "SimpleLogger", "(", "\"", "\"", ")", "\n", "defaultLogger", "=", "logger", "\n", "logger", ".", "SetLevel", "(", "logging", ".", "<mask>", ")", "\n", "}", "\n\n", "return", "defaultLogger", "\n", "}" ]
24,757
all-24758
[ "waitThenClose", "is", "spawned", "in", "a", "goroutine", "when", "the", "channel", "is", "registered", ".", "This", "safely", "cleans", "up", "the", "channel", "when", "the", "context", "has", "been", "canceled", "." ]
[ "func", "(", "e", "*", "eventChannel", ")", "waitThenClose", "(", ")", "{", "<-", "e", ".", "ctx", ".", "Done", "(", ")", "\n", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "<mask>", "(", "e", ".", "ch", ")", "\n", "// 1. Signals that we're done.", "// 2. Frees memory (in case we end up hanging on to this for a while).", "e", ".", "ch", "=", "nil", "\n", "e", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
24,758
all-24759
[ "CreateSecret", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "CreateSecret", "(", "arg0", "*", "secretsmanager", ".", "CreateSecretInput", ")", "(", "*", "secretsmanager", ".", "CreateSecretOutput", ",", "error", ")", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "CreateSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
24,759
all-24760
[ "determine", "if", "a", "name", "corresponds", "to", "a", "framebuffer", "object" ]
[ "func", "IsFramebuffer", "(", "framebuffer", "uint32", ")", "bool", "{", "<mask>", ":=", "C", ".", "glowIsFramebuffer", "(", "gpIsFramebuffer", ",", "(", "C", ".", "GLuint", ")", "(", "framebuffer", ")", ")", "\n", "return", "ret", "==", "TRUE", "\n", "}" ]
24,760
all-24761
[ "NewLob", "creates", "a", "new", "Lob", "instance", "with", "the", "io", ".", "Reader", "and", "io", ".", "Writer", "given", "as", "parameters", "." ]
[ "func", "NewLob", "(", "rd", "<mask>", ".", "Reader", ",", "wr", "io", ".", "Writer", ")", "*", "Lob", "{", "return", "&", "Lob", "{", "rd", ":", "rd", ",", "wr", ":", "wr", "}", "\n", "}" ]
24,761
all-24762
[ "Price", "flips", "the", "sign", "of", "the", "amount", "and", "prints", "it", "with", "a", "currency", "symbol", "for", "the", "given", "unit", "." ]
[ "func", "price", "(", "unit", "string", ",", "amount", "string", ")", "string", "{", "if", "len", "(", "amount", ")", "==", "0", "{", "return", "amount", "\n", "}", "\n", "if", "amount", "[", "0", "]", "==", "'-'", "{", "amount", "=", "amount", "[", "1", ":", "]", "\n", "}", "else", "{", "amount", "=", "\"", "\"", "+", "amount", "\n", "}", "\n", "for", "strings", ".", "Contains", "(", "amount", ",", "\"", "\"", ")", "&&", "strings", ".", "HasSuffix", "(", "amount", ",", "\"", "\"", ")", "{", "amount", "=", "amount", "[", ":", "len", "(", "amount", ")", "-", "1", "]", "\n", "}", "\n", "if", "strings", ".", "HasSuffix", "(", "amount", ",", "\"", "\"", ")", "{", "amount", "=", "amount", "[", ":", "len", "(", "amount", ")", "-", "1", "]", "\n", "}", "\n", "unit", "=", "strings", ".", "ToUpper", "(", "unit", ")", "\n", "if", "sym", ",", "ok", ":=", "symbols", "[", "unit", "]", ";", "ok", "{", "return", "sym", "+", "amount", "\n", "}", "else", "{", "if", "unit", "==", "\"", "\"", "{", "return", "amount", "\n", "}", "\n", "return", "<mask>", "+", "\"", "\"", "+", "amount", "\n", "}", "\n", "}" ]
24,762
all-24763
[ "ImageAliasAdd", "inserts", "an", "alias", "ento", "the", "database", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageAliasAdd", "(", "project", ",", "name", "string", ",", "imageID", "int", ",", "desc", "string", ")", "error", "{", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "enabled", ",", "err", ":=", "tx", ".", "ProjectHasImages", "(", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "enabled", "{", "project", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "stmt", ":=", "`\nINSERT INTO images_aliases (name, image_id, description, project_id)\n VALUES (?, ?, ?, (SELECT id FROM projects WHERE name = ?))\n`", "\n", "err", "=", "exec", "(", "c", ".", "db", ",", "stmt", ",", "<mask>", ",", "imageID", ",", "desc", ",", "project", ")", "\n", "return", "err", "\n", "}" ]
24,763
all-24764
[ "Decode", "decodes", "a", "cursor", "from", "its", "base", "-", "64", "string", "representation", "." ]
[ "func", "DecodeCursor", "(", "s", "string", ")", "(", "Cursor", ",", "error", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "Cursor", "{", "&", "zeroCC", "}", ",", "nil", "\n", "}", "\n", "if", "n", ":=", "len", "(", "s", ")", "%", "4", ";", "n", "!=", "0", "{", "s", "+=", "strings", ".", "Repeat", "(", "\"", "\"", ",", "4", "-", "n", ")", "\n", "}", "\n", "b", ",", "err", ":=", "base64", ".", "URLEncoding", ".", "DecodeString", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "return", "Cursor", "{", "}", ",", "err", "\n", "}", "\n", "cc", ":=", "&", "<mask>", ".", "CompiledCursor", "{", "}", "\n", "if", "err", ":=", "proto", ".", "Unmarshal", "(", "b", ",", "cc", ")", ";", "err", "!=", "nil", "{", "return", "Cursor", "{", "}", ",", "err", "\n", "}", "\n", "return", "Cursor", "{", "cc", "}", ",", "nil", "\n", "}" ]
24,764
all-24765
[ "Mount", "attaches", "another", "http", ".", "Handler", "or", "chi", "Router", "as", "a", "subrouter", "along", "a", "routing", "path", ".", "It", "s", "very", "useful", "to", "split", "up", "a", "large", "API", "as", "many", "independent", "routers", "and", "compose", "them", "as", "a", "single", "service", "using", "Mount", ".", "See", "_examples", "/", ".", "Note", "that", "Mount", "()", "simply", "sets", "a", "wildcard", "along", "the", "pattern", "that", "will", "continue", "routing", "at", "the", "handler", "which", "in", "most", "cases", "is", "another", "chi", ".", "Router", ".", "As", "a", "result", "if", "you", "define", "two", "Mount", "()", "routes", "on", "the", "exact", "same", "pattern", "the", "mount", "will", "panic", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "Mount", "(", "pattern", "string", ",", "handler", "http", ".", "Handler", ")", "{", "// Provide runtime safety for ensuring a pattern isn't mounted on an existing", "// routing pattern.", "if", "mx", ".", "tree", ".", "findPattern", "(", "pattern", "+", "\"", "\"", ")", "||", "mx", ".", "tree", ".", "findPattern", "(", "pattern", "+", "\"", "\"", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pattern", ")", ")", "\n", "}", "\n\n", "// Assign sub-Router's with the parent not found & method not allowed handler if not specified.", "subr", ",", "ok", ":=", "handler", ".", "(", "*", "Mux", ")", "\n", "if", "ok", "&&", "subr", ".", "notFoundHandler", "==", "nil", "&&", "mx", ".", "notFoundHandler", "!=", "nil", "{", "subr", ".", "NotFound", "(", "mx", ".", "notFoundHandler", ")", "\n", "}", "\n", "if", "ok", "&&", "subr", ".", "methodNotAllowedHandler", "==", "nil", "&&", "mx", ".", "methodNotAllowedHandler", "!=", "nil", "{", "subr", ".", "MethodNotAllowed", "(", "mx", ".", "methodNotAllowedHandler", ")", "\n", "}", "\n\n", "// Wrap the sub-router in a handlerFunc to scope the request path for routing.", "mountHandler", ":=", "http", ".", "HandlerFunc", "(", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "<mask>", ")", "{", "rctx", ":=", "RouteContext", "(", "r", ".", "Context", "(", ")", ")", "\n", "rctx", ".", "RoutePath", "=", "mx", ".", "nextRoutePath", "(", "rctx", ")", "\n", "handler", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", ")", "\n\n", "if", "pattern", "==", "\"", "\"", "||", "pattern", "[", "len", "(", "pattern", ")", "-", "1", "]", "!=", "'/'", "{", "mx", ".", "handle", "(", "mALL", "|", "mSTUB", ",", "pattern", ",", "mountHandler", ")", "\n", "mx", ".", "handle", "(", "mALL", "|", "mSTUB", ",", "pattern", "+", "\"", "\"", ",", "mountHandler", ")", "\n", "pattern", "+=", "\"", "\"", "\n", "}", "\n\n", "method", ":=", "mALL", "\n", "subroutes", ",", "_", ":=", "handler", ".", "(", "Routes", ")", "\n", "if", "subroutes", "!=", "nil", "{", "method", "|=", "mSTUB", "\n", "}", "\n", "n", ":=", "mx", ".", "handle", "(", "method", ",", "pattern", "+", "\"", "\"", ",", "mountHandler", ")", "\n\n", "if", "subroutes", "!=", "nil", "{", "n", ".", "subroutes", "=", "subroutes", "\n", "}", "\n", "}" ]
24,765
all-24766
[ "NewAddrBook", "creates", "a", "new", "address", "book", ".", "Use", "Start", "to", "begin", "processing", "asynchronous", "address", "updates", "." ]
[ "func", "NewAddrBook", "(", "filePath", "string", ",", "routabilityStrict", "bool", ")", "*", "AddrBook", "{", "am", ":=", "&", "AddrBook", "{", "rand", ":", "rand", ".", "New", "(", "<mask>", ".", "NewSource", "(", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", ")", ")", ",", "ourAddrs", ":", "make", "(", "map", "[", "string", "]", "*", "NetAddress", ")", ",", "addrLookup", ":", "make", "(", "map", "[", "string", "]", "*", "knownAddress", ")", ",", "filePath", ":", "filePath", ",", "routabilityStrict", ":", "routabilityStrict", ",", "}", "\n", "am", ".", "init", "(", ")", "\n", "am", ".", "BaseService", "=", "*", "NewBaseService", "(", "log", ",", "\"", "\"", ",", "am", ")", "\n", "return", "am", "\n", "}" ]
24,766
all-24767
[ "WithURL", "the", "request", "-", "URI", "to", "associate", "with", "the", "setting", "of", "the", "cookie", ".", "This", "value", "can", "affect", "the", "default", "domain", "and", "path", "values", "of", "the", "created", "cookie", "." ]
[ "func", "(", "p", "SetCookieParams", ")", "WithURL", "(", "url", "string", ")", "*", "SetCookieParams", "{", "p", ".", "URL", "=", "<mask>", "\n", "return", "&", "p", "\n", "}" ]
24,767
all-24768
[ "openTarComponent", "returns", "a", "ReadCloser", "for", "the", "specific", "file", "within", "the", "archive", ".", "This", "is", "linear", "scan", ";", "we", "assume", "that", "the", "tar", "file", "will", "have", "a", "fairly", "small", "amount", "of", "files", "(", "~layers", ")", "and", "that", "filesystem", "caching", "will", "make", "the", "repeated", "seeking", "over", "the", "(", "uncompressed", ")", "tarPath", "cheap", "enough", ".", "The", "caller", "should", "call", ".", "Close", "()", "on", "the", "returned", "stream", "." ]
[ "func", "(", "s", "*", "Source", ")", "openTarComponent", "(", "componentPath", "string", ")", "(", "<mask>", ".", "ReadCloser", ",", "error", ")", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "s", ".", "tarPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "succeeded", ":=", "false", "\n", "defer", "func", "(", ")", "{", "if", "!", "succeeded", "{", "f", ".", "Close", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "tarReader", ",", "header", ",", "err", ":=", "findTarComponent", "(", "f", ",", "componentPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "header", "==", "nil", "{", "return", "nil", ",", "os", ".", "ErrNotExist", "\n", "}", "\n", "if", "header", ".", "FileInfo", "(", ")", ".", "Mode", "(", ")", "&", "os", ".", "ModeType", "==", "os", ".", "ModeSymlink", "{", "// FIXME: untested", "// We follow only one symlink; so no loops are possible.", "if", "_", ",", "err", ":=", "f", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_SET", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "// The new path could easily point \"outside\" the archive, but we only compare it to existing tar headers without extracting the archive,", "// so we don't care.", "tarReader", ",", "header", ",", "err", "=", "findTarComponent", "(", "f", ",", "path", ".", "Join", "(", "path", ".", "Dir", "(", "componentPath", ")", ",", "header", ".", "Linkname", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "header", "==", "nil", "{", "return", "nil", ",", "os", ".", "ErrNotExist", "\n", "}", "\n", "}", "\n\n", "if", "!", "header", ".", "FileInfo", "(", ")", ".", "Mode", "(", ")", ".", "IsRegular", "(", ")", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "header", ".", "Name", ")", "\n", "}", "\n", "succeeded", "=", "true", "\n", "return", "&", "tarReadCloser", "{", "Reader", ":", "tarReader", ",", "backingFile", ":", "f", "}", ",", "nil", "\n", "}" ]
24,768
all-24769
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "Uniform2fv", "(", "location", "int32", ",", "<mask>", "int32", ",", "value", "*", "float32", ")", "{", "C", ".", "glowUniform2fv", "(", "gpUniform2fv", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
24,769
all-24770
[ "EndOfDay", "end", "of", "day" ]
[ "func", "(", "now", "*", "Now", ")", "EndOfDay", "(", ")", "time", ".", "Time", "{", "y", ",", "m", ",", "d", ":=", "now", ".", "Date", "(", ")", "\n", "return", "time", ".", "Date", "(", "y", ",", "m", ",", "d", ",", "23", ",", "59", ",", "59", ",", "int", "(", "<mask>", ".", "Second", "-", "time", ".", "Nanosecond", ")", ",", "now", ".", "Location", "(", ")", ")", "\n", "}" ]
24,770
all-24771
[ "AllByXPath", "finds", "zero", "or", "more", "elements", "by", "XPath", "selector", "." ]
[ "func", "(", "s", "*", "selectable", ")", "AllByXPath", "(", "selector", "string", ")", "*", "MultiSelection", "{", "return", "newMultiSelection", "(", "s", ".", "<mask>", ",", "s", ".", "selectors", ".", "Append", "(", "target", ".", "XPath", ",", "selector", ")", ")", "\n", "}" ]
24,771
all-24772
[ "ReadBoolSetting", "reads", "value", "of", "a", "given", "bool", "setting", "." ]
[ "func", "ReadBoolSetting", "(", "db", "*", "reform", ".", "Querier", ",", "key", "string", ")", "(", "bool", ",", "error", ")", "{", "val", ",", "err", ":=", "ReadSetting", "(", "db", ",", "key", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ",", "err", "\n", "}", "\n\n", "val2", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "val", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "newSettingParseError", "(", "key", ",", "err", ")", "\n", "}", "\n\n", "return", "bool", "(", "val2", ")", ",", "nil", "\n", "}" ]
24,772
all-24773
[ "GetQuery", "returns", "the", "Query", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "GetQuery", "(", ")", "string", "{", "if", "m", "==", "nil", "||", "m", ".", "Query", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "m", ".", "<mask>", "\n", "}" ]
24,773
all-24774
[ "Delete", "is", "equivalent", "of", "Txn", ".", "Delete", "." ]
[ "func", "(", "wb", "*", "WriteBatch", ")", "Delete", "(", "k", "[", "]", "<mask>", ")", "error", "{", "wb", ".", "Lock", "(", ")", "\n", "defer", "wb", ".", "Unlock", "(", ")", "\n\n", "if", "err", ":=", "wb", ".", "txn", ".", "Delete", "(", "k", ")", ";", "err", "!=", "ErrTxnTooBig", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "wb", ".", "commit", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "wb", ".", "txn", ".", "Delete", "(", "k", ")", ";", "err", "!=", "nil", "{", "wb", ".", "err", "=", "err", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,774
all-24775
[ "RenameContainerBackup", "requests", "that", "LXD", "renames", "the", "backup" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "RenameContainerBackup", "(", "containerName", "string", ",", "name", "string", ",", "backup", "api", ".", "ContainerBackupPost", ")", "(", "<mask>", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Send the request", "op", ",", "_", ",", "err", ":=", "r", ".", "queryOperation", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "containerName", ")", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", ",", "backup", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "op", ",", "nil", "\n", "}" ]
24,775
all-24776
[ "GetSelectionBounds", "is", "a", "wrapper", "around", "gtk_editable_get_selection_bounds", "()", "." ]
[ "func", "(", "v", "*", "Editable", ")", "GetSelectionBounds", "(", ")", "(", "<mask>", ",", "end", "int", ",", "nonEmpty", "bool", ")", "{", "var", "cstart", ",", "cend", "C", ".", "gint", "\n", "c", ":=", "C", ".", "gtk_editable_get_selection_bounds", "(", "v", ".", "native", "(", ")", ",", "&", "cstart", ",", "&", "cend", ")", "\n", "return", "int", "(", "cstart", ")", ",", "int", "(", "cend", ")", ",", "gobool", "(", "c", ")", "\n", "}" ]
24,776
all-24777
[ "SentinelAddrs", "returns", "a", "slice", "of", "known", "Sentinel", "addresses", "Sentinel", "server", "aware", "of", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "SentinelAddrs", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "res", ",", "err", ":=", "s", ".", "doUntilSuccess", "(", "func", "(", "c", "redis", ".", "Conn", ")", "(", "<mask>", "{", "}", ",", "error", ")", "{", "return", "queryForSentinels", "(", "c", ",", "s", ".", "MasterName", ")", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "res", ".", "(", "[", "]", "string", ")", ",", "nil", "\n", "}" ]
24,777
all-24778
[ "GetTitle", "()", "is", "a", "wrapper", "around", "gtk_tree_view_column_get_title", "()", "." ]
[ "func", "(", "v", "*", "TreeViewColumn", ")", "GetTitle", "(", ")", "string", "{", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "C", ".", "gtk_tree_view_column_get_title", "(", "v", ".", "native", "(", ")", ")", ")", ")", "\n", "}" ]
24,778
all-24779
[ "Delete", "the", "given", "key", "rows", "from", "the", "given", "config", "table", "." ]
[ "func", "deleteConfig", "(", "tx", "*", "sql", ".", "Tx", ",", "table", "string", ",", "keys", "[", "]", "string", ")", "error", "{", "n", ":=", "len", "(", "keys", ")", "\n\n", "if", "n", "==", "0", "{", "return", "nil", "// Nothing to delete.", "\n", "}", "\n\n", "<mask>", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "table", ",", "Params", "(", "n", ")", ")", "\n", "values", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "n", ")", "\n", "for", "i", ",", "key", ":=", "range", "keys", "{", "values", "[", "i", "]", "=", "key", "\n", "}", "\n", "_", ",", "err", ":=", "tx", ".", "Exec", "(", "query", ",", "values", "...", ")", "\n", "return", "err", "\n", "}" ]
24,779
all-24780
[ "NewComputeUtil", "creates", "and", "initializes", "a", "ComputeUtil", "." ]
[ "func", "newComputeUtil", "(", "driver", "*", "Driver", ")", "(", "*", "ComputeUtil", ",", "error", ")", "{", "client", ",", "err", ":=", "google", ".", "DefaultClient", "(", "oauth2", ".", "NoContext", ",", "raw", ".", "ComputeScope", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "service", ",", "err", ":=", "raw", ".", "New", "(", "client", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "ComputeUtil", "{", "zone", ":", "driver", ".", "Zone", ",", "instanceName", ":", "driver", ".", "MachineName", ",", "userName", ":", "driver", ".", "SSHUser", ",", "project", ":", "driver", ".", "Project", ",", "diskTypeURL", ":", "driver", ".", "DiskType", ",", "address", ":", "driver", ".", "Address", ",", "network", ":", "driver", ".", "Network", ",", "subnetwork", ":", "driver", ".", "Subnetwork", ",", "preemptible", ":", "driver", ".", "Preemptible", ",", "useInternalIP", ":", "driver", ".", "UseInternalIP", ",", "useInternalIPOnly", ":", "driver", ".", "UseInternalIPOnly", ",", "service", ":", "service", ",", "zoneURL", ":", "apiURL", "+", "driver", ".", "Project", "+", "\"", "\"", "+", "<mask>", ".", "Zone", ",", "globalURL", ":", "apiURL", "+", "driver", ".", "Project", "+", "\"", "\"", ",", "SwarmMaster", ":", "driver", ".", "SwarmMaster", ",", "SwarmHost", ":", "driver", ".", "SwarmHost", ",", "openPorts", ":", "driver", ".", "OpenPorts", ",", "}", ",", "nil", "\n", "}" ]
24,780
all-24781
[ "Fatal", "records", "the", "log", "with", "fatal", "level", "and", "exits" ]
[ "func", "Fatal", "(", "args", "...", "<mask>", "{", "}", ")", "{", "logger", ".", "Output", "(", "2", ",", "LevelFatal", ",", "fmt", ".", "Sprint", "(", "args", "...", ")", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}" ]
24,781
all-24782
[ "FreeOSMemory", "forces", "jemalloc", "to", "scrub", "memory", "and", "release", "back", "to", "OS" ]
[ "func", "FreeOSMemory", "(", ")", "<mask>", "{", "errCode", ":=", "int", "(", "C", ".", "mm_free2os", "(", ")", ")", "\n", "if", "errCode", "!=", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "errCode", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
24,782
all-24783
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniformMatrix4x3fv", "(", "program", "uint32", ",", "<mask>", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "C", ".", "glowProgramUniformMatrix4x3fv", "(", "gpProgramUniformMatrix4x3fv", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "transpose", ")", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
24,783
all-24784
[ "GetStringBounds", "returns", "the", "approximate", "pixel", "bounds", "of", "the", "string", "s", "at", "x", "y", ".", "The", "left", "edge", "of", "the", "em", "square", "of", "the", "first", "character", "of", "s", "and", "the", "baseline", "intersect", "at", "0", "0", "in", "the", "returned", "coordinates", ".", "Therefore", "the", "top", "and", "left", "coordinates", "may", "well", "be", "negative", "." ]
[ "func", "(", "gc", "*", "GraphicContext", ")", "GetStringBounds", "(", "s", "string", ")", "(", "<mask>", ",", "top", ",", "right", ",", "bottom", "float64", ")", "{", "_", ",", "h", ":=", "gc", ".", "pdf", ".", "GetFontSize", "(", ")", "\n", "d", ":=", "gc", ".", "pdf", ".", "GetFontDesc", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "d", ".", "Ascent", "==", "0", "{", "// not defined (standard font?), use average of 81%", "top", "=", "0.81", "*", "h", "\n", "}", "else", "{", "top", "=", "-", "float64", "(", "d", ".", "Ascent", ")", "*", "h", "/", "float64", "(", "d", ".", "Ascent", "-", "d", ".", "Descent", ")", "\n", "}", "\n", "return", "0", ",", "top", ",", "gc", ".", "pdf", ".", "GetStringWidth", "(", "s", ")", ",", "top", "+", "h", "\n", "}" ]
24,784
all-24785
[ "GetUrl", "returns", "the", "Url", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "SyntheticsRequest", ")", "GetUrl", "(", ")", "<mask>", "{", "if", "s", "==", "nil", "||", "s", ".", "Url", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "Url", "\n", "}" ]
24,785
all-24786
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "EventTimelineDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "e", "!=", "nil", "&&", "e", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
24,786
all-24787
[ "ForceWatching", "is", "used", "to", "force", "setting", "the", "internal", "state", "of", "watching", "a", "dependency", ".", "This", "is", "only", "used", "for", "unit", "testing", "purposes", "." ]
[ "func", "(", "w", "*", "Watcher", ")", "ForceWatching", "(", "d", "dep", ".", "Dependency", ",", "enabled", "bool", ")", "{", "w", ".", "Lock", "(", ")", "\n", "defer", "w", ".", "Unlock", "(", ")", "\n\n", "if", "enabled", "{", "w", ".", "depViewMap", "[", "d", ".", "String", "(", ")", "]", "=", "nil", "\n", "}", "else", "{", "delete", "(", "w", ".", "depViewMap", ",", "d", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "}" ]
24,787
all-24788
[ "Valid", "validator" ]
[ "func", "(", "h", "*", "headerRule", ")", "Valid", "(", "w", "<mask>", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "bool", "{", "return", "h", ".", "valid", "(", "w", ".", "Header", "(", ")", ".", "Get", ")", "\n", "}" ]
24,788
all-24789
[ "processHeartbeat", "is", "a", "special", "handler", "used", "just", "for", "heartbeat", "requests", "so", "that", "they", "can", "be", "fast", "-", "pathed", "if", "a", "transport", "supports", "it", ".", "This", "must", "only", "be", "called", "from", "the", "main", "thread", "." ]
[ "func", "(", "r", "*", "Raft", ")", "processHeartbeat", "(", "rpc", "RPC", ")", "{", "defer", "metrics", ".", "MeasureSince", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", "time", ".", "Now", "(", ")", ")", "\n\n", "// Check if we are shutdown, just ignore the RPC", "select", "{", "case", "<-", "r", ".", "shutdownCh", ":", "return", "\n", "default", ":", "}", "\n\n", "// Ensure we are only handling a heartbeat", "switch", "cmd", ":=", "rpc", ".", "Command", ".", "(", "<mask>", ")", "{", "case", "*", "AppendEntriesRequest", ":", "r", ".", "appendEntries", "(", "rpc", ",", "cmd", ")", "\n", "default", ":", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rpc", ".", "Command", ")", ")", "\n", "rpc", ".", "Respond", "(", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
24,789
all-24790
[ "WithHTTPClient", "adds", "the", "HTTPClient", "to", "the", "get", "apps", "params" ]
[ "func", "(", "o", "*", "GetAppsParams", ")", "WithHTTPClient", "(", "client", "*", "<mask>", ".", "Client", ")", "*", "GetAppsParams", "{", "o", ".", "SetHTTPClient", "(", "client", ")", "\n", "return", "o", "\n", "}" ]
24,790
all-24791
[ "NewEventStreamReader", "creates", "an", "instance", "of", "EventStreamReader", "." ]
[ "func", "NewEventStreamReader", "(", "eventStream", "io", ".", "Reader", ")", "*", "EventStreamReader", "{", "scanner", ":=", "bufio", ".", "NewScanner", "(", "eventStream", ")", "\n", "split", ":=", "func", "(", "data", "[", "]", "byte", ",", "atEOF", "bool", ")", "(", "int", ",", "[", "]", "byte", ",", "error", ")", "{", "if", "atEOF", "&&", "len", "(", "data", ")", "==", "0", "{", "return", "0", ",", "nil", ",", "nil", "\n", "}", "\n\n", "// We have a full event payload to parse.", "if", "i", ":=", "bytes", ".", "Index", "(", "data", ",", "[", "]", "byte", "(", "\"", "\\r", "\\n", "\\r", "\\n", "\"", ")", ")", ";", "i", ">=", "0", "{", "return", "i", "+", "1", ",", "data", "[", "0", ":", "i", "]", ",", "nil", "\n", "}", "\n", "if", "i", ":=", "bytes", ".", "Index", "(", "data", ",", "[", "]", "byte", "(", "\"", "\\r", "\\r", "\"", ")", ")", ";", "i", ">=", "0", "{", "return", "i", "+", "1", ",", "data", "[", "0", ":", "i", "]", ",", "nil", "\n", "}", "\n", "if", "i", ":=", "bytes", ".", "Index", "(", "<mask>", ",", "[", "]", "byte", "(", "\"", "\\n", "\\n", "\"", ")", ")", ";", "i", ">=", "0", "{", "return", "i", "+", "1", ",", "data", "[", "0", ":", "i", "]", ",", "nil", "\n", "}", "\n", "// If we're at EOF, we have all of the data.", "if", "atEOF", "{", "return", "len", "(", "data", ")", ",", "data", ",", "nil", "\n", "}", "\n", "// Request more data.", "return", "0", ",", "nil", ",", "nil", "\n", "}", "\n", "// Set the split function for the scanning operation.", "scanner", ".", "Split", "(", "split", ")", "\n\n", "return", "&", "EventStreamReader", "{", "scanner", ":", "scanner", ",", "}", "\n", "}" ]
24,791
all-24792
[ "OutgoingContextWithToken", "returns", "an", "outgoing", "context", "with", "the", "token" ]
[ "func", "OutgoingContextWithToken", "(", "ctx", "context", ".", "Context", ",", "token", "string", ")", "context", ".", "Context", "{", "return", "outgoingContextWithMergedMetadata", "(", "ctx", ",", "\"", "\"", ",", "<mask>", ")", "\n", "}" ]
24,792
all-24793
[ "GetEvaluationTimestamp", "returns", "the", "time", "the", "evaluation", "took", "place", "." ]
[ "func", "(", "r", "*", "AlertingRule", ")", "GetEvaluationTimestamp", "(", ")", "<mask>", ".", "Time", "{", "r", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "mtx", ".", "Unlock", "(", ")", "\n", "return", "r", ".", "evaluationTimestamp", "\n", "}" ]
24,793
all-24794
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "VolumeType", ")", "Locator", "(", "api", "*", "API", ")", "*", "VolumeTypeLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "VolumeTypeLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
24,794
all-24795
[ "New", "creates", "a", "new", "Validate", "instance", "for", "use", "." ]
[ "func", "New", "(", "tagName", "string", ",", "funcs", "<mask>", "[", "string", "]", "Func", ")", "*", "Validate", "{", "structPool", "=", "&", "sync", ".", "Pool", "{", "New", ":", "newStructErrors", "}", "\n\n", "return", "&", "Validate", "{", "tagName", ":", "tagName", ",", "validationFuncs", ":", "funcs", ",", "}", "\n", "}" ]
24,795
all-24796
[ "Format", "formats", "the", "node", "." ]
[ "func", "(", "node", "*", "SubstrExpr", ")", "Format", "(", "buf", "*", "TrackedBuffer", ")", "{", "if", "<mask>", ".", "To", "==", "nil", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Name", ",", "node", ".", "From", ")", "\n", "}", "else", "{", "buf", ".", "Myprintf", "(", "\"", "\"", ",", "node", ".", "Name", ",", "node", ".", "From", ",", "node", ".", "To", ")", "\n", "}", "\n", "}" ]
24,796
all-24797
[ "Synchronously", "uploads", "snapshots", "contained", "in", "the", "specified", "directory", ".", "It", "is", "safe", "to", "spawn", "a", "goroutine", "to", "run", "BTTracer", ".", "PutDir", "()", ".", "ConfigurePut", "should", "have", "returned", "successfully", "before", "calling", "BTTracer", ".", "PutDir", "()", ".", "Only", "files", "with", "the", ".", "btt", "suffix", "will", "be", "uploaded", ".", "The", "first", "error", "encountered", "terminates", "the", "directory", "walk", "thus", "skipping", "snapshots", "which", "would", "have", "been", "processed", "later", "in", "the", "walk", "." ]
[ "func", "(", "t", "*", "BTTracer", ")", "PutDir", "(", "path", "string", ")", "error", "{", "t", ".", "Logf", "(", "LogDebug", ",", "\"", "\\n", "\"", ",", "<mask>", ")", "\n", "return", "filepath", ".", "Walk", "(", "path", ",", "putDirWalk", "(", "t", ")", ")", "\n", "}" ]
24,797
all-24798
[ "Save", "triggers", "a", "save", "to", "file", "though", "respects", "a", "minimum", "save", "interval", "to", "wait", "between", "saves", "." ]
[ "func", "(", "manager", "*", "basicStateManager", ")", "Save", "(", ")", "error", "{", "defer", "metrics", ".", "MetricsEngineGlobal", ".", "RecordStateManagerMetric", "(", "\"", "\"", ")", "(", ")", "\n", "manager", ".", "saveTimesLock", ".", "Lock", "(", ")", "\n", "defer", "manager", ".", "saveTimesLock", ".", "Unlock", "(", ")", "\n", "if", "time", ".", "Since", "(", "manager", ".", "lastSave", ")", ">=", "minSaveInterval", "{", "// we can just save", "err", ":=", "manager", ".", "ForceSave", "(", ")", "\n", "manager", ".", "lastSave", "=", "time", ".", "Now", "(", ")", "\n", "manager", ".", "nextPlannedSave", "=", "time", ".", "Time", "{", "}", "// re-zero it; assume all pending desires to save are fulfilled", "\n", "return", "err", "\n", "}", "else", "if", "manager", ".", "nextPlannedSave", ".", "IsZero", "(", ")", "{", "// No save planned yet, we should plan one.", "next", ":=", "manager", ".", "lastSave", ".", "Add", "(", "minSaveInterval", ")", "\n", "manager", ".", "nextPlannedSave", "=", "next", "\n", "go", "func", "(", ")", "{", "time", ".", "Sleep", "(", "<mask>", ".", "Sub", "(", "time", ".", "Now", "(", ")", ")", ")", "\n", "manager", ".", "Save", "(", ")", "\n", "}", "(", ")", "\n", "}", "\n", "// else nextPlannedSave wasn't Zero so there's a save planned elsewhere that'll", "// fulfill this", "return", "nil", "\n", "}" ]
24,798
all-24799
[ "AddModuleLevel", "wraps", "a", "log", "backend", "with", "knobs", "to", "have", "different", "log", "levels", "for", "different", "modules", "." ]
[ "func", "AddModuleLevel", "(", "backend", "Backend", ")", "LeveledBackend", "{", "<mask>", "leveled", "LeveledBackend", "\n", "var", "ok", "bool", "\n", "if", "leveled", ",", "ok", "=", "backend", ".", "(", "LeveledBackend", ")", ";", "!", "ok", "{", "leveled", "=", "&", "moduleLeveled", "{", "levels", ":", "make", "(", "map", "[", "string", "]", "Level", ")", ",", "backend", ":", "backend", ",", "}", "\n", "}", "\n", "return", "leveled", "\n", "}" ]
24,799
all-24800
[ "simplifyOne", "simplifies", "a", "single", "AST", ".", "It", "returns", "nil", "if", "there", "is", "nothing", "to", "do", "." ]
[ "func", "simplifyOne", "(", "a", "AST", ")", "AST", "{", "switch", "a", ":=", "a", ".", "(", "type", ")", "{", "case", "*", "TemplateParam", ":", "if", "a", ".", "Template", "!=", "nil", "&&", "a", ".", "Index", "<", "len", "(", "a", ".", "Template", ".", "Args", ")", "{", "return", "a", ".", "Template", ".", "Args", "[", "a", ".", "Index", "]", "\n", "}", "\n", "case", "*", "MethodWithQualifiers", ":", "if", "m", ",", "ok", ":=", "a", ".", "Method", ".", "(", "*", "MethodWithQualifiers", ")", ";", "ok", "{", "ref", ":=", "a", ".", "RefQualifier", "\n", "if", "ref", "==", "\"", "\"", "{", "ref", "=", "m", ".", "RefQualifier", "\n", "}", "else", "if", "m", ".", "RefQualifier", "!=", "\"", "\"", "{", "if", "ref", "==", "\"", "\"", "||", "m", ".", "RefQualifier", "==", "\"", "\"", "{", "ref", "=", "\"", "\"", "\n", "}", "\n", "}", "\n", "return", "&", "MethodWithQualifiers", "{", "Method", ":", "m", ".", "Method", ",", "Qualifiers", ":", "mergeQualifiers", "(", "a", ".", "Qualifiers", ",", "m", ".", "Qualifiers", ")", ",", "RefQualifier", ":", "ref", "}", "\n", "}", "\n", "if", "t", ",", "ok", ":=", "a", ".", "Method", ".", "(", "*", "TypeWithQualifiers", ")", ";", "ok", "{", "return", "&", "MethodWithQualifiers", "{", "Method", ":", "t", ".", "Base", ",", "Qualifiers", ":", "mergeQualifiers", "(", "a", ".", "Qualifiers", ",", "t", ".", "Qualifiers", ")", ",", "RefQualifier", ":", "a", ".", "RefQualifier", "}", "\n", "}", "\n", "case", "*", "TypeWithQualifiers", ":", "if", "ft", ",", "ok", ":=", "a", ".", "Base", ".", "(", "*", "FunctionType", ")", ";", "ok", "{", "return", "&", "MethodWithQualifiers", "{", "Method", ":", "ft", ",", "Qualifiers", ":", "a", ".", "Qualifiers", ",", "RefQualifier", ":", "\"", "\"", "}", "\n", "}", "\n", "if", "t", ",", "ok", ":=", "a", ".", "Base", ".", "(", "*", "TypeWithQualifiers", ")", ";", "ok", "{", "return", "&", "TypeWithQualifiers", "{", "Base", ":", "t", ".", "Base", ",", "Qualifiers", ":", "mergeQualifiers", "(", "a", ".", "Qualifiers", ",", "t", ".", "Qualifiers", ")", "}", "\n", "}", "\n", "if", "m", ",", "<mask>", ":=", "a", ".", "Base", ".", "(", "*", "MethodWithQualifiers", ")", ";", "ok", "{", "return", "&", "MethodWithQualifiers", "{", "Method", ":", "m", ".", "Method", ",", "Qualifiers", ":", "mergeQualifiers", "(", "a", ".", "Qualifiers", ",", "m", ".", "Qualifiers", ")", ",", "RefQualifier", ":", "m", ".", "RefQualifier", "}", "\n", "}", "\n", "case", "*", "ReferenceType", ":", "if", "rt", ",", "ok", ":=", "a", ".", "Base", ".", "(", "*", "ReferenceType", ")", ";", "ok", "{", "return", "rt", "\n", "}", "\n", "if", "rrt", ",", "ok", ":=", "a", ".", "Base", ".", "(", "*", "RvalueReferenceType", ")", ";", "ok", "{", "return", "&", "ReferenceType", "{", "Base", ":", "rrt", ".", "Base", "}", "\n", "}", "\n", "case", "*", "RvalueReferenceType", ":", "if", "rrt", ",", "ok", ":=", "a", ".", "Base", ".", "(", "*", "RvalueReferenceType", ")", ";", "ok", "{", "return", "rrt", "\n", "}", "\n", "if", "rt", ",", "ok", ":=", "a", ".", "Base", ".", "(", "*", "ReferenceType", ")", ";", "ok", "{", "return", "rt", "\n", "}", "\n", "case", "*", "ArrayType", ":", "// Qualifiers on the element of an array type", "// go on the whole array type.", "if", "q", ",", "ok", ":=", "a", ".", "Element", ".", "(", "*", "TypeWithQualifiers", ")", ";", "ok", "{", "return", "&", "TypeWithQualifiers", "{", "Base", ":", "&", "ArrayType", "{", "Dimension", ":", "a", ".", "Dimension", ",", "Element", ":", "q", ".", "Base", "}", ",", "Qualifiers", ":", "q", ".", "Qualifiers", ",", "}", "\n", "}", "\n", "case", "*", "PackExpansion", ":", "// Expand the pack and replace it with a list of", "// expressions.", "if", "a", ".", "Pack", "!=", "nil", "{", "exprs", ":=", "make", "(", "[", "]", "AST", ",", "len", "(", "a", ".", "Pack", ".", "Args", ")", ")", "\n", "for", "i", ",", "arg", ":=", "range", "a", ".", "Pack", ".", "Args", "{", "copy", ":=", "func", "(", "sub", "AST", ")", "AST", "{", "// Replace the ArgumentPack", "// with a specific argument.", "if", "sub", "==", "a", ".", "Pack", "{", "return", "arg", "\n", "}", "\n", "// Copy everything else.", "return", "nil", "\n", "}", "\n\n", "var", "seen", "[", "]", "AST", "\n", "skip", ":=", "func", "(", "sub", "AST", ")", "bool", "{", "// Don't traverse into another", "// pack expansion.", "if", "_", ",", "ok", ":=", "sub", ".", "(", "*", "PackExpansion", ")", ";", "ok", "{", "return", "true", "\n", "}", "\n", "for", "_", ",", "v", ":=", "range", "seen", "{", "if", "v", "==", "sub", "{", "return", "true", "\n", "}", "\n", "}", "\n", "seen", "=", "append", "(", "seen", ",", "sub", ")", "\n", "return", "false", "\n", "}", "\n\n", "b", ":=", "a", ".", "Base", ".", "Copy", "(", "copy", ",", "skip", ")", "\n", "if", "b", "==", "nil", "{", "b", "=", "a", ".", "Base", "\n", "}", "\n", "exprs", "[", "i", "]", "=", "simplify", "(", "b", ")", "\n", "}", "\n", "return", "&", "ExprList", "{", "Exprs", ":", "exprs", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]