id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
11,000
all-11001
[ "NewSdk", "is", "used", "to", "create", "a", "Sdk", "client", "to", "connect", "to", "the", "cloud", "provider", "." ]
[ "func", "NewSdk", "(", ")", "(", "*", "Sdk", ",", "error", ")", "{", "sdk", ":=", "&", "Sdk", "{", "}", "\n", "apiToken", ":=", "getToken", "(", ")", "\n", "if", "apiToken", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "sdk", ".", "<mask>", "=", "packngo", ".", "NewClient", "(", "\"", "\"", ",", "apiToken", ",", "nil", ")", "\n\n", "return", "sdk", ",", "nil", "\n", "}" ]
11,001
all-11002
[ "Write", "performs", "a", "write", "." ]
[ "func", "(", "w", "*", "PutObjectWriteCloserAsync", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "select", "{", "case", "err", ":=", "<-", "w", ".", "errChan", ":", "if", "err", "!=", "nil", "{", "return", "0", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "<mask>", ":", "for", "len", "(", "w", ".", "buf", ")", "+", "len", "(", "p", ")", ">", "cap", "(", "w", ".", "buf", ")", "{", "// Write the bytes that fit into w.buf, then", "// remove those bytes from p.", "i", ":=", "cap", "(", "w", ".", "buf", ")", "-", "len", "(", "w", ".", "buf", ")", "\n", "w", ".", "buf", "=", "append", "(", "w", ".", "buf", ",", "p", "[", ":", "i", "]", "...", ")", "\n", "p", "=", "p", "[", "i", ":", "]", "\n", "w", ".", "writeChan", "<-", "w", ".", "buf", "\n", "w", ".", "buf", "=", "grpcutil", ".", "GetBuffer", "(", ")", "[", ":", "0", "]", "\n", "}", "\n", "w", ".", "buf", "=", "append", "(", "w", ".", "buf", ",", "p", "...", ")", "\n", "}", "\n", "return", "len", "(", "p", ")", ",", "nil", "\n", "}" ]
11,002
all-11003
[ "GetFontName", "gets", "the", "current", "FontData", "with", "fontSize", "as", "a", "string" ]
[ "func", "(", "cs", "*", "ContextStack", ")", "GetFontName", "(", ")", "string", "{", "fontData", ":=", "cs", ".", "FontData", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fontData", ".", "Name", ",", "fontData", ".", "Family", ",", "fontData", ".", "Style", ",", "<mask>", ".", "FontSize", ")", "\n", "}" ]
11,003
all-11004
[ "widthsFromLines", "examines", "a", "list", "of", "strings", "and", "determines", "how", "wide", "each", "column", "should", "be", "considering", "all", "of", "the", "elements", "that", "need", "to", "be", "printed", "within", "it", "." ]
[ "func", "widthsFromLines", "(", "config", "*", "Config", ",", "lines", "[", "]", "string", ")", "[", "]", "int", "{", "widths", ":=", "make", "(", "[", "]", "int", ",", "0", ",", "8", ")", "\n\n", "for", "_", ",", "line", ":=", "<mask>", "lines", "{", "elems", ":=", "elementsFromLine", "(", "config", ",", "line", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "elems", ")", ";", "i", "++", "{", "l", ":=", "runeLen", "(", "elems", "[", "i", "]", ".", "(", "string", ")", ")", "\n", "if", "len", "(", "widths", ")", "<=", "i", "{", "widths", "=", "append", "(", "widths", ",", "l", ")", "\n", "}", "else", "if", "widths", "[", "i", "]", "<", "l", "{", "widths", "[", "i", "]", "=", "l", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "widths", "\n", "}" ]
11,004
all-11005
[ "Position", "implements", "the", "driver", ".", "Error", "interface", "." ]
[ "func", "(", "e", "*", "hdbErrors", ")", "Position", "(", ")", "int", "{", "return", "int", "(", "e", ".", "<mask>", "[", "e", ".", "idx", "]", ".", "errorPosition", ")", "\n", "}" ]
11,005
all-11006
[ "ReadObject", "implements", "ObjectCodec", "." ]
[ "func", "(", "VarintObjectCodec", ")", "ReadObject", "(", "stream", "*", "bufio", ".", "Reader", ",", "v", "interface", "{", "}", ")", "error", "{", "b", ",", "err", ":=", "binary", ".", "ReadUvarint", "(", "stream", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "json", ".", "NewDecoder", "(", "io", ".", "LimitReader", "(", "<mask>", ",", "int64", "(", "b", ")", ")", ")", ".", "Decode", "(", "v", ")", "\n", "}" ]
11,006
all-11007
[ "Copied", "from", "tsdb", "/", "wal", "/", "wal", ".", "go", "so", "we", "do", "not", "have", "to", "open", "a", "WAL", ".", "Plan", "is", "to", "move", "WAL", "watcher", "to", "TSDB", "and", "dedupe", "these", "implementations", "." ]
[ "func", "(", "w", "*", "WALWatcher", ")", "segments", "(", "dir", "string", ")", "(", "[", "]", "int", ",", "error", ")", "{", "files", ",", "err", ":=", "fileutil", ".", "ReadDir", "(", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "refs", "[", "]", "int", "\n", "var", "<mask>", "int", "\n", "for", "_", ",", "fn", ":=", "range", "files", "{", "k", ",", "err", ":=", "strconv", ".", "Atoi", "(", "fn", ")", "\n", "if", "err", "!=", "nil", "{", "continue", "\n", "}", "\n", "if", "len", "(", "refs", ")", ">", "0", "&&", "k", ">", "last", "+", "1", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "refs", "=", "append", "(", "refs", ",", "k", ")", "\n", "last", "=", "k", "\n", "}", "\n", "sort", ".", "Ints", "(", "refs", ")", "\n\n", "return", "refs", ",", "nil", "\n", "}" ]
11,007
all-11008
[ "SetMulti", "is", "a", "batch", "version", "of", "Set", ".", "appengine", ".", "MultiError", "may", "be", "returned", "." ]
[ "func", "(", "cd", "Codec", ")", "SetMulti", "(", "c", "context", ".", "Context", ",", "items", "[", "]", "*", "Item", ")", "error", "{", "return", "<mask>", ".", "set", "(", "c", ",", "items", ",", "pb", ".", "MemcacheSetRequest_SET", ")", "\n", "}" ]
11,008
all-11009
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "TakeResponseBodyForInterceptionAsStreamReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
11,009
all-11010
[ "isConcurrentAccessError", "checks", "an", "error", "to", "see", "if", "it", "s", "of", "the", "ConcurrentAccess", "type", "." ]
[ "func", "isConcurrentAccessError", "(", "err", "error", ")", "bool", "{", "// ConcurrentAccess comes from a task more than it usually does from a direct", "// SOAP call, so we need to handle both here.", "var", "f", "<mask>", ".", "AnyType", "\n", "var", "ok", "bool", "\n", "f", ",", "ok", "=", "vimSoapFault", "(", "err", ")", "\n", "if", "!", "ok", "{", "f", ",", "ok", "=", "taskFault", "(", "err", ")", "\n", "}", "\n", "if", "ok", "{", "switch", "f", ".", "(", "type", ")", "{", "case", "types", ".", "ConcurrentAccess", ",", "*", "types", ".", "ConcurrentAccess", ":", "return", "true", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
11,010
all-11011
[ "EnsureVisible", "makes", "the", "currently", "selected", "item", "visible", "and", "scrolls", "the", "item", "list", "if", "it", "is", "required" ]
[ "func", "(", "l", "*", "ListBox", ")", "EnsureVisible", "(", ")", "{", "length", ":=", "len", "(", "l", ".", "<mask>", ")", "\n\n", "if", "length", "<=", "l", ".", "height", "||", "l", ".", "currSelection", "==", "-", "1", "{", "return", "\n", "}", "\n\n", "diff", ":=", "l", ".", "currSelection", "-", "l", ".", "topLine", "\n", "if", "diff", ">=", "0", "&&", "diff", "<", "l", ".", "height", "{", "return", "\n", "}", "\n\n", "if", "diff", "<", "0", "{", "l", ".", "topLine", "=", "l", ".", "currSelection", "\n", "}", "else", "{", "top", ":=", "l", ".", "currSelection", "-", "l", ".", "height", "+", "1", "\n", "if", "length", "-", "top", ">", "l", ".", "height", "{", "l", ".", "topLine", "=", "top", "\n", "}", "else", "{", "l", ".", "topLine", "=", "length", "-", "l", ".", "height", "\n", "}", "\n", "}", "\n", "}" ]
11,011
all-11012
[ "NewUbuntuCluster", "creates", "a", "simple", "Ubuntu", "Amazon", "cluster" ]
[ "func", "NewUbuntuCluster", "(", "name", "string", ")", "*", "cluster", ".", "Cluster", "{", "controlPlaneProviderConfig", ":=", "&", "cluster", ".", "ControlPlaneProviderConfig", "{", "Cloud", ":", "cluster", ".", "CloudPacket", ",", "Project", ":", "&", "cluster", ".", "Project", "{", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "}", ",", "Location", ":", "\"", "\"", ",", "SSH", ":", "&", "cluster", ".", "SSH", "{", "PublicKeyPath", ":", "\"", "\"", ",", "User", ":", "\"", "\"", ",", "}", ",", "KubernetesAPI", ":", "&", "cluster", ".", "KubernetesAPI", "{", "Port", ":", "\"", "\"", ",", "}", ",", "Values", ":", "&", "cluster", ".", "Values", "{", "ItemMap", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "kubeadm", ".", "GetRandomToken", "(", ")", ",", "}", ",", "}", ",", "}", "\n", "machineSetsProviderConfigs", ":=", "[", "]", "*", "cluster", ".", "MachineProviderConfig", "{", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "<mask>", ":", "cluster", ".", "ServerPoolTypeMaster", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "1", ",", "MinCount", ":", "1", ",", "Image", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "{", "ServerPool", ":", "&", "cluster", ".", "ServerPool", "{", "Type", ":", "cluster", ".", "ServerPoolTypeNode", ",", "Name", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ")", ",", "MaxCount", ":", "1", ",", "MinCount", ":", "1", ",", "Image", ":", "\"", "\"", ",", "Size", ":", "\"", "\"", ",", "BootstrapScripts", ":", "[", "]", "string", "{", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "}", "\n", "c", ":=", "cluster", ".", "NewCluster", "(", "name", ")", "\n", "c", ".", "SetProviderConfig", "(", "controlPlaneProviderConfig", ")", "\n", "c", ".", "NewMachineSetsFromProviderConfigs", "(", "machineSetsProviderConfigs", ")", "\n", "return", "c", "\n", "}" ]
11,012
all-11013
[ "contextConfig", "returns", "the", "loader", "and", "config", "which", "can", "create", "a", "clientconfig", "." ]
[ "func", "contextConfig", "(", ")", "(", "clientcmd", ".", "ClientConfigLoader", ",", "*", "clientcmdapi", ".", "Config", ",", "error", ")", "{", "if", "err", ":=", "ensureKubectl", "(", ")", ";", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "fmt", ".", "Println", "(", "\"", "\"", ",", "err", ")", "\n", "if", "gerr", ":=", "ensureGcloud", "(", ")", ";", "gerr", "!=", "nil", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "gerr", ")", "\n", "}", "\n", "return", "nil", ",", "nil", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "l", ":=", "clientcmd", ".", "NewDefaultClientConfigLoadingRules", "(", ")", "\n", "c", ",", "err", ":=", "l", ".", "Load", "(", ")", "\n", "return", "l", ",", "c", ",", "err", "\n", "}" ]
11,013
all-11014
[ "metricsToPublishMetricRequests", "gets", "task", "metrics", "and", "converts", "them", "to", "a", "list", "of", "PublishMetricRequest", "objects", "." ]
[ "func", "(", "cs", "*", "clientServer", ")", "metricsToPublishMetricRequests", "(", ")", "(", "[", "]", "*", "ecstcs", ".", "PublishMetricsRequest", ",", "error", ")", "{", "metadata", ",", "taskMetrics", ",", "err", ":=", "<mask>", ".", "statsEngine", ".", "GetInstanceMetrics", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "requests", "[", "]", "*", "ecstcs", ".", "PublishMetricsRequest", "\n", "if", "*", "metadata", ".", "Idle", "{", "metadata", ".", "Fin", "=", "aws", ".", "Bool", "(", "true", ")", "\n", "// Idle instance, we have only one request to send to backend.", "requests", "=", "append", "(", "requests", ",", "ecstcs", ".", "NewPublishMetricsRequest", "(", "metadata", ",", "taskMetrics", ")", ")", "\n", "return", "requests", ",", "nil", "\n", "}", "\n", "var", "messageTaskMetrics", "[", "]", "*", "ecstcs", ".", "TaskMetric", "\n", "numTasks", ":=", "len", "(", "taskMetrics", ")", "\n\n", "for", "i", ",", "taskMetric", ":=", "range", "taskMetrics", "{", "messageTaskMetrics", "=", "append", "(", "messageTaskMetrics", ",", "taskMetric", ")", "\n", "var", "requestMetadata", "*", "ecstcs", ".", "MetricsMetadata", "\n", "if", "(", "i", "+", "1", ")", "==", "numTasks", "{", "// If this is the last task to send, set fin to true", "requestMetadata", "=", "copyMetricsMetadata", "(", "metadata", ",", "true", ")", "\n", "}", "else", "{", "requestMetadata", "=", "copyMetricsMetadata", "(", "metadata", ",", "false", ")", "\n", "}", "\n", "if", "(", "i", "+", "1", ")", "%", "tasksInMetricMessage", "==", "0", "{", "// Construct payload with tasksInMetricMessage number of task metrics and send to backend.", "requests", "=", "append", "(", "requests", ",", "ecstcs", ".", "NewPublishMetricsRequest", "(", "requestMetadata", ",", "copyTaskMetrics", "(", "messageTaskMetrics", ")", ")", ")", "\n", "messageTaskMetrics", "=", "messageTaskMetrics", "[", ":", "0", "]", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "messageTaskMetrics", ")", ">", "0", "{", "// Create the new metadata object and set fin to true as this is the last message in the payload.", "requestMetadata", ":=", "copyMetricsMetadata", "(", "metadata", ",", "true", ")", "\n", "// Create a request with remaining task metrics.", "requests", "=", "append", "(", "requests", ",", "ecstcs", ".", "NewPublishMetricsRequest", "(", "requestMetadata", ",", "messageTaskMetrics", ")", ")", "\n", "}", "\n", "return", "requests", ",", "nil", "\n", "}" ]
11,014
all-11015
[ "Create", "a", "new", "Queue", "." ]
[ "func", "(", "c", "*", "QueueService", ")", "Create", "(", "ctx", "context", ".", "Context", ",", "<mask>", "url", ".", "Values", ")", "(", "*", "Queue", ",", "error", ")", "{", "queue", ":=", "new", "(", "Queue", ")", "\n", "err", ":=", "c", ".", "client", ".", "CreateResource", "(", "ctx", ",", "queuePathPart", ",", "data", ",", "queue", ")", "\n", "return", "queue", ",", "err", "\n", "}" ]
11,015
all-11016
[ "recvPeerFrameOfType", "waits", "for", "a", "new", "frame", "of", "a", "given", "type", "from", "the", "peer", "failing", "if", "the", "next", "frame", "received", "is", "not", "of", "that", "type", ".", "If", "an", "error", "frame", "is", "returned", "then", "the", "errorMessage", "is", "returned", "as", "the", "error", "." ]
[ "func", "(", "mex", "*", "messageExchange", ")", "recvPeerFrameOfType", "(", "msgType", "messageType", ")", "(", "*", "Frame", ",", "error", ")", "{", "frame", ",", "err", ":=", "mex", ".", "recvPeerFrame", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "switch", "frame", ".", "Header", ".", "messageType", "{", "<mask>", "msgType", ":", "return", "frame", ",", "nil", "\n\n", "case", "messageTypeError", ":", "// If we read an error frame, we can release it once we deserialize it.", "defer", "mex", ".", "framePool", ".", "Release", "(", "frame", ")", "\n\n", "errMsg", ":=", "errorMessage", "{", "id", ":", "frame", ".", "Header", ".", "ID", ",", "}", "\n", "var", "rbuf", "typed", ".", "ReadBuffer", "\n", "rbuf", ".", "Wrap", "(", "frame", ".", "SizedPayload", "(", ")", ")", "\n", "if", "err", ":=", "errMsg", ".", "read", "(", "&", "rbuf", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "errMsg", "\n\n", "default", ":", "// TODO(mmihic): Should be treated as a protocol error", "mex", ".", "mexset", ".", "log", ".", "WithFields", "(", "LogField", "{", "\"", "\"", ",", "frame", ".", "Header", "}", ",", "LogField", "{", "\"", "\"", ",", "msgType", "}", ",", "LogField", "{", "\"", "\"", ",", "mex", ".", "msgID", "}", ",", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "errUnexpectedFrameType", "\n", "}", "\n", "}" ]
11,016
all-11017
[ "getConnFromAddressProvider", "returns", "a", "connection", "from", "the", "server", "address", "provider", "if", "available", "or", "defaults", "to", "a", "connection", "using", "the", "target", "server", "address" ]
[ "func", "(", "n", "*", "NetworkTransport", ")", "getConnFromAddressProvider", "(", "id", "ServerID", ",", "<mask>", "ServerAddress", ")", "(", "*", "netConn", ",", "error", ")", "{", "address", ":=", "n", ".", "getProviderAddressOrFallback", "(", "id", ",", "target", ")", "\n", "return", "n", ".", "getConn", "(", "address", ")", "\n", "}" ]
11,017
all-11018
[ "translations", "will", "load", "locale", "files", "set", "up", "the", "translator", "actions", ".", "T", "and", "will", "return", "a", "middleware", "to", "use", "to", "load", "the", "correct", "locale", "for", "each", "request", ".", "for", "more", "information", ":", "https", ":", "//", "gobuffalo", ".", "io", "/", "en", "/", "docs", "/", "localization" ]
[ "func", "translations", "(", ")", "buffalo", ".", "MiddlewareFunc", "{", "<mask>", "err", "error", "\n", "if", "T", ",", "err", "=", "i18n", ".", "New", "(", "packr", ".", "New", "(", "\"", "\"", ",", "\"", "\"", ")", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "app", ".", "Stop", "(", "err", ")", "\n", "}", "\n", "return", "T", ".", "Middleware", "(", ")", "\n", "}" ]
11,018
all-11019
[ "Start", "a", "host" ]
[ "func", "(", "d", "*", "SerialDriver", ")", "Start", "(", ")", "<mask>", "{", "d", ".", "Lock", "(", ")", "\n", "defer", "d", ".", "Unlock", "(", ")", "\n", "return", "d", ".", "Driver", ".", "Start", "(", ")", "\n", "}" ]
11,019
all-11020
[ "GetName", "returns", "the", "Name", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "p", "*", "Period", ")", "GetName", "(", ")", "string", "{", "if", "p", "==", "nil", "||", "p", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "p", ".", "Name", "\n", "}" ]
11,020
all-11021
[ "AddRecord", "adds", "a", "record", "to", "the", "report", "." ]
[ "func", "(", "r", "*", "CSVReport", ")", "AddRecord", "(", "label", "string", ",", "elapsed", "time", ".", "Duration", ")", "error", "{", "if", "len", "(", "r", ".", "records", ")", "==", "0", "{", "r", ".", "addRecord", "(", "csvFields", ")", "\n", "}", "\n\n", "<mask>", ":=", "[", "]", "string", "{", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", "/", "int64", "(", "time", ".", "Millisecond", ")", ")", ",", "// timestamp", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "elapsed", "/", "time", ".", "Millisecond", ")", ",", "label", ",", "\"", "\"", ",", "// responseCode is not used", "\"", "\"", ",", "// success\"", "}", "\n", "return", "r", ".", "addRecord", "(", "record", ")", "\n", "}" ]
11,021
all-11022
[ "Headers", "gets", "application", "headers", "out", "of", "the", "context", "." ]
[ "func", "(", "c", "headerCtx", ")", "Headers", "(", ")", "<mask>", "[", "string", "]", "string", "{", "if", "h", ":=", "c", ".", "headers", "(", ")", ";", "h", "!=", "nil", "{", "return", "h", ".", "reqHeaders", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,022
all-11023
[ "Concat", "adds", "the", "other", "result", "to", "this", "result" ]
[ "func", "(", "r", "*", "Result", ")", "Concat", "(", "other", "*", "Result", ")", "{", "for", "_", ",", "dj", ":=", "range", "<mask>", ".", "DeltaJob", "{", "r", ".", "DeltaJob", "=", "append", "(", "r", ".", "DeltaJob", ",", "dj", ")", "\n", "}", "\n", "}" ]
11,023
all-11024
[ "MovePieceToLeft", "tries", "to", "move", "the", "piece", "to", "the", "left", "and", "returns", "the", "piece", "s", "next", "x", "position", "." ]
[ "func", "(", "f", "*", "Field", ")", "MovePieceToLeft", "(", "piece", "*", "Piece", ",", "x", ",", "y", "int", ",", "<mask>", "Angle", ")", "int", "{", "if", "piece", ".", "collides", "(", "f", ",", "x", "-", "1", ",", "y", ",", "angle", ")", "{", "return", "x", "\n", "}", "\n", "return", "x", "-", "1", "\n", "}" ]
11,024
all-11025
[ "UInt32ToBytes", "unwrap", "uint32", "value", "to", "byte", "array", "of", "length", "4", "using", "big", "endian" ]
[ "func", "UInt32ToBytes", "(", "<mask>", "uint32", ")", "[", "]", "byte", "{", "result", ":=", "make", "(", "[", "]", "byte", ",", "4", ")", "\n", "binary", ".", "BigEndian", ".", "PutUint32", "(", "result", ",", "value", ")", "\n\n", "return", "result", "\n", "}" ]
11,025
all-11026
[ "Compress", "is", "a", "middleware", "that", "compresses", "response", "body", "of", "a", "given", "content", "types", "to", "a", "data", "format", "based", "on", "Accept", "-", "Encoding", "request", "header", ".", "It", "uses", "a", "given", "compression", "level", ".", "NOTE", ":", "make", "sure", "to", "set", "the", "Content", "-", "Type", "header", "on", "your", "response", "otherwise", "this", "middleware", "will", "not", "compress", "the", "response", "body", ".", "For", "ex", "in", "your", "handler", "you", "should", "set", "w", ".", "Header", "()", ".", "Set", "(", "Content", "-", "Type", "http", ".", "DetectContentType", "(", "yourBody", "))", "or", "set", "it", "manually", ".", "DEPRECATED" ]
[ "func", "Compress", "(", "level", "int", ",", "types", "...", "string", ")", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "defaultCompressor", "=", "NewCompressor", "(", "level", ",", "<mask>", "...", ")", "\n", "return", "defaultCompressor", ".", "Handler", "(", ")", "\n", "}" ]
11,026
all-11027
[ "retry", "handles", "rate", "limiting", "and", "retry", "logic", "for", "a", "github", "API", "call", "." ]
[ "func", "(", "c", "*", "Client", ")", "retry", "(", "action", "string", ",", "call", "func", "(", ")", "(", "*", "github", ".", "Response", ",", "error", ")", ")", "(", "*", "github", ".", "<mask>", ",", "error", ")", "{", "var", "err", "error", "\n", "var", "resp", "*", "github", ".", "Response", "\n\n", "for", "retryCount", ":=", "0", ";", "retryCount", "<=", "c", ".", "retries", ";", "retryCount", "++", "{", "if", "resp", ",", "err", "=", "call", "(", ")", ";", "err", "==", "nil", "{", "c", ".", "limitRate", "(", "&", "resp", ".", "Rate", ")", "\n", "return", "resp", ",", "nil", "\n", "}", "\n", "switch", "err", ":=", "err", ".", "(", "type", ")", "{", "case", "*", "github", ".", "RateLimitError", ":", "c", ".", "limitRate", "(", "&", "err", ".", "Rate", ")", "\n", "case", "*", "github", ".", "TwoFactorAuthError", ":", "return", "resp", ",", "err", "\n", "case", "*", "retryAbort", ":", "return", "resp", ",", "err", "\n", "}", "\n\n", "if", "retryCount", "==", "c", ".", "retries", "{", "return", "resp", ",", "err", "\n", "}", "\n", "glog", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "action", ",", "err", ")", "\n", "c", ".", "sleepForAttempt", "(", "retryCount", ")", "\n", "}", "\n", "return", "resp", ",", "err", "\n", "}" ]
11,027
all-11028
[ "Append", "adds", "a", "line", "of", "text", "to", "the", "list", ".", "Append", "must", "be", "called", "from", "queue", "." ]
[ "func", "(", "l", "*", "List", ")", "Append", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "s", ":=", "fmt", ".", "Sprintf", "(", "format", ",", "args", "...", ")", "\n", "l", ".", "<mask>", "=", "append", "(", "l", ".", "content", ",", "s", ")", "\n\n", "// adjust at if we are not in a paging operation", "if", "l", ".", "paging", "{", "return", "\n", "}", "\n", "l", ".", "at", "=", "len", "(", "l", ".", "content", ")", "-", "l", ".", "trueH", "\n", "if", "l", ".", "at", "<", "0", "{", "l", ".", "at", "=", "0", "\n", "}", "\n", "}" ]
11,028
all-11029
[ "GetDither", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_dither", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "GetDither", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_print_settings_get_dither", "(", "ps", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "c", ")", ")", "\n", "}" ]
11,029
all-11030
[ "defaultFromTag", "returns", "a", "DEFAULT", "...", "keyword", ".", "If", "default", "tag", "specified", "to", "struct", "field", "it", "use", "as", "the", "default", "value", ".", "If", "it", "doesn", "t", "specify", "it", "returns", "empty", "string", "." ]
[ "func", "(", "db", "*", "DB", ")", "defaultFromTag", "(", "field", "*", "reflect", ".", "StructField", ")", "(", "string", ",", "error", ")", "{", "def", ":=", "field", ".", "Tag", ".", "Get", "(", "dbDefaultTag", ")", "\n", "if", "def", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n", "switch", "<mask>", ".", "Type", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Bool", ":", "b", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "def", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "db", ".", "dialect", ".", "FormatBool", "(", "b", ")", ")", ",", "nil", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "def", ")", ",", "nil", "\n", "}" ]
11,030
all-11031
[ "equal", "returns", "true", "on", "if", "both", "call", "stacks", "are", "exactly", "equal", "." ]
[ "func", "(", "s", "*", "Stack", ")", "equal", "(", "r", "*", "Stack", ")", "bool", "{", "if", "len", "(", "s", ".", "Calls", ")", "!=", "len", "(", "r", ".", "Calls", ")", "||", "s", ".", "Elided", "!=", "r", ".", "Elided", "{", "return", "false", "\n", "}", "\n", "for", "i", ":=", "<mask>", "s", ".", "Calls", "{", "if", "!", "s", ".", "Calls", "[", "i", "]", ".", "equal", "(", "&", "r", ".", "Calls", "[", "i", "]", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
11,031
all-11032
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "NameValue", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot5", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
11,032
all-11033
[ "GetActive", "()", "is", "a", "wrapper", "around", "gtk_combo_box_get_active", "()", "." ]
[ "func", "(", "v", "*", "ComboBox", ")", "GetActive", "(", ")", "int", "{", "c", ":=", "C", ".", "gtk_combo_box_get_active", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "int", "(", "c", ")", "\n", "}" ]
11,033
all-11034
[ "acsWsURL", "returns", "the", "websocket", "url", "for", "ACS", "given", "the", "endpoint" ]
[ "func", "acsWsURL", "(", "endpoint", ",", "cluster", ",", "containerInstanceArn", "string", ",", "taskEngine", "engine", ".", "TaskEngine", ",", "acsSessionState", "sessionState", ")", "string", "{", "acsURL", ":=", "endpoint", "\n", "if", "endpoint", "[", "len", "(", "endpoint", ")", "-", "1", "]", "!=", "'/'", "{", "acsURL", "+=", "\"", "\"", "\n", "}", "\n", "acsURL", "+=", "\"", "\"", "\n", "<mask>", ":=", "url", ".", "Values", "{", "}", "\n", "query", ".", "Set", "(", "\"", "\"", ",", "cluster", ")", "\n", "query", ".", "Set", "(", "\"", "\"", ",", "containerInstanceArn", ")", "\n", "query", ".", "Set", "(", "\"", "\"", ",", "version", ".", "GitHashString", "(", ")", ")", "\n", "query", ".", "Set", "(", "\"", "\"", ",", "version", ".", "Version", ")", "\n", "query", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "dockerVersion", ",", "err", ":=", "taskEngine", ".", "Version", "(", ")", ";", "err", "==", "nil", "{", "query", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", "+", "dockerVersion", ")", "\n", "}", "\n", "query", ".", "Set", "(", "sendCredentialsURLParameterName", ",", "acsSessionState", ".", "getSendCredentialsURLParameter", "(", ")", ")", "\n", "return", "acsURL", "+", "\"", "\"", "+", "query", ".", "Encode", "(", ")", "\n", "}" ]
11,034
all-11035
[ "void", "pango_cairo_update_layout", "(", "cairo_t", "*", "cr", "PangoLayout", "*", "layout", ")", ";" ]
[ "func", "CairoUpdateLayout", "(", "cr", "*", "cairo", ".", "<mask>", ",", "v", "*", "Layout", ")", "{", "C", ".", "pango_cairo_update_layout", "(", "cairo_context", "(", "cr", ")", ",", "v", ".", "native", "(", ")", ")", "\n", "}" ]
11,035
all-11036
[ "Do", "executes", "DOMStorage", ".", "setDOMStorageItem", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetDOMStorageItemParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetDOMStorageItem", ",", "p", ",", "nil", ")", "\n", "}" ]
11,036
all-11037
[ "Publish", "sends", "a", "message", "using", "the", "producer", "p", "returning", "an", "error", "if", "it", "was", "already", "closed", "or", "if", "an", "error", "occurred", "while", "publishing", "the", "message", ".", "Note", "that", "no", "retry", "is", "done", "internally", "the", "producer", "will", "fail", "after", "the", "first", "unsuccessful", "attempt", "to", "publish", "the", "message", ".", "It", "is", "the", "responsibility", "of", "the", "caller", "to", "retry", "if", "necessary", "." ]
[ "func", "(", "p", "*", "Producer", ")", "Publish", "(", "message", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "return", "p", ".", "PublishTo", "(", "p", ".", "<mask>", ",", "message", ")", "\n", "}" ]
11,037
all-11038
[ "NewDatumFactory", "creates", "a", "datumFactory", "for", "an", "input", "." ]
[ "func", "NewDatumFactory", "(", "pachClient", "*", "client", ".", "APIClient", ",", "input", "*", "pps", ".", "Input", ")", "(", "DatumFactory", ",", "error", ")", "{", "switch", "{", "case", "input", ".", "Pfs", "!=", "nil", ":", "return", "newPFSDatumFactory", "(", "pachClient", ",", "input", ".", "Pfs", ")", "\n", "case", "input", ".", "Union", "!=", "nil", ":", "return", "newUnionDatumFactory", "(", "pachClient", ",", "input", ".", "Union", ")", "\n", "<mask>", "input", ".", "Cross", "!=", "nil", ":", "return", "newCrossDatumFactory", "(", "pachClient", ",", "input", ".", "Cross", ")", "\n", "case", "input", ".", "Cron", "!=", "nil", ":", "return", "newCronDatumFactory", "(", "pachClient", ",", "input", ".", "Cron", ")", "\n", "case", "input", ".", "Git", "!=", "nil", ":", "return", "newGitDatumFactory", "(", "pachClient", ",", "input", ".", "Git", ")", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
11,038
all-11039
[ "Takes", "an", "object", "and", "converts", "it", "to", "a", "JSON", "representation" ]
[ "func", "objectToString", "(", "obj", "interface", "{", "}", ")", "string", "{", "switch", "content", ":=", "obj", ".", "(", "type", ")", "{", "case", "string", ":", "return", "content", "\n", "default", ":", "jsonString", ",", "err", ":=", "json", ".", "Marshal", "(", "obj", ")", "\n", "if", "err", "!=", "nil", "{", "<mask>", ".", "Println", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "return", "\"", "\"", "\n", "}", "\n", "return", "string", "(", "jsonString", ")", "\n", "}", "\n", "}" ]
11,039
all-11040
[ "Tee", "creates", "two", "Enumerators", "which", "will", "have", "identical", "contents", "as", "one", "another", "." ]
[ "func", "(", "iter", "Enumerator", ")", "Tee", "(", ")", "(", "Enumerator", ",", "Enumerator", ")", "{", "left", ",", "<mask>", ":=", "make", "(", "chan", "interface", "{", "}", ")", ",", "make", "(", "chan", "interface", "{", "}", ")", "\n\n", "go", "func", "(", ")", "{", "for", "entry", ":=", "range", "iter", "{", "left", "<-", "entry", "\n", "right", "<-", "entry", "\n", "}", "\n", "close", "(", "left", ")", "\n", "close", "(", "right", ")", "\n", "}", "(", ")", "\n\n", "return", "left", ",", "right", "\n", "}" ]
11,040
all-11041
[ "HasAggregator", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GraphDefinitionRequest", ")", "HasAggregator", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "Aggregator", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
11,041
all-11042
[ "render", "multiple", "sets", "of", "primitives", "by", "specifying", "indices", "of", "array", "data", "elements", "and", "an", "index", "to", "apply", "to", "each", "index" ]
[ "func", "MultiDrawElementsBaseVertex", "(", "mode", "uint32", ",", "<mask>", "*", "int32", ",", "xtype", "uint32", ",", "indices", "*", "unsafe", ".", "Pointer", ",", "drawcount", "int32", ",", "basevertex", "*", "int32", ")", "{", "C", ".", "glowMultiDrawElementsBaseVertex", "(", "gpMultiDrawElementsBaseVertex", ",", "(", "C", ".", "GLenum", ")", "(", "mode", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "count", ")", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "indices", ",", "(", "C", ".", "GLsizei", ")", "(", "drawcount", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "basevertex", ")", ")", ")", "\n", "}" ]
11,042
all-11043
[ "AddFilter", "is", "a", "wrapper", "around", "gtk_file_chooser_add_filter", "()", "." ]
[ "func", "(", "v", "*", "FileChooser", ")", "AddFilter", "(", "filter", "*", "FileFilter", ")", "{", "C", ".", "gtk_file_chooser_add_filter", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "}" ]
11,043
all-11044
[ "getCommandFunc", "executes", "the", "get", "command", "." ]
[ "func", "getCommandFunc", "(", "c", "*", "cli", ".", "Context", ",", "ki", "client", ".", "KeysAPI", ")", "{", "if", "len", "(", "c", ".", "Args", "(", ")", ")", "==", "0", "{", "handleError", "(", "c", ",", "ExitBadArgs", ",", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "key", ":=", "c", ".", "Args", "(", ")", "[", "0", "]", "\n", "sorted", ":=", "c", ".", "Bool", "(", "\"", "\"", ")", "\n", "quorum", ":=", "c", ".", "Bool", "(", "\"", "\"", ")", "\n\n", "ctx", ",", "cancel", ":=", "contextWithTotalTimeout", "(", "c", ")", "\n", "resp", ",", "err", ":=", "ki", ".", "Get", "(", "ctx", ",", "key", ",", "&", "client", ".", "GetOptions", "{", "Sort", ":", "sorted", ",", "Quorum", ":", "quorum", "}", ")", "\n", "cancel", "(", ")", "\n", "if", "err", "!=", "nil", "{", "handleError", "(", "c", ",", "ExitServerError", ",", "err", ")", "\n", "}", "\n\n", "if", "resp", ".", "Node", ".", "Dir", "{", "fmt", ".", "Fprintln", "(", "<mask>", ".", "Stderr", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "resp", ".", "Node", ".", "Key", ")", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "printResponseKey", "(", "resp", ",", "c", ".", "GlobalString", "(", "\"", "\"", ")", ")", "\n", "}" ]
11,044
all-11045
[ "SetHeader", "is", "a", "convenience", "handler", "to", "set", "a", "response", "header", "key", "/", "value" ]
[ "func", "SetHeader", "(", "key", ",", "value", "string", ")", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "func", "(", "next", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "fn", ":=", "func", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "key", ",", "value", ")", "\n", "<mask>", ".", "ServeHTTP", "(", "w", ",", "r", ")", "\n", "}", "\n", "return", "http", ".", "HandlerFunc", "(", "fn", ")", "\n", "}", "\n", "}" ]
11,045
all-11046
[ "ResumeElection", "initializes", "an", "election", "with", "a", "known", "leader", "." ]
[ "func", "ResumeElection", "(", "s", "*", "<mask>", ",", "pfx", "string", ",", "leaderKey", "string", ",", "leaderRev", "int64", ")", "*", "Election", "{", "return", "&", "Election", "{", "keyPrefix", ":", "pfx", ",", "session", ":", "s", ",", "leaderKey", ":", "leaderKey", ",", "leaderRev", ":", "leaderRev", ",", "leaderSession", ":", "s", ",", "}", "\n", "}" ]
11,046
all-11047
[ "GetChild", "function", "returns", "the", "child", "node", "under", "the", "directory", "node", ".", "On", "success", "it", "returns", "the", "file", "node" ]
[ "func", "(", "n", "*", "node", ")", "GetChild", "(", "name", "string", ")", "(", "*", "node", ",", "*", "v2error", ".", "Error", ")", "{", "if", "!", "n", ".", "IsDir", "(", ")", "{", "return", "nil", ",", "v2error", ".", "NewError", "(", "v2error", ".", "EcodeNotDir", ",", "n", ".", "Path", ",", "n", ".", "store", ".", "CurrentIndex", ")", "\n", "}", "\n\n", "child", ",", "ok", ":=", "n", ".", "Children", "[", "name", "]", "\n\n", "if", "ok", "{", "return", "<mask>", ",", "nil", "\n", "}", "\n\n", "return", "nil", ",", "nil", "\n", "}" ]
11,047
all-11048
[ "GetSid", "获取sid" ]
[ "func", "(", "ctx", "*", "<mask>", ")", "GetSid", "(", ")", "string", "{", "sid", ":=", "ctx", ".", "Data", "[", "\"", "\"", "]", "\n", "if", "sid", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "sid", ".", "(", "string", ")", "\n\n", "}" ]
11,048
all-11049
[ "GetOrg", "returns", "the", "org", "config", "after", "merging", "in", "any", "global", "policies", "." ]
[ "func", "(", "bp", "BranchProtection", ")", "GetOrg", "(", "name", "string", ")", "*", "Org", "{", "o", ",", "ok", ":=", "bp", ".", "Orgs", "[", "name", "]", "\n", "if", "ok", "{", "o", ".", "Policy", "=", "bp", ".", "Apply", "(", "o", ".", "Policy", ")", "\n", "}", "else", "{", "o", ".", "Policy", "=", "bp", ".", "<mask>", "\n", "}", "\n", "return", "&", "o", "\n", "}" ]
11,049
all-11050
[ "MoveChild", "is", "a", "wrapper", "around", "gtk_text_view_move_child", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "MoveChild", "(", "child", "IWidget", ",", "xpos", ",", "ypos", "int", ")", "{", "C", ".", "gtk_text_view_move_child", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ",", "C", ".", "gint", "(", "xpos", ")", ",", "C", ".", "gint", "(", "ypos", ")", ")", "\n", "}" ]
11,050
all-11051
[ "UpdateContainerSnapshot", "requests", "that", "LXD", "updates", "the", "container", "snapshot" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "UpdateContainerSnapshot", "(", "containerName", "string", ",", "name", "string", ",", "container", "api", ".", "ContainerSnapshotPut", ",", "ETag", "string", ")", "(", "Operation", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Send the request", "op", ",", "_", ",", "err", ":=", "r", ".", "queryOperation", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "QueryEscape", "(", "containerName", ")", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", ",", "container", ",", "ETag", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "op", ",", "nil", "\n", "}" ]
11,051
all-11052
[ "Activate", "implements", "the", "Activate", "RPC" ]
[ "func", "(", "a", "*", "apiServer", ")", "Activate", "(", "ctx", "context", ".", "Context", ",", "req", "*", "ec", ".", "ActivateRequest", ")", "(", "resp", "*", "ec", ".", "ActivateResponse", ",", "retErr", "error", ")", "{", "a", ".", "LogReq", "(", "req", ")", "\n", "defer", "func", "(", "start", "time", ".", "Time", ")", "{", "a", ".", "pachLogger", ".", "Log", "(", "req", ",", "resp", ",", "retErr", ",", "time", ".", "Since", "(", "start", ")", ")", "}", "(", "time", ".", "Now", "(", ")", ")", "\n\n", "// Validate the activation code", "expiration", ",", "err", ":=", "validateActivationCode", "(", "req", ".", "ActivationCode", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "// Allow request to override expiration in the activation code, for testing", "if", "req", ".", "Expires", "!=", "nil", "{", "customExpiration", ",", "err", ":=", "types", ".", "TimestampFromProto", "(", "req", ".", "Expires", ")", "\n", "if", "err", "==", "nil", "&&", "expiration", ".", "After", "(", "customExpiration", ")", "{", "expiration", "=", "customExpiration", "\n", "}", "\n", "}", "\n", "expirationProto", ",", "err", ":=", "types", ".", "TimestampProto", "(", "expiration", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ",", "expiration", ".", "String", "(", ")", ",", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "if", "_", ",", "err", ":=", "col", ".", "NewSTM", "(", "ctx", ",", "a", ".", "env", ".", "GetEtcdClient", "(", ")", ",", "func", "(", "stm", "col", ".", "STM", ")", "error", "{", "e", ":=", "a", ".", "enterpriseToken", ".", "ReadWrite", "(", "stm", ")", "\n", "// blind write", "return", "e", ".", "Put", "(", "enterpriseTokenKey", ",", "&", "ec", ".", "EnterpriseRecord", "{", "ActivationCode", ":", "req", ".", "ActivationCode", ",", "Expires", ":", "expirationProto", ",", "}", ")", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Wait until watcher observes the write", "if", "err", ":=", "backoff", ".", "Retry", "(", "func", "(", ")", "error", "{", "if", "t", ":=", "a", ".", "enterpriseExpiration", ".", "Load", "(", ")", ".", "(", "time", ".", "Time", ")", ";", "t", ".", "IsZero", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ",", "backoff", ".", "RetryEvery", "(", "time", ".", "Second", ")", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "time", ".", "Sleep", "(", "time", ".", "Second", ")", "// give other pachd nodes time to observe the write", "\n\n", "return", "&", "ec", ".", "ActivateResponse", "{", "Info", ":", "&", "ec", ".", "TokenInfo", "{", "Expires", ":", "expirationProto", ",", "}", ",", "}", ",", "nil", "\n", "}" ]
11,052
all-11053
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "CaptureSnapshotParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage78", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
11,053
all-11054
[ "Return", "a", "list", "of", "worker", "types", "including", "some", "summary", "information", "about", "current", "capacity", "for", "each", ".", "While", "this", "list", "includes", "all", "defined", "worker", "types", "there", "may", "be", "running", "EC2", "instances", "for", "deleted", "worker", "types", "that", "are", "not", "included", "here", ".", "The", "list", "is", "unordered", ".", "See", "https", ":", "//", "docs", ".", "taskcluster", ".", "net", "/", "reference", "/", "core", "/", "aws", "-", "provisioner", "/", "api", "-", "docs#listWorkerTypeSummaries" ]
[ "func", "(", "awsProvisioner", "*", "AwsProvisioner", ")", "ListWorkerTypeSummaries", "(", ")", "(", "*", "ListWorkerTypeSummariesResponse", ",", "error", ")", "{", "<mask>", ":=", "tcclient", ".", "Client", "(", "*", "awsProvisioner", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", ",", "new", "(", "ListWorkerTypeSummariesResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "ListWorkerTypeSummariesResponse", ")", ",", "err", "\n", "}" ]
11,054
all-11055
[ "expandStorageDrsIoLoadBalanceConfig", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "StorageDrsIoLoadBalanceConfig", "." ]
[ "func", "expandStorageDrsIoLoadBalanceConfig", "(", "d", "*", "schema", ".", "ResourceData", ",", "version", "viapi", ".", "VSphereVersion", ")", "*", "types", ".", "StorageDrsIoLoadBalanceConfig", "{", "obj", ":=", "&", "types", ".", "StorageDrsIoLoadBalanceConfig", "{", "IoLatencyThreshold", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "IoLoadImbalanceThreshold", ":", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", ",", "}", "\n\n", "if", "version", ".", "Newer", "(", "viapi", ".", "VSphereVersion", "{", "Product", ":", "<mask>", ".", "Product", ",", "Major", ":", "6", "}", ")", "{", "obj", ".", "ReservableIopsThreshold", "=", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", "\n", "obj", ".", "ReservablePercentThreshold", "=", "int32", "(", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ")", "\n", "obj", ".", "ReservableThresholdMode", "=", "d", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "\n", "}", "\n\n", "return", "obj", "\n", "}" ]
11,055
all-11056
[ "HTML", "renders", "the", "named", "files", "using", "the", "text", "/", "html", "content", "type", "and", "the", "github", ".", "com", "/", "gobuffalo", "/", "plush", "package", "for", "templating", ".", "If", "more", "than", "1", "file", "is", "provided", "the", "second", "file", "will", "be", "considered", "a", "layout", "file", "and", "the", "first", "file", "will", "be", "the", "content", "file", "which", "will", "be", "placed", "into", "the", "layout", "using", "<%", "=", "yield", "%", ">", ".", "If", "no", "second", "file", "is", "provided", "and", "an", "HTMLLayout", "is", "specified", "in", "the", "options", "then", "that", "layout", "file", "will", "be", "used", "automatically", "." ]
[ "func", "(", "e", "*", "Engine", ")", "HTML", "(", "names", "...", "string", ")", "Renderer", "{", "if", "e", ".", "HTMLLayout", "!=", "\"", "\"", "&&", "len", "(", "names", ")", "==", "1", "{", "names", "=", "append", "(", "names", ",", "e", ".", "HTMLLayout", ")", "\n", "}", "\n", "hr", ":=", "&", "templateRenderer", "{", "Engine", ":", "e", ",", "contentType", ":", "\"", "\"", ",", "names", ":", "<mask>", ",", "}", "\n", "return", "hr", "\n", "}" ]
11,056
all-11057
[ "Update", "changes", "the", "status", "message", "to", "the", "provided", "string" ]
[ "func", "(", "p", "*", "ProgressRenderer", ")", "Update", "(", "status", "string", ")", "{", "// Wait if needed", "timeout", ":=", "p", ".", "wait", ".", "Sub", "(", "time", ".", "Now", "(", ")", ")", "\n", "if", "timeout", ".", "Seconds", "(", ")", ">", "0", "{", "time", ".", "Sleep", "(", "timeout", ")", "\n", "}", "\n\n", "// Acquire rendering lock", "p", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "// Check if we're already done", "if", "p", ".", "done", "{", "return", "\n", "}", "\n\n", "// Handle quiet mode", "if", "p", ".", "Quiet", "{", "return", "\n", "}", "\n\n", "// Skip status updates when not dealing with a terminal", "if", "p", ".", "terminal", "==", "0", "{", "if", "!", "termios", ".", "IsTerminal", "(", "int", "(", "os", ".", "Stdout", ".", "Fd", "(", ")", ")", ")", "{", "p", ".", "terminal", "=", "-", "1", "\n", "}", "\n\n", "p", ".", "terminal", "=", "1", "\n", "}", "\n\n", "if", "p", ".", "terminal", "!=", "1", "{", "return", "\n", "}", "\n\n", "// Print the new message", "msg", ":=", "\"", "\"", "\n", "if", "p", ".", "Format", "!=", "\"", "\"", "{", "msg", "=", "p", ".", "Format", "\n", "}", "\n\n", "msg", "=", "fmt", ".", "Sprintf", "(", "msg", ",", "status", ")", "\n\n", "// Truncate msg to terminal length", "msg", "=", "\"", "\\r", "\"", "+", "p", ".", "truncate", "(", "msg", ")", "\n\n", "// Don't print if empty and never printed", "if", "len", "(", "msg", ")", "==", "1", "&&", "p", ".", "maxLength", "==", "0", "{", "return", "\n", "}", "\n\n", "if", "len", "(", "<mask>", ")", ">", "p", ".", "maxLength", "{", "p", ".", "maxLength", "=", "len", "(", "msg", ")", "\n", "}", "else", "{", "fmt", ".", "Printf", "(", "\"", "\\r", "\"", ",", "strings", ".", "Repeat", "(", "\"", "\"", ",", "p", ".", "maxLength", ")", ")", "\n", "}", "\n\n", "fmt", ".", "Print", "(", "msg", ")", "\n", "}" ]
11,057
all-11058
[ "listJobBuilds", "concurrently", "lists", "builds", "for", "the", "given", "job", "prefixes", "that", "have", "been", "run", "on", "a", "PR" ]
[ "func", "listJobBuilds", "(", "bucket", "storageBucket", ",", "jobPrefixes", "[", "]", "string", ")", "[", "]", "jobBuilds", "{", "jobch", ":=", "<mask>", "(", "chan", "jobBuilds", ")", "\n", "defer", "close", "(", "jobch", ")", "\n", "for", "i", ",", "jobPrefix", ":=", "range", "jobPrefixes", "{", "go", "func", "(", "i", "int", ",", "jobPrefix", "string", ")", "{", "buildPrefixes", ",", "err", ":=", "bucket", ".", "listSubDirs", "(", "jobPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Warningf", "(", "\"", "\"", ",", "jobPrefix", ")", "\n", "}", "\n", "jobch", "<-", "jobBuilds", "{", "name", ":", "path", ".", "Base", "(", "jobPrefix", ")", ",", "buildPrefixes", ":", "buildPrefixes", ",", "}", "\n", "}", "(", "i", ",", "jobPrefix", ")", "\n", "}", "\n", "jobs", ":=", "[", "]", "jobBuilds", "{", "}", "\n", "for", "range", "jobPrefixes", "{", "job", ":=", "<-", "jobch", "\n", "jobs", "=", "append", "(", "jobs", ",", "job", ")", "\n", "}", "\n", "return", "jobs", "\n", "}" ]
11,058
all-11059
[ "Die", "will", "log", "a", "message", "using", "Fatal", "call", "ShutdownLoggers", "and", "then", "exit", "the", "application", "with", "the", "provided", "exit", "code", "." ]
[ "func", "(", "b", "*", "Base", ")", "Die", "(", "exitCode", "int", ",", "msg", "string", ")", "{", "b", ".", "Log", "(", "LevelFatal", ",", "nil", ",", "<mask>", ")", "\n", "b", ".", "ShutdownLoggers", "(", ")", "\n", "curExiter", ".", "Exit", "(", "exitCode", ")", "\n", "}" ]
11,059
all-11060
[ "NewReporter", "creates", "a", "new", "reporter", "and", "kicks", "off", "the", "loop", "to", "report", "cluster", "metrics" ]
[ "func", "NewReporter", "(", "clusterID", "string", ",", "kubeClient", "*", "kube", ".", "Clientset", ")", "*", "Reporter", "{", "reporter", ":=", "&", "Reporter", "{", "segmentClient", ":", "newPersistentClient", "(", ")", ",", "clusterID", ":", "clusterID", ",", "kubeClient", ":", "kubeClient", ",", "}", "\n", "<mask>", "reporter", ".", "reportClusterMetrics", "(", ")", "\n", "return", "reporter", "\n", "}" ]
11,060
all-11061
[ "flattenToolsConfigInfo", "reads", "various", "fields", "from", "a", "ToolsConfigInfo", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenToolsConfigInfo", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "ToolsConfigInfo", ")", "error", "{", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "SyncTimeWithHost", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "AfterPowerOn", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "AfterResume", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "BeforeGuestStandby", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "BeforeGuestShutdown", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "BeforeGuestReboot", ")", "\n", "return", "nil", "\n", "}" ]
11,061
all-11062
[ "newPlainTextInner", "creates", "and", "returns", "a", "plain", "text", "." ]
[ "func", "newPlainTextInner", "(", "ln", "*", "line", ",", "rslt", "*", "result", ",", "src", "*", "source", ",", "parent", "element", ",", "insertBr", "bool", ",", "opts", "*", "<mask>", ")", "*", "plainTextInner", "{", "return", "&", "plainTextInner", "{", "elementBase", ":", "newElementBase", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", ",", "insertBr", ":", "insertBr", ",", "}", "\n", "}" ]
11,062
all-11063
[ "sendBytes", "sends", "a", "path", "into", "the", "tar", "stream", "." ]
[ "func", "(", "d", "*", "Destination", ")", "sendBytes", "(", "<mask>", "string", ",", "b", "[", "]", "byte", ")", "error", "{", "return", "d", ".", "sendFile", "(", "path", ",", "int64", "(", "len", "(", "b", ")", ")", ",", "bytes", ".", "NewReader", "(", "b", ")", ")", "\n", "}" ]
11,063
all-11064
[ "===", "absent", "(", "Vector", "ValueTypeVector", ")", "Vector", "===" ]
[ "func", "funcAbsent", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "if", "len", "(", "vals", "[", "0", "]", ".", "(", "Vector", ")", ")", ">", "0", "{", "return", "enh", ".", "<mask>", "\n", "}", "\n", "m", ":=", "[", "]", "labels", ".", "Label", "{", "}", "\n\n", "if", "vs", ",", "ok", ":=", "args", "[", "0", "]", ".", "(", "*", "VectorSelector", ")", ";", "ok", "{", "for", "_", ",", "ma", ":=", "range", "vs", ".", "LabelMatchers", "{", "if", "ma", ".", "Type", "==", "labels", ".", "MatchEqual", "&&", "ma", ".", "Name", "!=", "labels", ".", "MetricName", "{", "m", "=", "append", "(", "m", ",", "labels", ".", "Label", "{", "Name", ":", "ma", ".", "Name", ",", "Value", ":", "ma", ".", "Value", "}", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "append", "(", "enh", ".", "out", ",", "Sample", "{", "Metric", ":", "labels", ".", "New", "(", "m", "...", ")", ",", "Point", ":", "Point", "{", "V", ":", "1", "}", ",", "}", ")", "\n", "}" ]
11,064
all-11065
[ "NewPOSTTask", "creates", "a", "Task", "that", "will", "POST", "to", "a", "path", "with", "the", "given", "form", "data", "." ]
[ "func", "NewPOSTTask", "(", "path", "string", ",", "params", "url", ".", "Values", ")", "*", "Task", "{", "h", ":=", "make", "(", "http", ".", "Header", ")", "\n", "h", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "&", "Task", "{", "<mask>", ":", "path", ",", "Payload", ":", "[", "]", "byte", "(", "params", ".", "Encode", "(", ")", ")", ",", "Header", ":", "h", ",", "Method", ":", "\"", "\"", ",", "}", "\n", "}" ]
11,065
all-11066
[ "RemovePeer", "(", "deprecated", ")", "is", "used", "to", "remove", "a", "peer", "from", "the", "cluster", ".", "If", "the", "current", "leader", "is", "being", "removed", "it", "will", "cause", "a", "new", "election", "to", "occur", ".", "This", "must", "be", "run", "on", "the", "leader", "or", "it", "will", "fail", ".", "Use", "RemoveServer", "instead", "." ]
[ "func", "(", "r", "*", "Raft", ")", "RemovePeer", "(", "peer", "ServerAddress", ")", "Future", "{", "if", "r", ".", "protocolVersion", ">", "2", "{", "return", "errorFuture", "{", "ErrUnsupportedProtocol", "}", "\n", "}", "\n\n", "return", "r", ".", "requestConfigChange", "(", "configurationChangeRequest", "{", "<mask>", ":", "RemoveServer", ",", "serverID", ":", "ServerID", "(", "peer", ")", ",", "prevIndex", ":", "0", ",", "}", ",", "0", ")", "\n", "}" ]
11,066
all-11067
[ "CreateConfigMap", "creates", "a", "configmap", "in", "the", "client", "s", "specified", "namespace", ".", "Analogous", "to", "kubectl", "create", "configmap", "--", "namespace", "=", "client", ".", "namespace" ]
[ "func", "(", "c", "*", "Client", ")", "CreateConfigMap", "(", "<mask>", "ConfigMap", ")", "(", "ConfigMap", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ")", "\n", "var", "retConfigMap", "ConfigMap", "\n", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPost", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "namespace", ")", ",", "requestBody", ":", "&", "content", ",", "}", ",", "&", "retConfigMap", ")", "\n\n", "return", "retConfigMap", ",", "err", "\n", "}" ]
11,067
all-11068
[ "GetFocusChain", "is", "a", "wrapper", "around", "gtk_container_get_focus_chain", "()", "." ]
[ "func", "(", "v", "*", "Container", ")", "GetFocusChain", "(", ")", "(", "[", "]", "*", "Widget", ",", "bool", ")", "{", "<mask>", "cwlist", "*", "C", ".", "GList", "\n", "c", ":=", "C", ".", "gtk_container_get_focus_chain", "(", "v", ".", "native", "(", ")", ",", "&", "cwlist", ")", "\n\n", "var", "widgets", "[", "]", "*", "Widget", "\n", "wlist", ":=", "glib", ".", "WrapList", "(", "uintptr", "(", "unsafe", ".", "Pointer", "(", "cwlist", ")", ")", ")", "\n", "for", ";", "wlist", ".", "Data", "(", ")", "!=", "nil", ";", "wlist", "=", "wlist", ".", "Next", "(", ")", "{", "widgets", "=", "append", "(", "widgets", ",", "wrapWidget", "(", "glib", ".", "Take", "(", "wlist", ".", "Data", "(", ")", ".", "(", "unsafe", ".", "Pointer", ")", ")", ")", ")", "\n", "}", "\n", "return", "widgets", ",", "gobool", "(", "c", ")", "\n", "}" ]
11,068
all-11069
[ "Ls", "lists", "a", "directory", "in", "the", "guest", "operating", "system", ".", "Parameters", ":", "dir", ":", "The", "path", "name", "of", "a", "directory", "to", "be", "listed", ".", "Remarks", ":", "*", "Only", "absolute", "paths", "should", "be", "used", "for", "files", "in", "the", "guest", ";", "the", "resolution", "of", "relative", "paths", "is", "not", "specified", ".", "Since", "VMware", "Workstation", "6", ".", "0", "Minimum", "Supported", "Guest", "OS", ":", "Microsoft", "Windows", "NT", "Series", "Linux" ]
[ "func", "(", "g", "*", "Guest", ")", "Ls", "(", "dir", "string", ")", "(", "[", "]", "*", "GuestFile", ",", "error", ")", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n", "var", "files", "[", "]", "*", "GuestFile", "\n\n", "guestdir", ":=", "C", ".", "CString", "(", "dir", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "guestdir", ")", ")", "\n\n", "jobHandle", "=", "C", ".", "VixVM_ListDirectoryInGuest", "(", "g", ".", "handle", ",", "guestdir", ",", "0", ",", "nil", ",", "nil", ")", "\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "nil", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "num", ":=", "C", ".", "VixJob_GetNumProperties", "(", "jobHandle", ",", "C", ".", "VIX_PROPERTY_JOB_RESULT_ITEM_NAME", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "int", "(", "num", ")", ";", "i", "++", "{", "var", "<mask>", "*", "C", ".", "char", "\n", "var", "size", "*", "C", ".", "int64", "\n", "var", "modtime", "*", "C", ".", "int64", "\n", "var", "attrs", "*", "C", ".", "int", "\n\n", "gfile", ":=", "&", "GuestFile", "{", "}", "\n\n", "err", "=", "C", ".", "get_guest_file", "(", "jobHandle", ",", "C", ".", "int", "(", "i", ")", ",", "name", ",", "size", ",", "modtime", ",", "attrs", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "nil", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "gfile", ".", "Path", "=", "C", ".", "GoString", "(", "name", ")", "\n", "C", ".", "Vix_FreeBuffer", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", "\n\n", "gfile", ".", "Size", "=", "int64", "(", "*", "size", ")", "\n", "gfile", ".", "Modtime", "=", "int64", "(", "*", "modtime", ")", "\n", "gfile", ".", "Attrs", "=", "FileAttr", "(", "*", "attrs", ")", "\n\n", "files", "=", "append", "(", "files", ",", "gfile", ")", "\n", "}", "\n\n", "return", "files", ",", "nil", "\n", "}" ]
11,069
all-11070
[ "Decode", "decodes", "base64url", "string", "to", "byte", "array" ]
[ "func", "Decode", "(", "data", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "data", "=", "strings", ".", "Replace", "(", "data", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "// 62nd char of encoding", "\n", "data", "=", "strings", ".", "Replace", "(", "data", ",", "\"", "\"", ",", "\"", "\"", ",", "-", "1", ")", "// 63rd char of encoding", "\n", "<mask>", "(", "len", "(", "data", ")", "%", "4", ")", "{", "// Pad with trailing '='s", "case", "0", ":", "// no padding", "case", "2", ":", "data", "+=", "\"", "\"", "// 2 pad chars", "\n", "case", "3", ":", "data", "+=", "\"", "\"", "// 1 pad char\t\t", "\n", "}", "\n", "return", "base64", ".", "StdEncoding", ".", "DecodeString", "(", "data", ")", "\n", "}" ]
11,070
all-11071
[ "GetFocus", "is", "a", "wrapper", "around", "gtk_window_get_focus", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "GetFocus", "(", ")", "(", "*", "Widget", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_window_get_focus", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "<mask>", "wrapWidget", "(", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", ")", ",", "nil", "\n", "}" ]
11,071
all-11072
[ "Wrap", "wraps", "an", "existing", "context", ".", "Context", "into", "a", "ContextWithHeaders", ".", "If", "the", "underlying", "context", "has", "headers", "they", "are", "preserved", "." ]
[ "func", "Wrap", "(", "ctx", "context", ".", "Context", ")", "ContextWithHeaders", "{", "hctx", ":=", "headerCtx", "{", "<mask>", ":", "ctx", "}", "\n", "if", "h", ":=", "hctx", ".", "headers", "(", ")", ";", "h", "!=", "nil", "{", "return", "hctx", "\n", "}", "\n\n", "// If there is no header container, we should create an empty one.", "return", "WrapWithHeaders", "(", "ctx", ",", "nil", ")", "\n", "}" ]
11,072
all-11073
[ "Do", "executes", "Page", ".", "resetNavigationHistory", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "ResetNavigationHistoryParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandResetNavigationHistory", ",", "nil", ",", "nil", ")", "\n", "}" ]
11,073
all-11074
[ "newAesDecryptReader", "returns", "a", "cipherBlockReader", "that", "decrypts", "input", "from", "a", "given", "io", ".", "Reader", "using", "AES", ".", "It", "will", "panic", "if", "the", "provided", "key", "is", "invalid", "." ]
[ "func", "newAesDecryptReader", "(", "r", "io", ".", "Reader", ",", "key", ",", "<mask>", "[", "]", "byte", ")", "*", "cipherBlockReader", "{", "block", ",", "err", ":=", "aes", ".", "NewCipher", "(", "key", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "mode", ":=", "cipher", ".", "NewCBCDecrypter", "(", "block", ",", "iv", ")", "\n\n", "return", "newCipherBlockReader", "(", "r", ",", "mode", ")", "\n", "}" ]
11,074
all-11075
[ "GetIAMRoleCredentials", "returns", "the", "IAM", "role", "credentials", "in", "the", "task", "IAM", "role", "struct" ]
[ "func", "(", "role", "*", "TaskIAMRoleCredentials", ")", "GetIAMRoleCredentials", "(", ")", "IAMRoleCredentials", "{", "role", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "role", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "<mask>", ".", "IAMRoleCredentials", "\n", "}" ]
11,075
all-11076
[ "dupStdio", "opens", "the", "slavePath", "for", "the", "console", "and", "dups", "the", "fds", "to", "the", "current", "processes", "stdio", "fd", "0", "1", "2", "." ]
[ "func", "(", "c", "*", "linuxConsole", ")", "dupStdio", "(", ")", "error", "{", "slave", ",", "err", ":=", "c", ".", "open", "(", "syscall", ".", "O_RDWR", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "fd", ":=", "int", "(", "<mask>", ".", "Fd", "(", ")", ")", "\n", "for", "_", ",", "i", ":=", "range", "[", "]", "int", "{", "0", ",", "1", ",", "2", "}", "{", "if", "err", ":=", "syscall", ".", "Dup3", "(", "fd", ",", "i", ",", "0", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,076
all-11077
[ "ChromeOptions", "is", "used", "to", "pass", "additional", "options", "to", "Chrome", "via", "ChromeDriver", "." ]
[ "func", "ChromeOptions", "(", "opt", "string", ",", "<mask>", "interface", "{", "}", ")", "Option", "{", "return", "func", "(", "c", "*", "config", ")", "{", "if", "c", ".", "ChromeOptions", "==", "nil", "{", "c", ".", "ChromeOptions", "=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "}", "\n", "c", ".", "ChromeOptions", "[", "opt", "]", "=", "value", "\n", "}", "\n", "}" ]
11,077
all-11078
[ "waitForRegionalOp", "waits", "for", "the", "regional", "operation", "to", "finish", "." ]
[ "func", "(", "c", "*", "ComputeUtil", ")", "waitForRegionalOp", "(", "name", "string", ")", "error", "{", "return", "c", ".", "waitForOp", "(", "func", "(", ")", "(", "*", "raw", ".", "Operation", ",", "error", ")", "{", "return", "c", ".", "<mask>", ".", "ZoneOperations", ".", "Get", "(", "c", ".", "project", ",", "c", ".", "zone", ",", "name", ")", ".", "Do", "(", ")", "\n", "}", ")", "\n", "}" ]
11,078
all-11079
[ "RemovePkcs7", "removes", "pkcs7", "padding", "from", "previously", "padded", "byte", "array" ]
[ "func", "RemovePkcs7", "(", "padded", "[", "]", "byte", ",", "blockSize", "int", ")", "[", "]", "byte", "{", "dataLen", ":=", "len", "(", "padded", ")", "\n", "paddingCount", ":=", "int", "(", "padded", "[", "dataLen", "-", "1", "]", ")", "\n", "if", "(", "paddingCount", ">", "blockSize", "||", "paddingCount", "<=", "0", ")", "{", "return", "padded", "//data is not padded (or not padded correctly), return as is", "\n", "}", "\n\n", "padding", ":=", "padded", "[", "dataLen", "-", "paddingCount", ":", "dataLen", "-", "1", "]", "\n", "for", "_", ",", "b", ":=", "<mask>", "padding", "{", "if", "int", "(", "b", ")", "!=", "paddingCount", "{", "return", "padded", "//data is not padded (or not padded correcly), return as is", "\n", "}", "\n", "}", "\n", "return", "padded", "[", ":", "len", "(", "padded", ")", "-", "paddingCount", "]", "//return data - padding", "\n", "}" ]
11,079
all-11080
[ "SetEnabled", "is", "a", "wrapper", "around", "g_simple_action_set_enabled" ]
[ "func", "(", "v", "*", "SimpleAction", ")", "SetEnabled", "(", "enabled", "bool", ")", "{", "C", ".", "g_simple_action_set_enabled", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "<mask>", ")", ")", "\n", "}" ]
11,080
all-11081
[ "HasPrefix", "returns", "whether", "the", "slash", "-", "separated", "path", "p", "has", "the", "given", "prefix", ".", "Unlike", "strings", ".", "HasPrefix", "this", "function", "respects", "component", "boundaries", "so", "/", "home", "/", "foo", "is", "not", "a", "prefix", "is", "/", "home", "/", "foobar", "/", "baz", ".", "If", "the", "prefix", "is", "empty", "this", "function", "always", "returns", "true", "." ]
[ "func", "HasPrefix", "(", "p", ",", "<mask>", "string", ")", "bool", "{", "return", "prefix", "==", "\"", "\"", "||", "p", "==", "prefix", "||", "strings", ".", "HasPrefix", "(", "p", ",", "prefix", "+", "\"", "\"", ")", "\n", "}" ]
11,081
all-11082
[ "UpdateDataCenter", "updates", "a", "data", "center" ]
[ "func", "(", "c", "*", "Client", ")", "UpdateDataCenter", "(", "dcid", "string", ",", "obj", "DatacenterProperties", ")", "(", "*", "Datacenter", ",", "error", ")", "{", "url", ":=", "dcPath", "(", "dcid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "Datacenter", "{", "}", "\n", "err", ":=", "c", ".", "<mask>", ".", "Patch", "(", "url", ",", "obj", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
11,082
all-11083
[ "SetReplyKeyboardHide", "sets", "the", "ReplyKeyboardHide", "(", "optional", ")", "Note", "that", "only", "one", "of", "ReplyKeyboardMarkup", "ReplyKeyboardHide", "or", "ForceReply", "can", "be", "set", ".", "Attempting", "to", "set", "any", "of", "the", "other", "two", "or", "re", "-", "setting", "this", "will", "cause", "a", "panic", "." ]
[ "func", "(", "op", "*", "outgoingMessageBase", ")", "SetReplyKeyboardHide", "(", "to", "ReplyKeyboardHide", ")", "{", "if", "!", "to", ".", "HideKeyboard", "{", "<mask>", "\n", "}", "\n\n", "if", "op", ".", "replyMarkupSet", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "op", ".", "ReplyMarkup", "=", "ReplyMarkup", "(", "to", ")", "\n", "}" ]
11,083
all-11084
[ "Get", "gets", "the", "named", "router", "from", "the", "registry", "." ]
[ "func", "Get", "(", "name", "string", ")", "(", "Router", ",", "error", ")", "{", "routerType", ",", "prefix", ",", "err", ":=", "Type", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "&", "ErrRouterNotFound", "{", "Name", ":", "name", "}", "\n", "}", "\n", "factory", ",", "<mask>", ":=", "routers", "[", "routerType", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "routerType", ")", "\n", "}", "\n", "r", ",", "err", ":=", "factory", "(", "name", ",", "prefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "r", ",", "nil", "\n", "}" ]
11,084
all-11085
[ "StreamJSONResponse", "supports", "the", "JSON", "streaming", "format", "from", "the", "tsuru", "API", "." ]
[ "func", "StreamJSONResponse", "(", "w", "io", ".", "Writer", ",", "response", "*", "<mask>", ".", "Response", ")", "error", "{", "if", "response", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "defer", "response", ".", "Body", ".", "Close", "(", ")", "\n", "var", "err", "error", "\n", "output", ":=", "tsuruio", ".", "NewStreamWriter", "(", "w", ",", "nil", ")", "\n", "for", "n", ":=", "int64", "(", "1", ")", ";", "n", ">", "0", "&&", "err", "==", "nil", ";", "n", ",", "err", "=", "io", ".", "Copy", "(", "output", ",", "response", ".", "Body", ")", "{", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "unparsed", ":=", "output", ".", "Remaining", "(", ")", "\n", "if", "len", "(", "unparsed", ")", ">", "0", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "string", "(", "unparsed", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
11,085
all-11086
[ "Snapshot", "returns", "the", "number", "of", "values", "per", "second", "since", "the", "last", "snapshot", "and", "reset", "the", "count", "to", "zero", "." ]
[ "func", "(", "r", "*", "Rate", ")", "Snapshot", "(", ")", "float64", "{", "now", ":=", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", "\n", "dur", ":=", "time", ".", "Duration", "(", "now", "-", "atomic", ".", "SwapInt64", "(", "&", "r", ".", "time", ",", "now", ")", ")", "\n", "return", "r", ".", "count", ".", "Snapshot", "(", ")", "/", "dur", ".", "Seconds", "(", ")", "*", "r", ".", "<mask>", "\n", "}" ]
11,086
all-11087
[ "SetAuthHeader", "sets", "client", "s", "authorization", "headers", "if", "client", "was", "configured", "to", "work", "with", "authorization" ]
[ "func", "(", "c", "*", "Client", ")", "SetAuthHeader", "(", "h", "<mask>", ".", "Header", ")", "{", "if", "c", ".", "auth", "!=", "nil", "{", "h", ".", "Set", "(", "\"", "\"", ",", "c", ".", "auth", ".", "String", "(", ")", ")", "\n", "}", "\n", "}" ]
11,087
all-11088
[ "ISBN10Value", "returns", "the", "value", "of", "the", "ISBN10", "pointer", "passed", "in", "or", "the", "default", "value", "if", "the", "pointer", "is", "nil", "." ]
[ "func", "ISBN10Value", "(", "v", "*", "strfmt", ".", "ISBN10", ")", "strfmt", ".", "ISBN10", "{", "if", "v", "==", "nil", "{", "return", "strfmt", ".", "ISBN10", "(", "\"", "\"", ")", "\n", "}", "\n\n", "<mask>", "*", "v", "\n", "}" ]
11,088
all-11089
[ "SanitizeAccent", "remplace", "les", "caractères", "accentués" ]
[ "func", "SanitizeAccent", "(", "s", "string", ")", "string", "{", "b", ":=", "bytes", ".", "NewBufferString", "(", "\"", "\"", ")", "\n", "for", "_", ",", "c", ":=", "range", "s", "{", "if", "v", ",", "p", ":=", "a", "[", "c", "]", ";", "p", "{", "b", ".", "WriteString", "(", "v", ")", "\n", "}", "else", "{", "b", ".", "WriteRune", "(", "c", ")", "\n", "}", "\n", "}", "\n", "return", "b", ".", "<mask>", "(", ")", "\n", "}" ]
11,089
all-11090
[ "LeafApprovers", "returns", "a", "set", "of", "users", "who", "are", "the", "closest", "approvers", "to", "the", "requested", "file", ".", "If", "pkg", "/", "OWNERS", "has", "user1", "and", "pkg", "/", "util", "/", "OWNERS", "has", "user2", "this", "will", "only", "return", "user2", "for", "the", "path", "pkg", "/", "util", "/", "sets", "/", "file", ".", "go" ]
[ "func", "(", "o", "*", "RepoOwners", ")", "LeafApprovers", "(", "path", "string", ")", "sets", ".", "String", "{", "return", "o", ".", "entriesForFile", "(", "path", ",", "o", ".", "approvers", ",", "<mask>", ")", "\n", "}" ]
11,090
all-11091
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "DetachReason", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "<mask>", "(", "string", "(", "t", ")", ")", "\n", "}" ]
11,091
all-11092
[ "NewNode", "adds", "a", "node", "to", "d", "." ]
[ "func", "(", "d", "*", "DAG", ")", "NewNode", "(", "<mask>", "string", ",", "parents", "[", "]", "string", ")", "{", "d", ".", "parents", "[", "id", "]", "=", "parents", "\n", "for", "_", ",", "parentID", ":=", "range", "parents", "{", "d", ".", "children", "[", "parentID", "]", "=", "append", "(", "d", ".", "children", "[", "parentID", "]", ",", "id", ")", "\n", "d", ".", "leaves", "[", "parentID", "]", "=", "false", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "d", ".", "leaves", "[", "id", "]", ";", "!", "ok", "{", "d", ".", "leaves", "[", "id", "]", "=", "true", "\n", "}", "\n", "}" ]
11,092
all-11093
[ "SetHeader", "sets", "the", "Content", "-", "Type", "for", "a", "given", "ResponseWriter", "and", "filename", "extension" ]
[ "func", "(", "mr", "*", "Reader", ")", "SetHeader", "(", "w", "http", ".", "ResponseWriter", ",", "ext", "string", ")", "{", "mimestring", ":=", "mr", ".", "Get", "(", "ext", ")", "\n", "if", "mimestring", "==", "\"", "\"", "{", "// Default mime type", "mimestring", "=", "\"", "\"", "\n", "}", "\n", "if", "mr", ".", "utf8", "{", "mimestring", "+=", "\"", "\"", "\n", "}", "\n", "w", ".", "<mask>", "(", ")", ".", "Add", "(", "\"", "\"", ",", "mimestring", ")", "\n", "}" ]
11,093
all-11094
[ "NewOutgoingPhotoResend", "creates", "a", "new", "outgoing", "photo", "for", "re", "-", "sending", "." ]
[ "func", "(", "api", "*", "TelegramBotAPI", ")", "NewOutgoingPhotoResend", "(", "recipient", "Recipient", ",", "fileID", "<mask>", ")", "*", "OutgoingPhoto", "{", "return", "&", "OutgoingPhoto", "{", "outgoingMessageBase", ":", "outgoingMessageBase", "{", "outgoingBase", ":", "outgoingBase", "{", "api", ":", "api", ",", "Recipient", ":", "recipient", ",", "}", ",", "}", ",", "outgoingFileBase", ":", "outgoingFileBase", "{", "fileID", ":", "fileID", ",", "}", ",", "}", "\n", "}" ]
11,094
all-11095
[ "Gauge", "records", "an", "absolute", "value", "for", "the", "given", "bucket", "." ]
[ "func", "(", "c", "*", "Client", ")", "Gauge", "(", "bucket", "string", ",", "value", "interface", "{", "}", ")", "{", "if", "c", ".", "skip", "(", ")", "{", "return", "\n", "}", "\n", "c", ".", "conn", ".", "gauge", "(", "c", ".", "prefix", ",", "bucket", ",", "value", ",", "c", ".", "<mask>", ")", "\n", "}" ]
11,095
all-11096
[ "ApplicationLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "ApplicationLocator", "(", "href", "<mask>", ")", "*", "ApplicationLocator", "{", "return", "&", "ApplicationLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
11,096
all-11097
[ "ReadUintSetting", "reads", "value", "of", "a", "given", "uint", "setting", "." ]
[ "func", "ReadUintSetting", "(", "db", "*", "reform", ".", "Querier", ",", "key", "string", ")", "(", "uint", ",", "error", ")", "{", "val", ",", "err", ":=", "ReadSetting", "(", "db", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "val2", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "val", ",", "10", ",", "32", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "newSettingParseError", "(", "key", ",", "err", ")", "\n", "}", "\n\n", "return", "uint", "(", "val2", ")", ",", "nil", "\n", "}" ]
11,097
all-11098
[ "Set", "updates", "the", "value", "of", "the", "current", "iteration", "record", "if", "it", "has", "not", "been", "updated", "or", "deleted", "since", "iterating", "or", "seeking", "to", "it", ".", "If", "the", "record", "has", "been", "updated", "then", "Set", "positions", "the", "iterator", "on", "the", "most", "current", "value", "and", "returns", "ErrRecordUpdated", ".", "If", "the", "record", "has", "been", "deleted", "then", "Set", "keeps", "the", "iterator", "positioned", "on", "the", "current", "record", "with", "the", "current", "value", "and", "returns", "ErrRecordDeleted", "." ]
[ "func", "(", "it", "*", "Iterator", ")", "Set", "(", "val", "[", "]", "byte", ",", "meta", "uint16", ")", "error", "{", "new", ",", "err", ":=", "it", ".", "list", ".", "allocVal", "(", "val", ",", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "it", ".", "trySetValue", "(", "<mask>", ")", "\n", "}" ]
11,098
all-11099
[ "GetClip", "is", "a", "wrapper", "around", "gtk_widget_get_clip", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "GetClip", "(", ")", "*", "Allocation", "{", "var", "clip", "Allocation", "\n", "C", ".", "gtk_widget_get_clip", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", "\n", "return", "&", "clip", "\n", "}" ]
11,099
all-11100
[ "ContextWithPublisher", "constructs", "new", "context", "with", "bus", "." ]
[ "func", "ContextWithPublisher", "(", "ctx", "context", ".", "Context", ",", "pub", "Publisher", ")", "context", ".", "Context", "{", "return", "<mask>", ".", "WithValue", "(", "ctx", ",", "KeyPublisher", ",", "pub", ")", "\n", "}" ]