id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
10,000
all-10001
[ "LookPath", "calls", "exec", ".", "LookPath", "." ]
[ "func", "(", "g", "GitOS", ")", "LookPath", "(", "<mask>", "string", ")", "(", "string", ",", "error", ")", "{", "return", "exec", ".", "LookPath", "(", "file", ")", "\n", "}" ]
10,001
all-10002
[ "/", "*", "ProcessEvent", "processes", "all", "events", "come", "from", "the", "control", "parent", ".", "If", "a", "control", "processes", "an", "event", "it", "should", "return", "true", ".", "If", "the", "method", "returns", "false", "it", "means", "that", "the", "control", "do", "not", "want", "or", "cannot", "process", "the", "event", "and", "the", "caller", "sends", "the", "event", "to", "the", "control", "parent" ]
[ "func", "(", "l", "*", "TableView", ")", "ProcessEvent", "(", "event", "Event", ")", "bool", "{", "if", "!", "l", ".", "Active", "(", ")", "||", "!", "l", ".", "Enabled", "(", ")", "{", "return", "false", "\n", "}", "\n\n", "switch", "event", ".", "Type", "{", "case", "EventKey", ":", "if", "l", ".", "onKeyPress", "!=", "nil", "{", "res", ":=", "l", ".", "onKeyPress", "(", "event", ".", "Key", ")", "\n", "if", "res", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "switch", "event", ".", "Key", "{", "case", "term", ".", "KeyHome", ":", "if", "event", ".", "Mod", "==", "term", ".", "ModAlt", "{", "l", ".", "selectedRow", "=", "0", "\n", "l", ".", "EnsureRowVisible", "(", ")", "\n", "l", ".", "emitSelectionChange", "(", ")", "\n", "}", "else", "{", "l", ".", "home", "(", ")", "\n", "}", "\n", "return", "true", "\n", "case", "term", ".", "KeyEnd", ":", "if", "event", ".", "Mod", "==", "term", ".", "ModAlt", "{", "l", ".", "selectedRow", "=", "l", ".", "rowCount", "-", "1", "\n", "l", ".", "EnsureRowVisible", "(", ")", "\n", "l", ".", "emitSelectionChange", "(", ")", "\n", "}", "else", "{", "l", ".", "end", "(", ")", "\n", "}", "\n", "return", "true", "\n", "case", "term", ".", "KeyArrowUp", ":", "l", ".", "moveUp", "(", "1", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyArrowDown", ":", "l", ".", "moveDown", "(", "1", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyArrowLeft", ":", "l", ".", "moveLeft", "(", "1", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyArrowRight", ":", "l", ".", "moveRight", "(", "1", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyPgdn", ":", "l", ".", "moveDown", "(", "l", ".", "height", "-", "3", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyPgup", ":", "l", ".", "moveUp", "(", "l", ".", "height", "-", "3", ")", "\n", "return", "true", "\n", "case", "term", ".", "KeyCtrlM", ",", "term", ".", "KeyF2", ":", "if", "l", ".", "selectedRow", "!=", "-", "1", "&&", "l", ".", "selectedCol", "!=", "-", "1", "&&", "l", ".", "onAction", "!=", "nil", "{", "ev", ":=", "TableEvent", "{", "Action", ":", "TableActionEdit", ",", "Col", ":", "l", ".", "selectedCol", ",", "Row", ":", "l", ".", "selectedRow", "}", "\n", "l", ".", "onAction", "(", "ev", ")", "\n", "}", "\n", "<mask>", "term", ".", "KeyDelete", ":", "if", "l", ".", "selectedRow", "!=", "-", "1", "&&", "l", ".", "onAction", "!=", "nil", "{", "ev", ":=", "TableEvent", "{", "Action", ":", "TableActionDelete", ",", "Col", ":", "l", ".", "selectedCol", ",", "Row", ":", "l", ".", "selectedRow", "}", "\n", "l", ".", "onAction", "(", "ev", ")", "\n", "}", "\n", "case", "term", ".", "KeyInsert", ":", "if", "l", ".", "onAction", "!=", "nil", "{", "ev", ":=", "TableEvent", "{", "Action", ":", "TableActionNew", ",", "Col", ":", "l", ".", "selectedCol", ",", "Row", ":", "l", ".", "selectedRow", "}", "\n", "l", ".", "onAction", "(", "ev", ")", "\n", "}", "\n", "case", "term", ".", "KeyF4", ":", "if", "l", ".", "onAction", "!=", "nil", "{", "colID", ":=", "l", ".", "selectedCol", "\n", "sort", ":=", "l", ".", "columns", "[", "colID", "]", ".", "Sort", "\n\n", "for", "idx", ":=", "range", "l", ".", "columns", "{", "l", ".", "columns", "[", "idx", "]", ".", "Sort", "=", "SortNone", "\n", "}", "\n\n", "if", "sort", "==", "SortAsc", "{", "sort", "=", "SortDesc", "\n", "}", "else", "if", "sort", "==", "SortNone", "{", "sort", "=", "SortAsc", "\n", "}", "else", "{", "sort", "=", "SortNone", "\n", "}", "\n", "l", ".", "columns", "[", "colID", "]", ".", "Sort", "=", "sort", "\n\n", "ev", ":=", "TableEvent", "{", "Action", ":", "TableActionSort", ",", "Col", ":", "colID", ",", "Row", ":", "-", "1", ",", "Sort", ":", "sort", "}", "\n", "l", ".", "onAction", "(", "ev", ")", "\n", "}", "\n", "default", ":", "return", "false", "\n", "}", "\n", "case", "EventMouse", ":", "return", "l", ".", "processMouseClick", "(", "event", ")", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
10,002
all-10003
[ "GetArticle", "returns", "the", "specific", "Article", ".", "You", "ll", "notice", "it", "just", "fetches", "the", "Article", "right", "off", "the", "context", "as", "its", "understood", "that", "if", "we", "made", "it", "this", "far", "the", "Article", "must", "be", "on", "the", "context", ".", "In", "case", "its", "not", "due", "to", "a", "bug", "then", "it", "will", "panic", "and", "our", "Recoverer", "will", "save", "us", "." ]
[ "func", "GetArticle", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "// Assume if we've reach this far, we can access the article", "// context because this handler is a child of the ArticleCtx", "// middleware. The worst case, the recoverer middleware will save us.", "article", ":=", "r", ".", "Context", "(", ")", ".", "Value", "(", "\"", "\"", ")", ".", "(", "*", "Article", ")", "\n\n", "if", "err", ":=", "render", ".", "Render", "(", "w", ",", "r", ",", "NewArticleResponse", "(", "article", ")", ")", ";", "err", "!=", "nil", "{", "<mask>", ".", "Render", "(", "w", ",", "r", ",", "ErrRender", "(", "err", ")", ")", "\n", "return", "\n", "}", "\n", "}" ]
10,003
all-10004
[ "NewMConnectionWithConfig", "wraps", "net", ".", "Conn", "and", "creates", "multiplex", "connection", "with", "a", "config" ]
[ "func", "NewMConnectionWithConfig", "(", "conn", "net", ".", "Conn", ",", "chDescs", "[", "]", "*", "ChannelDescriptor", ",", "onReceive", "receiveCbFunc", ",", "onError", "errorCbFunc", ",", "config", "*", "MConnConfig", ")", "*", "MConnection", "{", "mconn", ":=", "&", "MConnection", "{", "conn", ":", "conn", ",", "bufReader", ":", "bufio", ".", "NewReaderSize", "(", "conn", ",", "minReadBufferSize", ")", ",", "bufWriter", ":", "bufio", ".", "NewWriterSize", "(", "conn", ",", "minWriteBufferSize", ")", ",", "sendMonitor", ":", "flow", ".", "New", "(", "0", ",", "0", ")", ",", "recvMonitor", ":", "flow", ".", "New", "(", "0", ",", "0", ")", ",", "send", ":", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "pong", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "onReceive", ":", "onReceive", ",", "onError", ":", "onError", ",", "config", ":", "config", ",", "LocalAddress", ":", "NewNetAddress", "(", "conn", ".", "LocalAddr", "(", ")", ")", ",", "RemoteAddress", ":", "NewNetAddress", "(", "conn", ".", "RemoteAddr", "(", ")", ")", ",", "}", "\n\n", "// Create channels", "var", "channelsIdx", "=", "map", "[", "byte", "]", "*", "Channel", "{", "}", "\n", "var", "channels", "=", "[", "]", "*", "<mask>", "{", "}", "\n\n", "for", "_", ",", "desc", ":=", "range", "chDescs", "{", "descCopy", ":=", "*", "desc", "// copy the desc else unsafe access across connections", "\n", "channel", ":=", "newChannel", "(", "mconn", ",", "&", "descCopy", ")", "\n", "channelsIdx", "[", "channel", ".", "id", "]", "=", "channel", "\n", "channels", "=", "append", "(", "channels", ",", "channel", ")", "\n", "}", "\n", "mconn", ".", "channels", "=", "channels", "\n", "mconn", ".", "channelsIdx", "=", "channelsIdx", "\n\n", "mconn", ".", "BaseService", "=", "*", "cmn", ".", "NewBaseService", "(", "log", ",", "\"", "\"", ",", "mconn", ")", "\n\n", "return", "mconn", "\n", "}" ]
10,004
all-10005
[ "startSessionOnce", "creates", "a", "session", "with", "ACS", "and", "handles", "requests", "using", "the", "passed", "in", "arguments" ]
[ "func", "(", "acsSession", "*", "session", ")", "startSessionOnce", "(", ")", "error", "{", "acsEndpoint", ",", "err", ":=", "acsSession", ".", "ecsClient", ".", "DiscoverPollEndpoint", "(", "acsSession", ".", "containerInstanceARN", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "url", ":=", "acsWsURL", "(", "acsEndpoint", ",", "acsSession", ".", "agentConfig", ".", "Cluster", ",", "acsSession", ".", "containerInstanceARN", ",", "acsSession", ".", "taskEngine", ",", "acsSession", ".", "resources", ")", "\n", "client", ":=", "acsSession", ".", "<mask>", ".", "createACSClient", "(", "url", ",", "acsSession", ".", "agentConfig", ")", "\n", "defer", "client", ".", "Close", "(", ")", "\n\n", "return", "acsSession", ".", "startACSSession", "(", "client", ")", "\n", "}" ]
10,005
all-10006
[ "GetWidth", "()", "is", "a", "wrapper", "around", "gtk_print_context_get_width", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintContext", ")", "GetWidth", "(", ")", "float64", "{", "c", ":=", "C", ".", "gtk_print_context_get_width", "(", "pc", ".", "native", "(", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
10,006
all-10007
[ "Verify", "compares", "a", "signature", "against", "the", "input", "data" ]
[ "func", "(", "k", "*", "Secp256k1PublicKey", ")", "Verify", "(", "data", "[", "]", "byte", ",", "sigStr", "[", "]", "byte", ")", "(", "bool", ",", "error", ")", "{", "sig", ",", "err", ":=", "btcec", ".", "ParseDERSignature", "(", "sigStr", ",", "btcec", ".", "S256", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n\n", "hash", ":=", "sha256", ".", "Sum256", "(", "data", ")", "\n", "return", "sig", ".", "Verify", "(", "<mask>", "[", ":", "]", ",", "(", "*", "btcec", ".", "PublicKey", ")", "(", "k", ")", ")", ",", "nil", "\n", "}" ]
10,007
all-10008
[ "apply", "takes", "entries", "received", "from", "Raft", "(", "after", "it", "has", "been", "committed", ")", "and", "applies", "them", "to", "the", "current", "state", "of", "the", "EtcdServer", ".", "The", "given", "entries", "should", "not", "be", "empty", "." ]
[ "func", "(", "s", "*", "EtcdServer", ")", "apply", "(", "es", "[", "]", "raftpb", ".", "Entry", ",", "confState", "*", "raftpb", ".", "ConfState", ",", ")", "(", "appliedt", "uint64", ",", "appliedi", "uint64", ",", "shouldStop", "bool", ")", "{", "for", "i", ":=", "range", "es", "{", "e", ":=", "es", "[", "i", "]", "\n", "switch", "e", ".", "Type", "{", "case", "raftpb", ".", "EntryNormal", ":", "s", ".", "applyEntryNormal", "(", "&", "e", ")", "\n", "s", ".", "setAppliedIndex", "(", "e", ".", "Index", ")", "\n", "s", ".", "setTerm", "(", "e", ".", "Term", ")", "\n\n", "case", "raftpb", ".", "EntryConfChange", ":", "// set the consistent index of current executing entry", "if", "e", ".", "<mask>", ">", "s", ".", "consistIndex", ".", "ConsistentIndex", "(", ")", "{", "s", ".", "consistIndex", ".", "setConsistentIndex", "(", "e", ".", "Index", ")", "\n", "}", "\n", "var", "cc", "raftpb", ".", "ConfChange", "\n", "pbutil", ".", "MustUnmarshal", "(", "&", "cc", ",", "e", ".", "Data", ")", "\n", "removedSelf", ",", "err", ":=", "s", ".", "applyConfChange", "(", "cc", ",", "confState", ")", "\n", "s", ".", "setAppliedIndex", "(", "e", ".", "Index", ")", "\n", "s", ".", "setTerm", "(", "e", ".", "Term", ")", "\n", "shouldStop", "=", "shouldStop", "||", "removedSelf", "\n", "s", ".", "w", ".", "Trigger", "(", "cc", ".", "ID", ",", "&", "confChangeResponse", "{", "s", ".", "cluster", ".", "Members", "(", ")", ",", "err", "}", ")", "\n\n", "default", ":", "if", "lg", ":=", "s", ".", "getLogger", "(", ")", ";", "lg", "!=", "nil", "{", "lg", ".", "Panic", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "e", ".", "Type", ".", "String", "(", ")", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Panicf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "appliedi", ",", "appliedt", "=", "e", ".", "Index", ",", "e", ".", "Term", "\n", "}", "\n", "return", "appliedt", ",", "appliedi", ",", "shouldStop", "\n", "}" ]
10,008
all-10009
[ "enable", "or", "disable", "writing", "into", "the", "depth", "buffer" ]
[ "func", "DepthMask", "(", "flag", "bool", ")", "{", "C", ".", "glowDepthMask", "(", "gpDepthMask", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "<mask>", ")", ")", ")", "\n", "}" ]
10,009
all-10010
[ "SetDefaultSize", "is", "a", "wrapper", "around", "gtk_window_set_default_size", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "SetDefaultSize", "(", "width", ",", "<mask>", "int", ")", "{", "C", ".", "gtk_window_set_default_size", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "width", ")", ",", "C", ".", "gint", "(", "height", ")", ")", "\n", "}" ]
10,010
all-10011
[ "Next", "retrieves", "the", "next", "relevant", "log", "message", "from", "pachd" ]
[ "func", "(", "l", "*", "LogsIter", ")", "Next", "(", ")", "bool", "{", "if", "l", ".", "err", "!=", "nil", "{", "l", ".", "msg", "=", "nil", "\n", "return", "false", "\n", "}", "\n", "l", ".", "msg", ",", "l", ".", "err", "=", "l", ".", "logsClient", ".", "Recv", "(", ")", "\n", "if", "l", ".", "err", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "true", "\n", "}" ]
10,011
all-10012
[ "SetValue", "sets", "header", "value", "of", "current", "instance", "." ]
[ "func", "(", "s", "*", "HttpHeader", ")", "SetValue", "(", "value", "string", ")", "*", "HttpHeader", "{", "s", ".", "Value", "=", "<mask>", "\n", "return", "s", "\n", "}" ]
10,012
all-10013
[ "SaveDevIDs", "saves", "the", "device", "s", "current", "key", "and", "also", "the", "device_address", ".", "The", "latter", "is", "a", "computed", "schema", "field", "that", "contains", "the", "controller", "type", "the", "controller", "s", "bus", "number", "and", "the", "device", "s", "unit", "number", "on", "that", "controller", ".", "This", "helps", "locate", "the", "device", "when", "the", "key", "is", "in", "flux", "(", "such", "as", "when", "devices", "are", "just", "being", "created", ")", "." ]
[ "func", "(", "r", "*", "Subresource", ")", "SaveDevIDs", "(", "device", "types", ".", "BaseVirtualDevice", ",", "ctlr", "types", ".", "BaseVirtualController", ")", "error", "{", "r", ".", "Set", "(", "\"", "\"", ",", "device", ".", "GetVirtualDevice", "(", ")", ".", "Key", ")", "\n", "addr", ",", "err", ":=", "computeDevAddr", "(", "device", ",", "ctlr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "r", ".", "<mask>", "(", "\"", "\"", ",", "addr", ")", "\n", "return", "nil", "\n", "}" ]
10,013
all-10014
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventShadowRootPopped", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom56", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
10,014
all-10015
[ "PreAccountAddBalanceApprove", "approve", "balance", "if", "amount", "exists", "." ]
[ "func", "(", "w", "*", "Worker", ")", "PreAccountAddBalanceApprove", "(", "job", "*", "data", ".", "Job", ")", "error", "{", "logger", ":=", "w", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "job", ")", "\n\n", "acc", ",", "err", ":=", "w", ".", "relatedAccount", "(", "logger", ",", "job", ",", "data", ".", "JobPreAccountAddBalanceApprove", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "logger", "=", "logger", ".", "Add", "(", "\"", "\"", ",", "acc", ")", "\n\n", "jobData", ",", "err", ":=", "w", ".", "balanceData", "(", "logger", ",", "job", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "addr", ",", "err", ":=", "data", ".", "HexToAddress", "(", "<mask>", ".", "EthAddr", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrParseEthAddr", "\n", "}", "\n\n", "amount", ",", "err", ":=", "w", ".", "ethBack", ".", "PTCBalanceOf", "(", "&", "bind", ".", "CallOpts", "{", "}", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrPTCRetrieveBalance", "\n", "}", "\n\n", "if", "amount", ".", "Uint64", "(", ")", "<", "uint64", "(", "jobData", ".", "Amount", ")", "{", "return", "ErrInsufficientPTCBalance", "\n", "}", "\n\n", "ethBalance", ",", "err", ":=", "w", ".", "ethBalance", "(", "logger", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "wantedEthBalance", ":=", "w", ".", "gasConf", ".", "PTC", ".", "Approve", "*", "jobData", ".", "GasPrice", "\n\n", "if", "wantedEthBalance", ">", "ethBalance", ".", "Uint64", "(", ")", "{", "return", "ErrInsufficientEthBalance", "\n", "}", "\n\n", "key", ",", "err", ":=", "w", ".", "key", "(", "logger", ",", "acc", ".", "PrivateKey", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "auth", ":=", "bind", ".", "NewKeyedTransactor", "(", "key", ")", "\n", "auth", ".", "GasLimit", "=", "w", ".", "gasConf", ".", "PTC", ".", "Approve", "\n", "auth", ".", "GasPrice", "=", "new", "(", "big", ".", "Int", ")", ".", "SetUint64", "(", "jobData", ".", "GasPrice", ")", "\n", "tx", ",", "err", ":=", "w", ".", "ethBack", ".", "PTCIncreaseApproval", "(", "auth", ",", "w", ".", "pscAddr", ",", "new", "(", "big", ".", "Int", ")", ".", "SetUint64", "(", "jobData", ".", "Amount", ")", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Error", "(", "err", ".", "Error", "(", ")", ")", "\n", "return", "ErrPTCIncreaseApproval", "\n", "}", "\n\n", "return", "w", ".", "saveEthTX", "(", "logger", ",", "job", ",", "tx", ",", "\"", "\"", ",", "job", ".", "RelatedType", ",", "job", ".", "RelatedID", ",", "acc", ".", "EthAddr", ",", "data", ".", "HexFromBytes", "(", "w", ".", "pscAddr", ".", "Bytes", "(", ")", ")", ")", "\n", "}" ]
10,015
all-10016
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "RecurringVolumeAttachment", ")", "Locator", "(", "api", "*", "API", ")", "*", "RecurringVolumeAttachmentLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "RecurringVolumeAttachmentLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
10,016
all-10017
[ "Unique", "sends", "the", "given", "value", "to", "a", "set", "bucket", "." ]
[ "func", "(", "c", "*", "Client", ")", "Unique", "(", "bucket", "string", ",", "value", "string", ")", "{", "if", "c", ".", "skip", "(", ")", "{", "return", "\n", "}", "\n", "c", ".", "conn", ".", "<mask>", "(", "c", ".", "prefix", ",", "bucket", ",", "value", ",", "c", ".", "tags", ")", "\n", "}" ]
10,017
all-10018
[ "Native", "returns", "a", "pointer", "to", "the", "underlying", "GObject", ".", "This", "is", "implemented", "here", "rather", "than", "calling", "Native", "on", "the", "embedded", "Object", "to", "prevent", "a", "nil", "pointer", "dereference", "." ]
[ "func", "(", "v", "*", "InitiallyUnowned", ")", "Native", "(", ")", "uintptr", "{", "if", "v", "==", "nil", "||", "v", ".", "<mask>", "==", "nil", "{", "return", "uintptr", "(", "unsafe", ".", "Pointer", "(", "nil", ")", ")", "\n", "}", "\n", "return", "v", ".", "Object", ".", "Native", "(", ")", "\n", "}" ]
10,018
all-10019
[ "WhoamiCmd", "returns", "a", "cobra", ".", "Command", "that", "deletes", "your", "local", "Pachyderm", "credential", "logging", "you", "out", "of", "your", "cluster", ".", "Note", "that", "this", "is", "not", "necessary", "to", "do", "before", "logging", "in", "as", "another", "user", "but", "is", "useful", "for", "testing", "." ]
[ "func", "WhoamiCmd", "(", "noMetrics", ",", "noPortForwarding", "*", "bool", ")", "*", "cobra", ".", "Command", "{", "whoami", ":=", "&", "cobra", ".", "Command", "{", "Short", ":", "\"", "\"", ",", "Long", ":", "\"", "\"", ",", "Run", ":", "cmdutil", ".", "Run", "(", "func", "(", "[", "]", "string", ")", "error", "{", "c", ",", "err", ":=", "<mask>", ".", "NewOnUserMachine", "(", "!", "*", "noMetrics", ",", "!", "*", "noPortForwarding", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "defer", "c", ".", "Close", "(", ")", "\n", "resp", ",", "err", ":=", "c", ".", "WhoAmI", "(", "c", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "WhoAmIRequest", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", ")", "\n", "}", "\n", "fmt", ".", "Printf", "(", "\"", "\\\"", "\\\"", "\\n", "\"", ",", "resp", ".", "Username", ")", "\n", "if", "resp", ".", "TTL", ">", "0", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "time", ".", "Now", "(", ")", ".", "Add", "(", "time", ".", "Duration", "(", "resp", ".", "TTL", ")", "*", "time", ".", "Second", ")", ".", "Format", "(", "time", ".", "RFC822", ")", ")", "\n", "}", "\n", "if", "resp", ".", "IsAdmin", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ",", "}", "\n", "return", "cmdutil", ".", "CreateAlias", "(", "whoami", ",", "\"", "\"", ")", "\n", "}" ]
10,019
all-10020
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CrashParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser17", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
10,020
all-10021
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "AddScriptToEvaluateOnNewDocumentParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage84", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
10,021
all-10022
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetNodeNameParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
10,022
all-10023
[ "/", "*", "Create", "an", "idmap", "of", "the", "current", "allocation" ]
[ "func", "CurrentIdmapSet", "(", ")", "(", "*", "IdmapSet", ",", "error", ")", "{", "idmapset", ":=", "new", "(", "IdmapSet", ")", "\n\n", "if", "<mask>", ".", "PathExists", "(", "\"", "\"", ")", "{", "// Parse the uidmap", "entries", ",", "err", ":=", "getFromProc", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "entry", ":=", "range", "entries", "{", "e", ":=", "IdmapEntry", "{", "Isuid", ":", "true", ",", "Nsid", ":", "entry", "[", "0", "]", ",", "Hostid", ":", "entry", "[", "1", "]", ",", "Maprange", ":", "entry", "[", "2", "]", "}", "\n", "idmapset", ".", "Idmap", "=", "Extend", "(", "idmapset", ".", "Idmap", ",", "e", ")", "\n", "}", "\n", "}", "else", "{", "// Fallback map", "e", ":=", "IdmapEntry", "{", "Isuid", ":", "true", ",", "Nsid", ":", "0", ",", "Hostid", ":", "0", ",", "Maprange", ":", "0", "}", "\n", "idmapset", ".", "Idmap", "=", "Extend", "(", "idmapset", ".", "Idmap", ",", "e", ")", "\n", "}", "\n\n", "if", "shared", ".", "PathExists", "(", "\"", "\"", ")", "{", "// Parse the gidmap", "entries", ",", "err", ":=", "getFromProc", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "entry", ":=", "range", "entries", "{", "e", ":=", "IdmapEntry", "{", "Isgid", ":", "true", ",", "Nsid", ":", "entry", "[", "0", "]", ",", "Hostid", ":", "entry", "[", "1", "]", ",", "Maprange", ":", "entry", "[", "2", "]", "}", "\n", "idmapset", ".", "Idmap", "=", "Extend", "(", "idmapset", ".", "Idmap", ",", "e", ")", "\n", "}", "\n", "}", "else", "{", "// Fallback map", "e", ":=", "IdmapEntry", "{", "Isgid", ":", "true", ",", "Nsid", ":", "0", ",", "Hostid", ":", "0", ",", "Maprange", ":", "0", "}", "\n", "idmapset", ".", "Idmap", "=", "Extend", "(", "idmapset", ".", "Idmap", ",", "e", ")", "\n", "}", "\n\n", "return", "idmapset", ",", "nil", "\n", "}" ]
10,023
all-10024
[ "export", "FileSequence_Dirname" ]
[ "func", "FileSequence_Dirname", "(", "id", "FileSeqId", ")", "*", "C", ".", "<mask>", "{", "fs", ",", "ok", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", "\n", "// caller must free string", "if", "!", "ok", "{", "return", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "C", ".", "CString", "(", "fs", ".", "Dirname", "(", ")", ")", "\n", "}" ]
10,024
all-10025
[ "NewWriter", "creates", "writer", "that", "logs", "messages", "to", "out", ".", "If", "the", "output", "writer", "is", "a", "terminal", "device", "the", "output", "will", "be", "formatted", "for", "improved", "readability", "." ]
[ "func", "NewWriter", "(", "out", "io", ".", "<mask>", ")", "*", "Writer", "{", "w", ":=", "&", "Writer", "{", "printer", ":", "newPrinter", "(", "out", ")", ",", "}", "\n", "return", "w", "\n", "}" ]
10,025
all-10026
[ "MSetsys", "sets", "multiple", "values", "of", "the", "environment", "variables", "named", "by", "the", "keys", "that", "affects", "the", "system", "as", "a", "whole", ".", "You", "must", "be", "Root", ".", "It", "returns", "an", "error", "if", "any", "." ]
[ "func", "MSetsys", "(", "keys", ",", "<mask>", "[", "]", "string", ")", "error", "{", "if", "!", "_IS_ROOT", "{", "return", "ErrNoRoot", "\n", "}", "\n", "return", "_MSet", "(", "_SETTINGS", ".", "global", ",", "keys", ",", "values", ")", "\n", "}" ]
10,026
all-10027
[ "MSet", "sets", "multiple", "values", "of", "the", "environment", "variables", "named", "by", "the", "keys", "that", "affects", "the", "current", "user", ".", "It", "returns", "an", "error", "if", "any", "." ]
[ "func", "MSet", "(", "keys", ",", "values", "[", "]", "string", ")", "error", "{", "err", ":=", "_MSet", "(", "_SETTINGS", ".", "user", ",", "keys", ",", "values", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "_SETTINGS", ".", "useKDE", "{", "return", "_MSet", "(", "_SETTINGS", ".", "kde", ",", "<mask>", ",", "values", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
10,027
all-10028
[ "CommentOut", "removes", "the", "comment", "character", "of", "lines", "that", "mach", "any", "regular", "expression", "in", "reLine", "." ]
[ "func", "(", "e", "*", "edit", ")", "CommentOut", "(", "reLine", "[", "]", "string", ")", "error", "{", "allSearch", ":=", "make", "(", "[", "]", "ReplacerAtLine", ",", "len", "(", "reLine", ")", ")", "\n\n", "for", "i", ",", "v", ":=", "<mask>", "reLine", "{", "allSearch", "[", "i", "]", "=", "ReplacerAtLine", "{", "v", ",", "\"", "\"", "+", "e", ".", "CommentChar", "+", "\"", "\"", ",", "\"", "\"", ",", "}", "\n", "}", "\n\n", "return", "e", ".", "ReplaceAtLineN", "(", "allSearch", ",", "1", ")", "\n", "}" ]
10,028
all-10029
[ "AddError", "appends", "an", "error", "to", "a", "list", "of", "general", "errors", "." ]
[ "func", "(", "f", "*", "FormErrors", ")", "AddError", "(", "e", "string", ")", "{", "f", ".", "Errors", "=", "<mask>", "(", "f", ".", "Errors", ",", "e", ")", "\n", "}" ]
10,029
all-10030
[ "CreateChild", "creates", "a", "new", "child", "Identifiable", "under", "the", "given", "parent", "Identifiable", "in", "the", "server", "." ]
[ "func", "(", "s", "*", "Session", ")", "CreateChild", "(", "parent", "Identifiable", ",", "child", "Identifiable", ")", "*", "Error", "{", "url", ",", "berr", ":=", "s", ".", "getURLForChildrenIdentity", "(", "parent", ",", "child", ".", "Identity", "(", ")", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n\n", "buffer", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "if", "err", ":=", "json", ".", "NewEncoder", "(", "buffer", ")", ".", "Encode", "(", "child", ")", ";", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "request", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "url", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "response", ",", "berr", ":=", "s", ".", "send", "(", "request", ",", "nil", ")", "\n", "if", "berr", "!=", "nil", "{", "return", "berr", "\n", "}", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n\n", "body", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "response", ".", "Body", ")", "\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "string", "(", "body", ")", ")", "\n\n", "dest", ":=", "IdentifiablesList", "{", "child", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "body", ",", "&", "dest", ")", ";", "err", "!=", "nil", "{", "return", "NewBambouError", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
10,030
all-10031
[ "xep", "-", "0045", "7", ".", "14" ]
[ "func", "(", "c", "*", "<mask>", ")", "LeaveMUC", "(", "jid", "string", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "fmt", ".", "Fprintf", "(", "c", ".", "conn", ",", "\"", "\"", ",", "c", ".", "jid", ",", "xmlEscape", "(", "jid", ")", ")", "\n", "}" ]
10,031
all-10032
[ "public", "method", "Acquire", "asks", "boskos", "for", "a", "resource", "of", "certain", "type", "in", "certain", "state", "and", "set", "the", "resource", "to", "dest", "state", ".", "Returns", "the", "resource", "on", "success", "." ]
[ "func", "(", "c", "*", "Client", ")", "Acquire", "(", "rtype", ",", "state", ",", "dest", "string", ")", "(", "*", "common", ".", "Resource", ",", "error", ")", "{", "r", ",", "err", ":=", "c", ".", "acquire", "(", "rtype", ",", "state", ",", "dest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "<mask>", ".", "Unlock", "(", ")", "\n", "if", "r", "!=", "nil", "{", "c", ".", "storage", ".", "Add", "(", "*", "r", ")", "\n", "}", "\n\n", "return", "r", ",", "nil", "\n", "}" ]
10,032
all-10033
[ "NewGossipSender", "constructs", "a", "usable", "GossipSender", "." ]
[ "func", "newGossipSender", "(", "makeMsg", "func", "(", "msg", "[", "]", "byte", ")", "protocolMsg", ",", "makeBroadcastMsg", "func", "(", "srcName", "PeerName", ",", "msg", "[", "]", "byte", ")", "protocolMsg", ",", "sender", "protocolSender", ",", "stop", "<-", "chan", "struct", "{", "}", ",", ")", "*", "gossipSender", "{", "more", ":=", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", "\n", "flush", ":=", "make", "(", "chan", "chan", "<-", "bool", ")", "\n", "s", ":=", "&", "gossipSender", "{", "makeMsg", ":", "makeMsg", ",", "makeBroadcastMsg", ":", "makeBroadcastMsg", ",", "sender", ":", "sender", ",", "broadcasts", ":", "make", "(", "map", "[", "PeerName", "]", "GossipData", ")", ",", "more", ":", "more", ",", "flush", ":", "flush", ",", "}", "\n", "go", "s", ".", "run", "(", "<mask>", ",", "more", ",", "flush", ")", "\n", "return", "s", "\n", "}" ]
10,033
all-10034
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SnapshotCommandLogReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
10,034
all-10035
[ "SetTextFunc", "sets", "a", "text", "metric", "to", "a", "function", "[", "called", "at", "flush", "interval", "]" ]
[ "func", "(", "m", "*", "CirconusMetrics", ")", "SetTextFunc", "(", "metric", "string", ",", "fn", "func", "(", ")", "<mask>", ")", "{", "m", ".", "tfm", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "tfm", ".", "Unlock", "(", ")", "\n", "m", ".", "textFuncs", "[", "metric", "]", "=", "fn", "\n", "}" ]
10,035
all-10036
[ "SetLevels", "sets", "a", "list", "of", "levels", "and", "their", "associated", "actions", ".", "It", "replaces", "any", "existing", "level", "/", "effect", "mapping", ".", "If", "an", "unknown", "effect", "is", "supplied", "a", "message", "is", "logged", "." ]
[ "func", "(", "w", "*", "<mask>", ")", "SetLevels", "(", "levels", "map", "[", "string", "]", "string", ")", "{", "w", ".", "mutex", ".", "Lock", "(", ")", "\n", "w", ".", "setLevels", "(", "levels", ")", "\n", "w", ".", "mutex", ".", "Unlock", "(", ")", "\n", "}" ]
10,036
all-10037
[ "flushBatchUnsafe", "attaches", "the", "task", "arn", "s", "container", "events", "to", "TaskStateChange", "event", "by", "creating", "the", "sendable", "event", "list", ".", "It", "then", "submits", "this", "event", "to", "ECS", "asynchronously" ]
[ "func", "(", "handler", "*", "TaskHandler", ")", "flushBatchUnsafe", "(", "taskStateChange", "*", "api", ".", "TaskStateChange", ",", "client", "api", ".", "ECSClient", ")", "{", "taskStateChange", ".", "Containers", "=", "append", "(", "taskStateChange", ".", "Containers", ",", "handler", ".", "tasksToContainerStates", "[", "taskStateChange", ".", "TaskARN", "]", "...", ")", "\n", "// All container events for the task have now been copied to the", "// task state change object. Remove them from the map", "delete", "(", "handler", ".", "tasksToContainerStates", ",", "taskStateChange", ".", "TaskARN", ")", "\n\n", "// Prepare a given event to be sent by adding it to the handler's", "// eventList", "event", ":=", "newSendableTaskEvent", "(", "*", "taskStateChange", ")", "\n", "taskEvents", ":=", "handler", ".", "getTaskEventsUnsafe", "(", "event", ")", "\n\n", "// Add the event to the sendable events queue for the task and", "// start sending it asynchronously if possible", "taskEvents", ".", "sendChange", "(", "event", ",", "<mask>", ",", "handler", ")", "\n", "}" ]
10,037
all-10038
[ "NewDirtyManager", "使用敏感词存储接口创建敏感词管理的实例" ]
[ "func", "NewDirtyManager", "(", "store", "DirtyStore", ",", "checkInterval", "...", "time", ".", "Duration", ")", "*", "DirtyManager", "{", "interval", ":=", "DefaultCheckInterval", "\n", "if", "len", "(", "checkInterval", ")", ">", "0", "{", "interval", "=", "checkInterval", "[", "0", "]", "\n", "}", "\n", "manage", ":=", "&", "DirtyManager", "{", "store", ":", "store", ",", "version", ":", "<mask>", ".", "Version", "(", ")", ",", "filter", ":", "NewNodeChanFilter", "(", "store", ".", "Read", "(", ")", ")", ",", "interval", ":", "interval", ",", "}", "\n", "go", "func", "(", ")", "{", "manage", ".", "checkVersion", "(", ")", "\n", "}", "(", ")", "\n", "return", "manage", "\n", "}" ]
10,038
all-10039
[ "Do", "executes", "Browser", ".", "grantPermissions", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "GrantPermissionsParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGrantPermissions", ",", "p", ",", "nil", ")", "\n", "}" ]
10,039
all-10040
[ "SaveToFile", "reads", "a", "file", "from", "request", "by", "field", "name", "and", "saves", "to", "given", "path", "." ]
[ "func", "(", "ctx", "*", "Context", ")", "SaveToFile", "(", "name", ",", "savePath", "string", ")", "error", "{", "fr", ",", "_", ",", "err", ":=", "ctx", ".", "GetFile", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "<mask>", ".", "Close", "(", ")", "\n\n", "fw", ",", "err", ":=", "os", ".", "OpenFile", "(", "savePath", ",", "os", ".", "O_WRONLY", "|", "os", ".", "O_CREATE", "|", "os", ".", "O_TRUNC", ",", "0666", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "fw", ".", "Close", "(", ")", "\n\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "fw", ",", "fr", ")", "\n", "return", "err", "\n", "}" ]
10,040
all-10041
[ "Do", "executes", "Fetch", ".", "takeResponseBodyAsStream", "against", "the", "provided", "context", ".", "returns", ":", "stream" ]
[ "func", "(", "p", "*", "TakeResponseBodyAsStreamParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "stream", "io", ".", "StreamHandle", ",", "err", "error", ")", "{", "// execute", "var", "res", "TakeResponseBodyAsStreamReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandTakeResponseBodyAsStream", ",", "p", ",", "&", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Stream", ",", "nil", "\n", "}" ]
10,041
all-10042
[ "CacheRemoteFasthttp", "receives", "a", "fasthttp", "handler", "its", "cache", "expiration", "and", "the", "remote", "address", "of", "the", "remote", "cache", "server", "(", "look", "ListenAndServe", ")", "returns", "a", "remote", "-", "cached", "handler", "You", "can", "add", "validators", "with", "this", "function" ]
[ "func", "CacheRemoteFasthttp", "(", "bodyHandler", "fasthttp", ".", "RequestHandler", ",", "expiration", "<mask>", ".", "Duration", ",", "remoteServerAddr", "string", ")", "*", "fhttp", ".", "ClientHandler", "{", "return", "fhttp", ".", "NewClientHandler", "(", "bodyHandler", ",", "expiration", ",", "remoteServerAddr", ")", "\n", "}" ]
10,042
all-10043
[ "Extract", "belongs", "to", "the", "Tracer", "interface", "." ]
[ "func", "(", "t", "*", "MockTracer", ")", "Extract", "(", "format", "interface", "{", "}", ",", "carrier", "interface", "{", "}", ")", "(", "opentracing", ".", "SpanContext", ",", "error", ")", "{", "extractor", ",", "ok", ":=", "t", ".", "extractors", "[", "format", "]", "\n", "if", "!", "<mask>", "{", "return", "nil", ",", "opentracing", ".", "ErrUnsupportedFormat", "\n", "}", "\n", "return", "extractor", ".", "Extract", "(", "carrier", ")", "\n", "}" ]
10,043
all-10044
[ "OpenNext", "opens", "the", "next", "file", "from", "iter", "for", "reading", "sets", "*", "file", "to", "it", "and", "returns", "true", "on", "the", "success", "case", ".", "If", "no", "more", "documents", "are", "available", "on", "iter", "or", "an", "error", "occurred", "*", "file", "is", "set", "to", "nil", "and", "the", "result", "is", "false", ".", "Errors", "will", "be", "available", "via", "iter", ".", "Err", "()", ".", "The", "iter", "parameter", "must", "be", "an", "iterator", "on", "the", "GridFS", "files", "collection", ".", "Using", "the", "GridFS", ".", "Find", "method", "is", "an", "easy", "way", "to", "obtain", "such", "an", "iterator", "but", "any", "iterator", "on", "the", "collection", "will", "work", ".", "If", "the", "provided", "*", "file", "is", "non", "-", "nil", "OpenNext", "will", "close", "it", "before", "attempting", "to", "iterate", "to", "the", "next", "element", ".", "This", "means", "that", "in", "a", "loop", "one", "only", "has", "to", "worry", "about", "closing", "files", "when", "breaking", "out", "of", "the", "loop", "early", "(", "break", "return", "or", "panic", ")", ".", "For", "example", ":", "gfs", ":", "=", "db", ".", "GridFS", "(", "fs", ")", "query", ":", "=", "gfs", ".", "Find", "(", "nil", ")", ".", "Sort", "(", "filename", ")", "iter", ":", "=", "query", ".", "Iter", "()", "var", "f", "*", "mgo", ".", "GridFile", "for", "gfs", ".", "OpenNext", "(", "iter", "&f", ")", "{", "fmt", ".", "Printf", "(", "Filename", ":", "%s", "\\", "n", "f", ".", "Name", "()", ")", "}", "if", "iter", ".", "Close", "()", "!", "=", "nil", "{", "panic", "(", "iter", ".", "Close", "()", ")", "}" ]
[ "func", "(", "gfs", "*", "GridFS", ")", "OpenNext", "(", "iter", "*", "Iter", ",", "file", "*", "*", "GridFile", ")", "bool", "{", "if", "*", "file", "!=", "nil", "{", "// Ignoring the error here shouldn't be a big deal", "// as we're reading the file and the loop iteration", "// for this file is finished.", "_", "=", "(", "*", "file", ")", ".", "Close", "(", ")", "\n", "}", "\n", "var", "doc", "gfsFile", "\n", "if", "!", "iter", ".", "Next", "(", "&", "doc", ")", "{", "*", "file", "=", "nil", "\n", "return", "false", "\n", "}", "\n", "f", ":=", "gfs", ".", "newFile", "(", ")", "\n", "f", ".", "mode", "=", "gfsReading", "\n", "f", ".", "<mask>", "=", "doc", "\n", "*", "file", "=", "f", "\n", "return", "true", "\n", "}" ]
10,044
all-10045
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventWebSocketFrameError", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork44", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
10,045
all-10046
[ "ListProwJobs", "lists", "prowjobs", "using", "the", "specified", "labelSelector", "in", "the", "client", "s", "specified", "namespace", ".", "Analogous", "to", "kubectl", "get", "prowjobs", "--", "selector", "=", "SELECTOR", "--", "namespace", "=", "client", ".", "namespace" ]
[ "func", "(", "c", "*", "Client", ")", "ListProwJobs", "(", "selector", "string", ")", "(", "[", "]", "prowapi", ".", "ProwJob", ",", "error", ")", "{", "c", ".", "<mask>", "(", "\"", "\"", ",", "selector", ")", "\n", "var", "jl", "struct", "{", "Items", "[", "]", "prowapi", ".", "ProwJob", "`json:\"items\"`", "\n", "}", "\n", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "namespace", ")", ",", "deckPath", ":", "\"", "\"", ",", "query", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "selector", "}", ",", "}", ",", "&", "jl", ")", "\n", "if", "err", "==", "nil", "{", "var", "pjs", "[", "]", "prowapi", ".", "ProwJob", "\n", "for", "_", ",", "pj", ":=", "range", "jl", ".", "Items", "{", "pjs", "=", "append", "(", "pjs", ",", "pj", ")", "\n", "}", "\n", "jl", ".", "Items", "=", "pjs", "\n", "}", "\n", "return", "jl", ".", "Items", ",", "err", "\n", "}" ]
10,046
all-10047
[ "NeighborsIntWithPrecision", "returns", "a", "slice", "of", "uint64s", "that", "correspond", "to", "the", "provided", "hash", "s", "neighbors", "at", "the", "given", "precision", "." ]
[ "func", "NeighborsIntWithPrecision", "(", "hash", "uint64", ",", "bits", "uint", ")", "[", "]", "uint64", "{", "box", ":=", "BoundingBoxIntWithPrecision", "(", "hash", ",", "bits", ")", "\n", "lat", ",", "lng", ":=", "box", ".", "Center", "(", ")", "\n", "latDelta", ":=", "box", ".", "MaxLat", "-", "box", ".", "MinLat", "\n", "lngDelta", ":=", "box", ".", "MaxLng", "-", "box", ".", "MinLng", "\n", "return", "[", "]", "uint64", "{", "// N", "EncodeIntWithPrecision", "(", "lat", "+", "latDelta", ",", "lng", ",", "bits", ")", ",", "// NE,", "EncodeIntWithPrecision", "(", "lat", "+", "latDelta", ",", "lng", "+", "lngDelta", ",", "bits", ")", ",", "// E,", "EncodeIntWithPrecision", "(", "lat", ",", "lng", "+", "lngDelta", ",", "bits", ")", ",", "// SE,", "EncodeIntWithPrecision", "(", "lat", "-", "latDelta", ",", "lng", "+", "lngDelta", ",", "bits", ")", ",", "// S,", "EncodeIntWithPrecision", "(", "lat", "-", "latDelta", ",", "lng", ",", "bits", ")", ",", "// SW,", "EncodeIntWithPrecision", "(", "<mask>", "-", "latDelta", ",", "lng", "-", "lngDelta", ",", "bits", ")", ",", "// W,", "EncodeIntWithPrecision", "(", "lat", ",", "lng", "-", "lngDelta", ",", "bits", ")", ",", "// NW", "EncodeIntWithPrecision", "(", "lat", "+", "latDelta", ",", "lng", "-", "lngDelta", ",", "bits", ")", ",", "}", "\n", "}" ]
10,047
all-10048
[ "UpdateShare", "updates", "a", "share" ]
[ "func", "(", "c", "*", "Client", ")", "UpdateShare", "(", "groupid", "string", ",", "resourceid", "string", ",", "obj", "Share", ")", "(", "*", "Share", ",", "error", ")", "{", "url", ":=", "umGroupSharePath", "(", "groupid", ",", "resourceid", ")", "+", "`?depth=`", "+", "c", ".", "<mask>", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Share", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Put", "(", "url", ",", "obj", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
10,048
all-10049
[ "NewPipeline", "creates", "a", "new", "pipeline", "instance", "with", "the", "given", "list", "of", "actions", "." ]
[ "func", "NewPipeline", "(", "actions", "...", "*", "Action", ")", "*", "Pipeline", "{", "// Actions are usually global functions, copying them", "// guarantees each copy has an isolated Result.", "newActions", ":=", "<mask>", "(", "[", "]", "*", "Action", ",", "len", "(", "actions", ")", ")", "\n", "for", "i", ",", "action", ":=", "range", "actions", "{", "newAction", ":=", "&", "Action", "{", "Name", ":", "action", ".", "Name", ",", "Forward", ":", "action", ".", "Forward", ",", "Backward", ":", "action", ".", "Backward", ",", "MinParams", ":", "action", ".", "MinParams", ",", "OnError", ":", "action", ".", "OnError", ",", "}", "\n", "newActions", "[", "i", "]", "=", "newAction", "\n", "}", "\n", "return", "&", "Pipeline", "{", "actions", ":", "newActions", "}", "\n\n", "}" ]
10,049
all-10050
[ "GetCluster", "gets", "the", "cluster", "information", "via", "DNS", "discovery", ".", "Also", "sees", "each", "entry", "as", "a", "separate", "instance", "." ]
[ "func", "GetCluster", "(", "serviceScheme", ",", "service", ",", "name", ",", "dns", "string", ",", "apurls", "types", ".", "URLs", ")", "(", "[", "]", "string", ",", "error", ")", "{", "tempName", ":=", "int", "(", "0", ")", "\n", "tcp2ap", ":=", "make", "(", "map", "[", "string", "]", "url", ".", "URL", ")", "\n\n", "// First, resolve the apurls", "for", "_", ",", "url", ":=", "range", "apurls", "{", "tcpAddr", ",", "err", ":=", "resolveTCPAddr", "(", "\"", "\"", ",", "url", ".", "Host", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "tcp2ap", "[", "tcpAddr", ".", "String", "(", ")", "]", "=", "url", "\n", "}", "\n\n", "stringParts", ":=", "[", "]", "string", "{", "}", "\n", "updateNodeMap", ":=", "func", "(", "service", ",", "scheme", "string", ")", "error", "{", "_", ",", "addrs", ",", "err", ":=", "lookupSRV", "(", "service", ",", "\"", "\"", ",", "dns", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "srv", ":=", "range", "addrs", "{", "port", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "srv", ".", "Port", ")", "\n", "host", ":=", "net", ".", "JoinHostPort", "(", "srv", ".", "Target", ",", "port", ")", "\n", "tcpAddr", ",", "terr", ":=", "resolveTCPAddr", "(", "\"", "\"", ",", "host", ")", "\n", "if", "terr", "!=", "nil", "{", "err", "=", "terr", "\n", "continue", "\n", "}", "\n", "n", ":=", "\"", "\"", "\n", "url", ",", "ok", ":=", "tcp2ap", "[", "tcpAddr", ".", "String", "(", ")", "]", "\n", "if", "<mask>", "{", "n", "=", "name", "\n", "}", "\n", "if", "n", "==", "\"", "\"", "{", "n", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "tempName", ")", "\n", "tempName", "++", "\n", "}", "\n", "// SRV records have a trailing dot but URL shouldn't.", "shortHost", ":=", "strings", ".", "TrimSuffix", "(", "srv", ".", "Target", ",", "\"", "\"", ")", "\n", "urlHost", ":=", "net", ".", "JoinHostPort", "(", "shortHost", ",", "port", ")", "\n", "if", "ok", "&&", "url", ".", "Scheme", "!=", "scheme", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "scheme", "+", "\"", "\"", "+", "urlHost", ",", "service", ",", "url", ".", "String", "(", ")", ")", "\n", "}", "else", "{", "stringParts", "=", "append", "(", "stringParts", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "n", ",", "scheme", ",", "urlHost", ")", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "stringParts", ")", "==", "0", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "err", ":=", "updateNodeMap", "(", "service", ",", "serviceScheme", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "service", ",", "err", ")", "\n", "}", "\n", "return", "stringParts", ",", "nil", "\n", "}" ]
10,050
all-10051
[ "ChangeJobState", "-" ]
[ "func", "(", "director", "*", "BoshDirector", ")", "ChangeJobState", "(", "deploymentName", ",", "jobName", ",", "state", "string", ",", "index", "int", ",", "manifest", "<mask>", ".", "Reader", ")", "(", "taskID", "int", ",", "err", "error", ")", "{", "endpoint", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "director", ".", "ip", ",", "director", ".", "port", ",", "deploymentName", ",", "jobName", ",", "index", ",", "state", ")", "\n", "httpEntity", ":=", "director", ".", "getEntity", "(", "endpoint", ",", "\"", "\"", ")", "\n", "request", ":=", "director", ".", "gateway", ".", "Put", "(", "httpEntity", ",", "manifest", ")", "\n", "resp", ",", "err", ":=", "request", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "return", "retrieveTaskID", "(", "resp", ")", "\n", "}" ]
10,051
all-10052
[ "Generate", "a", "target", "endpoint", "string", "in", "host", ":", "port", "format", "." ]
[ "func", "targetEndpoint", "(", "task", "*", "task", ",", "<mask>", "uint32", ",", "containerNet", "bool", ")", "string", "{", "var", "host", "string", "\n\n", "// Use the task's ipAddress field when it's in a container network", "if", "containerNet", "&&", "len", "(", "task", ".", "IPAddresses", ")", ">", "0", "{", "host", "=", "task", ".", "IPAddresses", "[", "0", "]", ".", "Address", "\n", "}", "else", "{", "host", "=", "task", ".", "Host", "\n", "}", "\n\n", "return", "net", ".", "JoinHostPort", "(", "host", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "port", ")", ")", "\n", "}" ]
10,052
all-10053
[ "GetHeaderValues", "processes", "the", "specified", "header", "for", "RFC", "2047", "encoded", "words", "and", "returns", "all", "existing", "values", "as", "a", "list", "of", "UTF", "-", "8", "strings" ]
[ "func", "(", "e", "*", "Envelope", ")", "GetHeaderValues", "(", "name", "string", ")", "[", "]", "string", "{", "if", "e", ".", "header", "==", "nil", "{", "return", "[", "]", "string", "{", "}", "\n", "}", "\n\n", "rawValues", ":=", "(", "*", "e", ".", "header", ")", "[", "textproto", ".", "CanonicalMIMEHeaderKey", "(", "name", ")", "]", "\n", "var", "values", "[", "]", "string", "\n", "for", "_", ",", "v", ":=", "<mask>", "rawValues", "{", "values", "=", "append", "(", "values", ",", "decodeHeader", "(", "v", ")", ")", "\n", "}", "\n", "return", "values", "\n", "}" ]
10,053
all-10054
[ "GetCreated", "returns", "the", "Created", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "a", "*", "APIKey", ")", "GetCreated", "(", ")", "<mask>", ".", "Time", "{", "if", "a", "==", "nil", "||", "a", ".", "Created", "==", "nil", "{", "return", "time", ".", "Time", "{", "}", "\n", "}", "\n", "return", "*", "a", ".", "Created", "\n", "}" ]
10,054
all-10055
[ "BearerAuth", "sets", "token", "for", "HTTP", "client" ]
[ "func", "BearerAuth", "(", "token", "string", ")", "ClientParam", "{", "return", "func", "(", "c", "*", "<mask>", ")", "error", "{", "c", ".", "auth", "=", "&", "bearerAuth", "{", "token", ":", "token", "}", "\n", "return", "nil", "\n", "}", "\n", "}" ]
10,055
all-10056
[ "GetProfile", "returns", "a", "Profile", "entry", "for", "the", "provided", "name" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetProfile", "(", "name", "string", ")", "(", "*", "api", ".", "Profile", ",", "string", ",", "error", ")", "{", "<mask>", ":=", "api", ".", "Profile", "{", "}", "\n\n", "// Fetch the raw value", "etag", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", ",", "nil", ",", "\"", "\"", ",", "&", "profile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "&", "profile", ",", "etag", ",", "nil", "\n", "}" ]
10,056
all-10057
[ "ItemToResource", "casts", "a", "Item", "back", "to", "a", "Resource" ]
[ "func", "ItemToResource", "(", "i", "Item", ")", "(", "Resource", ",", "error", ")", "{", "res", ",", "ok", ":=", "i", ".", "(", "Resource", ")", "\n", "if", "!", "ok", "{", "return", "<mask>", "{", "}", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ")", "\n", "}", "\n", "return", "res", ",", "nil", "\n", "}" ]
10,057
all-10058
[ "ReadPtrs", "()", ":", "from", "bytes", ".", "Buffer", ".", "Read", "()", ":", "Read", "reads", "the", "next", "len", "(", "p", ")", "interface", "{}", "pointers", "from", "the", "buffer", "or", "until", "the", "buffer", "is", "drained", ".", "The", "return", "value", "n", "is", "the", "number", "of", "bytes", "read", ".", "If", "the", "buffer", "has", "no", "data", "to", "return", "err", "is", "io", ".", "EOF", "(", "unless", "len", "(", "p", ")", "is", "zero", ")", ";", "otherwise", "it", "is", "nil", "." ]
[ "func", "(", "b", "*", "PointerRingBuf", ")", "ReadPtrs", "(", "p", "[", "]", "interface", "{", "}", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "b", ".", "readAndMaybeAdvance", "(", "p", ",", "<mask>", ")", "\n", "}" ]
10,058
all-10059
[ "StoragePoolVolumesGetNames", "gets", "the", "names", "of", "all", "storage", "volumes", "attached", "to", "a", "given", "storage", "pool", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolVolumesGetNames", "(", "poolID", "int64", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "volumeName", "string", "\n", "query", ":=", "\"", "\"", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "poolID", ",", "c", ".", "nodeID", "}", "\n", "outargs", ":=", "[", "]", "interface", "{", "}", "{", "volumeName", "}", "\n\n", "<mask>", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outargs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "string", "{", "}", ",", "err", "\n", "}", "\n\n", "var", "out", "[", "]", "string", "\n\n", "for", "_", ",", "r", ":=", "range", "result", "{", "out", "=", "append", "(", "out", ",", "r", "[", "0", "]", ".", "(", "string", ")", ")", "\n", "}", "\n\n", "return", "out", ",", "nil", "\n", "}" ]
10,059
all-10060
[ "GetManifest", "returns", "the", "image", "s", "manifest", "along", "with", "its", "MIME", "type", "(", "which", "may", "be", "empty", "when", "it", "can", "t", "be", "determined", "but", "the", "manifest", "is", "available", ")", ".", "It", "may", "use", "a", "remote", "(", "=", "slow", ")", "service", ".", "If", "instanceDigest", "is", "not", "nil", "it", "contains", "a", "digest", "of", "the", "specific", "manifest", "instance", "to", "retrieve", "(", "when", "the", "primary", "manifest", "is", "a", "manifest", "list", ")", ";", "this", "never", "happens", "if", "the", "primary", "manifest", "is", "not", "a", "manifest", "list", "(", "e", ".", "g", ".", "if", "the", "source", "never", "returns", "manifest", "lists", ")", "." ]
[ "func", "(", "s", "*", "dirImageSource", ")", "GetManifest", "(", "ctx", "context", ".", "Context", ",", "instanceDigest", "*", "digest", ".", "Digest", ")", "(", "[", "]", "<mask>", ",", "string", ",", "error", ")", "{", "if", "instanceDigest", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "errors", ".", "Errorf", "(", "`Getting target manifest not supported by \"dir:\"`", ")", "\n", "}", "\n", "m", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "s", ".", "ref", ".", "manifestPath", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "m", ",", "manifest", ".", "GuessMIMEType", "(", "m", ")", ",", "err", "\n", "}" ]
10,060
all-10061
[ "Key", "returns", "a", "boolean", "indicating", "whether", "the", "given", "key", "exists", "in", "the", "map", "." ]
[ "func", "(", "s", "*", "Scratch", ")", "Key", "(", "k", "string", ")", "bool", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "_", ",", "<mask>", ":=", "s", ".", "values", "[", "k", "]", "\n", "return", "ok", "\n", "}" ]
10,061
all-10062
[ "SetNodeID", "sets", "the", "Node", "ID", "to", "be", "used", "for", "Version", "1", "UUIDs", ".", "The", "first", "6", "bytes", "of", "id", "are", "used", ".", "If", "id", "is", "less", "than", "6", "bytes", "then", "false", "is", "returned", "and", "the", "Node", "ID", "is", "not", "set", "." ]
[ "func", "SetNodeID", "(", "id", "[", "]", "byte", ")", "bool", "{", "if", "len", "(", "id", ")", "<", "6", "{", "return", "<mask>", "\n", "}", "\n", "defer", "nodeMu", ".", "Unlock", "(", ")", "\n", "nodeMu", ".", "Lock", "(", ")", "\n", "copy", "(", "nodeID", "[", ":", "]", ",", "id", ")", "\n", "ifname", "=", "\"", "\"", "\n", "return", "true", "\n", "}" ]
10,062
all-10063
[ "GetSort", "returns", "the", "Sort", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "ManageStatusDefinition", ")", "GetSort", "(", ")", "<mask>", "{", "if", "m", "==", "nil", "||", "m", ".", "Sort", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "m", ".", "Sort", "\n", "}" ]
10,063
all-10064
[ "EthBalanceAt", "returns", "the", "wei", "balance", "of", "the", "given", "account", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "EthBalanceAt", "(", "ctx", "context", ".", "Context", ",", "owner", "common", ".", "Address", ")", "(", "*", "big", ".", "Int", ",", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "ctx", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "return", "b", ".", "<mask>", ".", "ethClient", "(", ")", ".", "BalanceAt", "(", "ctx2", ",", "owner", ",", "nil", ")", "\n", "}" ]
10,064
all-10065
[ "Init", "validates", "the", "provided", "config" ]
[ "func", "(", "h", "*", "HTTP", ")", "Init", "(", ")", "error", "{", "//apply defaults", "if", "h", ".", "<mask>", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "h", ".", "lasts", "=", "map", "[", "string", "]", "string", "{", "}", "\n", "if", "h", ".", "Interval", "==", "0", "{", "h", ".", "Interval", "=", "5", "*", "time", ".", "Minute", "\n", "}", "\n", "if", "h", ".", "CheckHeaders", "==", "nil", "{", "h", ".", "CheckHeaders", "=", "defaultHTTPCheckHeaders", "\n", "}", "\n", "return", "nil", "\n", "}" ]
10,065
all-10066
[ "OutgoingContextWithLimitAndOffset", "returns", "an", "outgoing", "context", "with", "the", "limit", "and", "offset" ]
[ "func", "OutgoingContextWithLimitAndOffset", "(", "ctx", "<mask>", ".", "Context", ",", "limit", ",", "offset", "uint64", ")", "context", ".", "Context", "{", "var", "pairs", "[", "]", "string", "\n", "if", "limit", "!=", "0", "{", "pairs", "=", "append", "(", "pairs", ",", "\"", "\"", ",", "strconv", ".", "FormatUint", "(", "limit", ",", "10", ")", ")", "\n", "}", "\n", "if", "offset", "!=", "0", "{", "pairs", "=", "append", "(", "pairs", ",", "\"", "\"", ",", "strconv", ".", "FormatUint", "(", "offset", ",", "10", ")", ")", "\n", "}", "\n", "if", "len", "(", "pairs", ")", "==", "0", "{", "return", "ctx", "\n", "}", "\n", "return", "outgoingContextWithMergedMetadata", "(", "ctx", ",", "pairs", "...", ")", "\n", "}" ]
10,066
all-10067
[ "TxCommit", "commits", "the", "given", "transaction", "." ]
[ "func", "TxCommit", "(", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "err", ":=", "<mask>", ".", "Commit", "(", ")", "\n", "if", "err", "==", "nil", "||", "err", "==", "sql", ".", "ErrTxDone", "{", "// Ignore duplicate commits/rollbacks", "return", "nil", "\n", "}", "\n", "return", "err", "\n", "}" ]
10,067
all-10068
[ "NewClient", "to", "create", "a", "new", "client" ]
[ "func", "NewClient", "(", "username", ",", "oauth", "string", ")", "*", "<mask>", "{", "return", "&", "Client", "{", "ircUser", ":", "username", ",", "ircToken", ":", "oauth", ",", "TLS", ":", "true", ",", "channels", ":", "map", "[", "string", "]", "bool", "{", "}", ",", "channelUserlist", ":", "map", "[", "string", "]", "map", "[", "string", "]", "bool", "{", "}", ",", "channelsMtx", ":", "&", "sync", ".", "RWMutex", "{", "}", ",", "messageReceived", ":", "make", "(", "chan", "bool", ")", ",", "read", ":", "make", "(", "chan", "string", ",", "ReadBufferSize", ")", ",", "write", ":", "make", "(", "chan", "string", ",", "WriteBufferSize", ")", ",", "// NOTE: IdlePingInterval must be higher than PongTimeout", "SendPings", ":", "true", ",", "IdlePingInterval", ":", "time", ".", "Second", "*", "15", ",", "PongTimeout", ":", "time", ".", "Second", "*", "5", ",", "channelUserlistMutex", ":", "&", "sync", ".", "RWMutex", "{", "}", ",", "}", "\n", "}" ]
10,068
all-10069
[ "WriteTo", "writes", "cookie", "representation", "to", "w", ".", "WriteTo", "implements", "io", ".", "WriterTo", "interface", "." ]
[ "func", "(", "c", "*", "Cookie", ")", "WriteTo", "(", "w", "<mask>", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "n", ",", "err", ":=", "w", ".", "Write", "(", "c", ".", "Cookie", "(", ")", ")", "\n", "return", "int64", "(", "n", ")", ",", "err", "\n", "}" ]
10,069
all-10070
[ "Columns", "selects", "which", "columns", "to", "retrieve", "." ]
[ "func", "(", "q", "*", "Query", ")", "Columns", "(", "<mask>", "...", "string", ")", "*", "Query", "{", "q", ".", "headers", "=", "append", "(", "q", ".", "headers", ",", "\"", "\"", "+", "strings", ".", "Join", "(", "names", ",", "\"", "\"", ")", ")", "\n", "q", ".", "columns", "=", "names", "\n", "return", "q", "\n", "}" ]
10,070
all-10071
[ "ProjectCreate", "adds", "a", "new", "project", "to", "the", "database", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ProjectCreate", "(", "object", "api", ".", "ProjectsPost", ")", "(", "int64", ",", "error", ")", "{", "// Check if a project with the same key exists.", "exists", ",", "err", ":=", "c", ".", "ProjectExists", "(", "object", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "exists", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "args", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "2", ")", "\n\n", "// Populate the statement arguments.", "args", "[", "0", "]", "=", "object", ".", "Description", "\n", "args", "[", "1", "]", "=", "object", ".", "Name", "\n\n", "// Prepared statement to use.", "stmt", ":=", "c", ".", "stmt", "(", "projectCreate", ")", "\n\n", "// Execute the statement.", "result", ",", "err", ":=", "stmt", ".", "Exec", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "id", ",", "err", ":=", "<mask>", ".", "LastInsertId", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Insert config reference.", "stmt", "=", "c", ".", "stmt", "(", "projectCreateConfigRef", ")", "\n", "for", "key", ",", "value", ":=", "range", "object", ".", "Config", "{", "_", ",", "err", ":=", "stmt", ".", "Exec", "(", "id", ",", "key", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "return", "id", ",", "nil", "\n", "}" ]
10,071
all-10072
[ "ResumeAll", "resumes", "all", "pending", "transactions", ".", "All", "ErrAborted", "errors", "from", "individual", "transactions", "are", "ignored", "." ]
[ "func", "(", "r", "*", "Runner", ")", "ResumeAll", "(", ")", "(", "err", "error", ")", "{", "debugf", "(", "\"", "\"", ")", "\n", "iter", ":=", "r", ".", "tc", ".", "Find", "(", "bson", ".", "D", "{", "{", "\"", "\"", ",", "bson", ".", "D", "{", "{", "\"", "\"", ",", "[", "]", "state", "{", "tpreparing", ",", "tprepared", ",", "tapplying", "}", "}", "}", "}", "}", ")", ".", "Iter", "(", ")", "\n", "var", "t", "transaction", "\n", "for", "iter", ".", "Next", "(", "&", "t", ")", "{", "if", "t", ".", "State", "==", "tapplied", "||", "t", ".", "State", "==", "taborted", "{", "continue", "\n", "}", "\n", "debugf", "(", "\"", "\"", ",", "t", ".", "Id", ",", "t", ".", "State", ")", "\n", "if", "err", ":=", "<mask>", "(", "r", ",", "&", "t", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "t", ".", "done", "(", ")", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "&", "t", ",", "t", ".", "State", ")", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
10,072
all-10073
[ "Use", "adds", "a", "middleware", "Handler", "to", "the", "stack", "and", "panics", "if", "the", "handler", "is", "not", "a", "callable", "func", ".", "Middleware", "Handlers", "are", "invoked", "in", "the", "order", "that", "they", "are", "added", "." ]
[ "func", "(", "m", "*", "Macaron", ")", "Use", "(", "handler", "Handler", ")", "{", "handler", "=", "validateAndWrapHandler", "(", "<mask>", ")", "\n", "m", ".", "handlers", "=", "append", "(", "m", ".", "handlers", ",", "handler", ")", "\n", "}" ]
10,073
all-10074
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventFrameResized", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage62", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
10,074
all-10075
[ "New", "creates", "a", "new", "sentinel", "server", "group", "." ]
[ "func", "New", "(", "opts", "...", "Option", ")", "(", "*", "Sentinel", ",", "error", ")", "{", "s", ":=", "&", "Sentinel", "{", "shutdownDuration", ":", "DefaultShutdownDuration", ",", "logf", ":", "func", "(", "string", ",", "...", "interface", "{", "}", ")", "{", "}", ",", "}", "\n\n", "var", "err", "error", "\n\n", "// apply options", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "err", "=", "o", "(", "s", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "// ensure sigs set", "if", "s", ".", "shutdownSigs", "==", "nil", "{", "s", ".", "shutdownSigs", "=", "[", "]", "os", ".", "Signal", "{", "<mask>", ".", "Interrupt", "}", "\n", "}", "\n\n", "// ensure errf set", "if", "s", ".", "errf", "==", "nil", "{", "s", ".", "errf", "=", "func", "(", "str", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "s", ".", "logf", "(", "\"", "\"", "+", "str", ",", "v", "...", ")", "\n", "}", "\n", "}", "\n\n", "return", "s", ",", "nil", "\n", "}" ]
10,075
all-10076
[ "ShouldDebug", "returns", "true", "if", "the", "given", "facility", "has", "debugging", "enabled", "." ]
[ "func", "(", "l", "*", "logger", ")", "ShouldDebug", "(", "facility", "string", ")", "bool", "{", "l", ".", "mut", ".", "Lock", "(", ")", "\n", "<mask>", ":=", "l", ".", "debug", "[", "facility", "]", "\n", "l", ".", "mut", ".", "Unlock", "(", ")", "\n", "return", "res", "\n", "}" ]
10,076
all-10077
[ "Enabled", "returns", "true", "if", "all", "of", "the", "elements", "that", "the", "selection", "refers", "to", "are", "enabled", "." ]
[ "func", "(", "s", "*", "Selection", ")", "Enabled", "(", ")", "(", "bool", ",", "error", ")", "{", "return", "s", ".", "hasState", "(", "<mask>", ".", "Element", ".", "IsEnabled", ",", "\"", "\"", ")", "\n", "}" ]
10,077
all-10078
[ "Warningm", "executes", "the", "same", "function", "on", "the", "default", "Base", "instance" ]
[ "func", "Warningm", "(", "m", "*", "Attrs", ",", "msg", "string", ",", "a", "...", "<mask>", "{", "}", ")", "error", "{", "return", "curDefault", ".", "Warningm", "(", "m", ",", "msg", ",", "a", "...", ")", "\n", "}" ]
10,078
all-10079
[ "Execute", "-", "updates", "org", "configuration" ]
[ "func", "(", "c", "*", "RenameOrgConfigurationCommand", ")", "Execute", "(", "args", "[", "]", "string", ")", "error", "{", "c", ".", "initConfig", "(", ")", "\n", "orgs", ",", "err", ":=", "c", ".", "ConfigManager", ".", "Orgs", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "orgConfig", ",", "err", ":=", "c", ".", "ConfigManager", ".", "GetOrgConfig", "(", "c", ".", "OrgName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "orgSpaces", ",", "err", ":=", "c", ".", "ConfigManager", ".", "OrgSpaces", "(", "c", ".", "OrgName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "orgConfig", ".", "Org", "=", "c", ".", "NewOrgName", "\n", "orgConfig", ".", "OriginalOrg", "=", "c", ".", "OrgName", "\n", "if", "err", ":=", "c", ".", "ConfigManager", ".", "RenameOrgConfig", "(", "orgConfig", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "orgs", ".", "Replace", "(", "orgConfig", ".", "OriginalOrg", ",", "orgConfig", ".", "Org", ")", "\n\n", "if", "err", ":=", "c", ".", "ConfigManager", ".", "SaveOrgs", "(", "orgs", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "orgSpaces", ".", "Org", "=", "c", ".", "NewOrgName", "\n", "if", "err", ":=", "c", ".", "ConfigManager", ".", "SaveOrgSpaces", "(", "orgSpaces", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "_", ",", "spaceName", ":=", "<mask>", "orgSpaces", ".", "Spaces", "{", "spaceConfig", ",", "err", ":=", "c", ".", "ConfigManager", ".", "GetSpaceConfig", "(", "orgConfig", ".", "Org", ",", "spaceName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "spaceConfig", ".", "Org", "=", "orgConfig", ".", "Org", "\n", "err", "=", "c", ".", "ConfigManager", ".", "SaveSpaceConfig", "(", "spaceConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "fmt", ".", "Println", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "OrgName", ",", "c", ".", "NewOrgName", ")", ")", "\n", "return", "nil", "\n", "}" ]
10,079
all-10080
[ "GetInt", "property", "." ]
[ "func", "(", "c", "HubConfig", ")", "GetInt", "(", "<mask>", "string", ",", "defval", "int", ")", "int", "{", "val", ",", "ok", ":=", "c", "[", "key", "]", "\n", "if", "ok", "{", "i", ",", "ok", ":=", "val", ".", "(", "int", ")", "\n", "if", "ok", "{", "return", "i", "\n", "}", "\n", "s", ":=", "c", ".", "GetString", "(", "key", ",", "\"", "\"", ")", "\n", "if", "len", "(", "s", ")", ">", "0", "{", "i", ",", "err", ":=", "strconv", ".", "Atoi", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "// TODO handling error on app level", "return", "defval", "\n", "}", "\n", "return", "i", "\n", "}", "\n", "}", "\n", "return", "defval", "\n", "}" ]
10,080
all-10081
[ "copy", "a", "two", "-", "dimensional", "texture", "subimage" ]
[ "func", "CopyTextureSubImage2D", "(", "texture", "uint32", ",", "level", "int32", ",", "xoffset", "int32", ",", "yoffset", "int32", ",", "x", "int32", ",", "y", "int32", ",", "width", "int32", ",", "<mask>", "int32", ")", "{", "syscall", ".", "Syscall9", "(", "gpCopyTextureSubImage2D", ",", "8", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "level", ")", ",", "uintptr", "(", "xoffset", ")", ",", "uintptr", "(", "yoffset", ")", ",", "uintptr", "(", "x", ")", ",", "uintptr", "(", "y", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "height", ")", ",", "0", ")", "\n", "}" ]
10,081
all-10082
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ExecuteSQLReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
10,082
all-10083
[ "VerifyProvider", "accepts", "an", "instance", "of", "*", "testing", ".", "T", "running", "the", "provider", "verification", "with", "granular", "test", "reporting", "and", "automatic", "failure", "reporting", "for", "nice", "simple", "tests", "." ]
[ "func", "(", "p", "*", "Pact", ")", "VerifyProvider", "(", "t", "*", "testing", ".", "T", ",", "request", "<mask>", ".", "VerifyRequest", ")", "(", "types", ".", "ProviderVerifierResponse", ",", "error", ")", "{", "res", ",", "err", ":=", "p", ".", "VerifyProviderRaw", "(", "request", ")", "\n\n", "for", "_", ",", "example", ":=", "range", "res", ".", "Examples", "{", "t", ".", "Run", "(", "example", ".", "Description", ",", "func", "(", "st", "*", "testing", ".", "T", ")", "{", "st", ".", "Log", "(", "example", ".", "FullDescription", ")", "\n", "if", "example", ".", "Status", "!=", "\"", "\"", "{", "t", ".", "Errorf", "(", "\"", "\\n", "\\n", "\"", ",", "example", ".", "FullDescription", ",", "example", ".", "Exception", ".", "Message", ")", "\n", "}", "\n", "}", ")", "\n", "}", "\n\n", "return", "res", ",", "err", "\n", "}" ]
10,083
all-10084
[ "Use", "load", "to", "read", "a", "generated", "files", "config", "file", "and", "populate", "g", "with", "the", "commands", ".", "paths", "-", "from", "-", "repo", "commands", "are", "aggregated", "into", "repoPaths", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "fetch", "these", "and", "load", "them", "via", "g", ".", "loadPaths", "." ]
[ "func", "(", "g", "*", "Group", ")", "load", "(", "r", "io", ".", "Reader", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "repoPaths", "[", "]", "string", "\n", "s", ":=", "bufio", ".", "NewScanner", "(", "r", ")", "\n", "for", "s", ".", "Scan", "(", ")", "{", "l", ":=", "strings", ".", "TrimSpace", "(", "s", ".", "Text", "(", ")", ")", "\n", "if", "l", "==", "\"", "\"", "||", "l", "[", "0", "]", "==", "'#'", "{", "// Ignore comments and empty lines.", "continue", "\n", "}", "\n\n", "fs", ":=", "strings", ".", "Fields", "(", "l", ")", "\n", "if", "len", "(", "fs", ")", "!=", "2", "{", "return", "repoPaths", ",", "&", "ParseError", "{", "line", ":", "l", "}", "\n", "}", "\n\n", "switch", "fs", "[", "0", "]", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "g", ".", "PathPrefixes", "[", "fs", "[", "1", "]", "]", "=", "true", "\n", "case", "\"", "\"", ":", "g", ".", "FilePrefixes", "[", "fs", "[", "1", "]", "]", "=", "true", "\n", "case", "\"", "\"", ":", "g", ".", "FileNames", "[", "fs", "[", "1", "]", "]", "=", "true", "\n", "case", "\"", "\"", ":", "g", ".", "FileNames", "[", "fs", "[", "1", "]", "]", "=", "true", "\n", "case", "\"", "\"", ":", "// Despite the name, this command actually requires a file", "// of paths from the _same_ repo in which the .generated_files", "// config lives.", "repoPaths", "=", "append", "(", "repoPaths", ",", "fs", "[", "1", "]", ")", "\n", "default", ":", "return", "repoPaths", ",", "&", "ParseError", "{", "<mask>", ":", "l", "}", "\n", "}", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "repoPaths", ",", "err", "\n", "}", "\n\n", "return", "repoPaths", ",", "nil", "\n", "}" ]
10,084
all-10085
[ "isFlag", "returns", "true", "if", "a", "token", "is", "a", "flag", "such", "as", "-", "v", "or", "--", "user", "but", "not", "-", "or", "--" ]
[ "func", "isFlag", "(", "s", "string", ")", "bool", "{", "<mask>", "strings", ".", "HasPrefix", "(", "s", ",", "\"", "\"", ")", "&&", "strings", ".", "TrimLeft", "(", "s", ",", "\"", "\"", ")", "!=", "\"", "\"", "\n", "}" ]
10,085
all-10086
[ "Keys", "returns", "a", "slice", "of", "the", "keys", "in", "the", "cache", "from", "oldest", "to", "newest", "." ]
[ "func", "(", "c", "*", "LRU", ")", "Keys", "(", ")", "[", "]", "string", "{", "keys", ":=", "make", "(", "[", "]", "string", ",", "len", "(", "c", ".", "items", ")", ")", "\n", "i", ":=", "0", "\n", "for", "ent", ":=", "c", ".", "evictList", ".", "Back", "(", ")", ";", "ent", "!=", "nil", ";", "ent", "=", "ent", ".", "Prev", "(", ")", "{", "keys", "[", "i", "]", "=", "ent", ".", "Value", ".", "(", "*", "entry", ")", ".", "key", "\n", "i", "++", "\n", "}", "\n", "return", "<mask>", "\n", "}" ]
10,086
all-10087
[ "GetMarginBottom", "is", "a", "wrapper", "around", "gtk_widget_get_margin_bottom", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "GetMarginBottom", "(", ")", "int", "{", "c", ":=", "C", ".", "gtk_widget_get_margin_bottom", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "int", "(", "c", ")", "\n", "}" ]
10,087
all-10088
[ "NewReader", "opens", "a", "file", "for", "reading", "using", "the", "data", "in", "f", "with", "the", "given", "total", "size", "." ]
[ "func", "NewReader", "(", "f", "io", ".", "ReaderAt", ",", "size", "int64", ")", "(", "*", "Reader", ",", "error", ")", "{", "return", "NewReaderEncrypted", "(", "f", ",", "<mask>", ",", "nil", ")", "\n", "}" ]
10,088
all-10089
[ "VerifyBytes", "creates", "a", "signature", "for", "buf", "comparing", "it", "against", "the", "raw", "sig", ".", "If", "the", "sig", "is", "invalid", "then", "ErrInvalidSignature", "is", "returned", "." ]
[ "func", "(", "rs", "*", "RSASigner", ")", "VerifyBytes", "(", "buf", ",", "sig", "[", "]", "byte", ")", "error", "{", "var", "err", "error", "\n\n", "// check rs.pub", "if", "rs", ".", "pub", "==", "nil", "{", "return", "ErrMissingPublicKey", "\n", "}", "\n\n", "// hash", "h", ":=", "rs", ".", "hash", ".", "New", "(", ")", "\n", "_", ",", "err", "=", "h", ".", "Write", "(", "buf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// verify", "err", "=", "rs", ".", "<mask>", ".", "Verify", "(", "rs", ".", "pub", ",", "rs", ".", "hash", ",", "h", ".", "Sum", "(", "nil", ")", ",", "sig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ErrInvalidSignature", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
10,089
all-10090
[ "MapTaskToContainerStatus", "maps", "the", "task", "status", "to", "the", "corresponding", "container", "status" ]
[ "func", "MapTaskToContainerStatus", "(", "desiredState", "TaskStatus", ",", "steadyState", "apicontainerstatus", ".", "ContainerStatus", ")", "apicontainerstatus", ".", "ContainerStatus", "{", "switch", "desiredState", "{", "case", "TaskStatusNone", ":", "return", "apicontainerstatus", ".", "ContainerStatusNone", "\n", "<mask>", "TaskCreated", ":", "return", "apicontainerstatus", ".", "ContainerCreated", "\n", "case", "TaskRunning", ":", "return", "steadyState", "\n", "case", "TaskStopped", ":", "return", "apicontainerstatus", ".", "ContainerStopped", "\n", "}", "\n", "return", "apicontainerstatus", ".", "ContainerStatusNone", "\n", "}" ]
10,090
all-10091
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ClearBrowserCookiesParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork64", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
10,091
all-10092
[ "Next", "moves", "the", "visible", "list", "forward", "one", "item", ".", "If", "the", "selected", "item", "is", "out", "of", "view", "the", "new", "select", "item", "becomes", "the", "first", "visible", "item", ".", "If", "the", "list", "is", "already", "at", "the", "bottom", "nothing", "happens", "." ]
[ "func", "(", "l", "*", "List", ")", "Next", "(", ")", "{", "max", ":=", "len", "(", "l", ".", "<mask>", ")", "-", "1", "\n\n", "if", "l", ".", "cursor", "<", "max", "{", "l", ".", "cursor", "++", "\n", "}", "\n\n", "if", "l", ".", "start", "+", "l", ".", "size", "<=", "l", ".", "cursor", "{", "l", ".", "start", "=", "l", ".", "cursor", "-", "l", ".", "size", "+", "1", "\n", "}", "\n", "}" ]
10,092
all-10093
[ "Import", "-", "allows", "us", "to", "import", "a", "pgdmp", "file", "in", "the", "form", "of", "a", "reader" ]
[ "func", "(", "s", "*", "PgDump", ")", "Import", "(", "lfile", "<mask>", ".", "Reader", ")", "(", "err", "error", ")", "{", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ")", "\n\n", "if", "err", "=", "s", ".", "RemoteOps", ".", "UploadFile", "(", "lfile", ")", ";", "err", "==", "nil", "{", "err", "=", "s", ".", "restore", "(", ")", "\n", "}", "\n", "return", "\n", "}" ]
10,093
all-10094
[ "SetEvaluationTimestamp", "updates", "evaluationTimestamp", "to", "the", "timestamp", "of", "when", "the", "rule", "was", "last", "evaluated", "." ]
[ "func", "(", "r", "*", "AlertingRule", ")", "SetEvaluationTimestamp", "(", "ts", "time", ".", "Time", ")", "{", "r", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "mtx", ".", "Unlock", "(", ")", "\n", "r", ".", "evaluationTimestamp", "=", "<mask>", "\n", "}" ]
10,094
all-10095
[ "Like", "TypeOf", "but", "panics", "instead", "of", "returning", "nil", ".", "Only", "valid", "during", "p", "s", "create", "and", "build", "phases", "." ]
[ "func", "(", "p", "*", "Package", ")", "typeOf", "(", "e", "ast", ".", "Expr", ")", "types", ".", "<mask>", "{", "if", "T", ":=", "p", ".", "info", ".", "TypeOf", "(", "e", ")", ";", "T", "!=", "nil", "{", "return", "T", "\n", "}", "\n", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ",", "p", ".", "Prog", ".", "Fset", ".", "Position", "(", "e", ".", "Pos", "(", ")", ")", ")", ")", "\n", "}" ]
10,095
all-10096
[ "Signature", "generates", "the", "signature", "used", "e", ".", "g", ".", "when", "specifying", "param", "in", "function", "signatures", "." ]
[ "func", "(", "p", "*", "ActionParam", ")", "Signature", "(", ")", "(", "sig", "string", ")", "{", "switch", "t", ":=", "p", ".", "Type", ".", "(", "type", ")", "{", "case", "*", "BasicDataType", ":", "sig", "=", "string", "(", "*", "t", ")", "\n", "case", "*", "ArrayDataType", ":", "cs", ":=", "t", ".", "ElemType", ".", "Signature", "(", ")", "\n", "sig", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "cs", ")", "\n", "case", "*", "ObjectDataType", ":", "sig", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ".", "TypeName", ")", "\n", "case", "*", "EnumerableDataType", ":", "sig", "=", "\"", "\"", "\n", "case", "*", "UploadDataType", ":", "sig", "=", "\"", "\"", "\n", "<mask>", "*", "SourceUploadDataType", ":", "sig", "=", "\"", "\"", "\n", "}", "\n", "return", "\n", "}" ]
10,096
all-10097
[ "OptClientPoolSizePerRoute", "is", "the", "maximum", "number", "of", "active", "connections", "in", "the", "pool", "to", "a", "host", "." ]
[ "func", "OptClientPoolSizePerRoute", "(", "size", "int", ")", "ClientOption", "{", "return", "func", "(", "options", "*", "ClientOptions", ")", "error", "{", "options", ".", "PoolSizePerRoute", "=", "<mask>", "\n", "return", "nil", "\n", "}", "\n", "}" ]
10,097
all-10098
[ "EditMode", "return", "whether", "current", "mode", "is", "Preview", "or", "Edit" ]
[ "func", "(", "bar", "*", "ActionBar", ")", "EditMode", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "bool", "{", "return", "isEditMode", "(", "<mask>", ".", "Admin", ".", "NewContext", "(", "w", ",", "r", ")", ")", "\n", "}" ]
10,098
all-10099
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RequestDataReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
10,099
all-10100
[ "/", "*", "NewSparkChart", "creates", "a", "new", "spark", "chart", ".", "view", "-", "is", "a", "View", "that", "manages", "the", "control", "parent", "-", "is", "container", "that", "keeps", "the", "control", ".", "The", "same", "View", "can", "be", "a", "view", "and", "a", "parent", "at", "the", "same", "time", ".", "w", "and", "h", "-", "are", "minimal", "size", "of", "the", "control", ".", "scale", "-", "the", "way", "of", "scaling", "the", "control", "when", "the", "parent", "is", "resized", ".", "Use", "DoNotScale", "constant", "if", "the", "control", "should", "keep", "its", "original", "size", "." ]
[ "func", "CreateSparkChart", "(", "parent", "Control", ",", "w", ",", "h", "int", ",", "scale", "int", ")", "*", "SparkChart", "{", "c", ":=", "new", "(", "SparkChart", ")", "\n", "c", ".", "BaseControl", "=", "NewBaseControl", "(", ")", "\n\n", "if", "w", "==", "AutoSize", "{", "w", "=", "10", "\n", "}", "\n", "if", "h", "==", "AutoSize", "{", "h", "=", "5", "\n", "}", "\n\n", "c", ".", "parent", "=", "parent", "\n\n", "c", ".", "SetSize", "(", "w", ",", "h", ")", "\n", "c", ".", "SetConstraints", "(", "w", ",", "h", ")", "\n", "c", ".", "tabSkip", "=", "true", "\n", "c", ".", "hiliteMax", "=", "true", "\n", "c", ".", "autosize", "=", "true", "\n", "c", ".", "data", "=", "make", "(", "[", "]", "float64", ",", "0", ")", "\n", "c", ".", "SetScale", "(", "scale", ")", "\n\n", "if", "<mask>", "!=", "nil", "{", "parent", ".", "AddChild", "(", "c", ")", "\n", "}", "\n\n", "return", "c", "\n", "}" ]