id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
18,400
all-18401
[ "NewDataReader", "returns", "a", "new", "callback", "based", "data", "buffer" ]
[ "func", "NewDataReader", "(", "r", "io", ".", "Reader", ")", "(", "*", "Data", ",", "error", ")", "{", "d", ":=", "newData", "(", ")", "\n", "d", ".", "r", "=", "r", "\n", "d", ".", "cbs", ".", "<mask>", "=", "C", ".", "gpgme_data_read_cb_t", "(", "C", ".", "gogpgme_readfunc", ")", "\n", "cbc", ":=", "callbackAdd", "(", "d", ")", "\n", "d", ".", "cbc", "=", "cbc", "\n", "return", "d", ",", "handleError", "(", "C", ".", "gogpgme_data_new_from_cbs", "(", "&", "d", ".", "dh", ",", "&", "d", ".", "cbs", ",", "C", ".", "uintptr_t", "(", "cbc", ")", ")", ")", "\n", "}" ]
18,401
all-18402
[ "NewCharsetReader", "generates", "charset", "-", "conversion", "readers", "converting", "from", "the", "provided", "charset", "into", "UTF", "-", "8", ".", "CharsetReader", "is", "a", "factory", "signature", "defined", "by", "Go", "s", "mime", ".", "WordDecoder", ".", "This", "function", "is", "similar", "to", ":", "https", ":", "//", "godoc", ".", "org", "/", "golang", ".", "org", "/", "x", "/", "net", "/", "html", "/", "charset#NewReaderLabel" ]
[ "func", "NewCharsetReader", "(", "charset", "string", ",", "input", "io", ".", "Reader", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "if", "strings", ".", "ToLower", "(", "charset", ")", "==", "utf8", "{", "return", "<mask>", ",", "nil", "\n", "}", "\n", "csentry", ",", "ok", ":=", "encodings", "[", "strings", ".", "ToLower", "(", "charset", ")", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "charset", ")", "\n", "}", "\n", "return", "transform", ".", "NewReader", "(", "input", ",", "csentry", ".", "e", ".", "NewDecoder", "(", ")", ")", ",", "nil", "\n", "}" ]
18,402
all-18403
[ "InsertRow", "inserts", "a", "new", "row", "into", "the", "desired", "project", "dataset", "and", "table", "or", "returns", "an", "error" ]
[ "func", "(", "c", "*", "Client", ")", "InsertRow", "(", "projectID", ",", "datasetID", ",", "tableID", "string", ",", "rowData", "map", "[", "string", "]", "interface", "{", "}", ")", "error", "{", "service", ",", "err", ":=", "c", ".", "connect", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "insertRequest", ":=", "buildBigQueryInsertRequest", "(", "[", "]", "map", "[", "string", "]", "interface", "{", "}", "{", "rowData", "}", ")", "\n\n", "<mask>", ",", "err", ":=", "service", ".", "Tabledata", ".", "InsertAll", "(", "projectID", ",", "datasetID", ",", "tableID", ",", "insertRequest", ")", ".", "Do", "(", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "printDebug", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "if", "len", "(", "result", ".", "InsertErrors", ")", ">", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,403
all-18404
[ "GetBool", "is", "a", "helper", "routine", "that", "returns", "a", "boolean", "representing", "if", "a", "value", "was", "set", "and", "if", "so", "dereferences", "the", "pointer", "to", "it", "." ]
[ "func", "GetBool", "(", "v", "*", "bool", ")", "(", "bool", ",", "bool", ")", "{", "if", "v", "!=", "nil", "{", "return", "*", "v", ",", "true", "\n", "}", "\n\n", "return", "<mask>", ",", "false", "\n", "}" ]
18,404
all-18405
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "HighlightFrameParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,405
all-18406
[ "PTCBalanceOf", "calls", "balanceOf", "method", "of", "Privatix", "token", "contract", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "PTCBalanceOf", "(", "opts", "*", "bind", ".", "CallOpts", ",", "owner", "<mask>", ".", "Address", ")", "(", "*", "big", ".", "Int", ",", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "opts", ".", "Context", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "opts", ".", "Context", "=", "ctx2", "\n\n", "val", ",", "err", ":=", "b", ".", "ptc", ".", "BalanceOf", "(", "opts", ",", "owner", ")", "\n", "if", "err", "!=", "nil", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "val", ",", "err", "\n", "}" ]
18,406
all-18407
[ "TouchDirAll", "is", "similar", "to", "os", ".", "MkdirAll", ".", "It", "creates", "directories", "with", "0700", "permission", "if", "any", "directory", "does", "not", "exists", ".", "TouchDirAll", "also", "ensures", "the", "given", "directory", "is", "writable", "." ]
[ "func", "TouchDirAll", "(", "dir", "string", ")", "error", "{", "// If path is already a directory, MkdirAll does nothing", "// and returns nil.", "err", ":=", "<mask>", ".", "MkdirAll", "(", "dir", ",", "PrivateDirMode", ")", "\n", "if", "err", "!=", "nil", "{", "// if mkdirAll(\"a/text\") and \"text\" is not", "// a directory, this will return syscall.ENOTDIR", "return", "err", "\n", "}", "\n", "return", "IsDirWriteable", "(", "dir", ")", "\n", "}" ]
18,407
all-18408
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetDOMBreakpointParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger3", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,408
all-18409
[ "PostLease", "--", "allows", "a", "client", "user", "to", "post", "a", "lease", "to", "dispenser" ]
[ "func", "(", "s", "*", "PDClient", ")", "PostLease", "(", "leaseID", ",", "inventoryID", ",", "skuID", ",", "userName", "string", ",", "leaseDaysDuration", "int64", ")", "(", "leaseCreateResponse", "TaskResponse", ",", "res", "*", "http", ".", "Response", ",", "err", "error", ")", "{", "var", "body", "io", ".", "Reader", "\n", "if", "body", ",", "err", "=", "s", ".", "getRequestBody", "(", "leaseID", ",", "inventoryID", ",", "skuID", ",", "userName", ",", "leaseDaysDuration", ",", "make", "(", "<mask>", "[", "string", "]", "interface", "{", "}", ",", "1", ")", ")", ";", "err", "==", "nil", "{", "req", ",", "_", ":=", "s", ".", "createRequest", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "URL", ")", ",", "body", ")", "\n\n", "if", "res", ",", "err", "=", "s", ".", "client", ".", "Do", "(", "req", ")", ";", "err", "==", "nil", "&&", "res", ".", "StatusCode", "==", "http", ".", "StatusCreated", "{", "resBodyBytes", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "res", ".", "Body", ")", "\n", "json", ".", "Unmarshal", "(", "resBodyBytes", ",", "&", "leaseCreateResponse", ")", "\n\n", "}", "else", "{", "lo", ".", "G", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "lo", ".", "G", ".", "Error", "(", "\"", "\"", ",", "res", ")", "\n", "err", "=", "ErrInvalidDispenserResponse", "\n", "}", "\n\n", "}", "else", "{", "lo", ".", "G", ".", "Error", "(", "\"", "\"", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n", "return", "\n", "}" ]
18,409
all-18410
[ "MustDestination", "retrieves", "the", "Destination", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationBody", ")", "MustDestination", "(", ")", "AccountId", "{", "val", ",", "<mask>", ":=", "u", ".", "GetDestination", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
18,410
all-18411
[ "UnsafeForEach", "must", "be", "called", "holding", "the", "lock", "on", "the", "tx", "." ]
[ "func", "(", "t", "*", "batchTx", ")", "UnsafeForEach", "(", "bucketName", "[", "]", "byte", ",", "visitor", "func", "(", "k", ",", "v", "[", "]", "byte", ")", "error", ")", "error", "{", "return", "unsafeForEach", "(", "t", ".", "<mask>", ",", "bucketName", ",", "visitor", ")", "\n", "}" ]
18,411
all-18412
[ "Delay", "set", "delay", "between", "retry", "default", "is", "100ms" ]
[ "func", "Delay", "(", "<mask>", "time", ".", "Duration", ")", "Option", "{", "return", "func", "(", "c", "*", "Config", ")", "{", "c", ".", "delay", "=", "delay", "\n", "}", "\n", "}" ]
18,412
all-18413
[ "HasLiveSpan", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetTime", ")", "HasLiveSpan", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "LiveSpan", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
18,413
all-18414
[ "copyTaskHealthMetrics", "copies", "a", "slice", "of", "taskHealthMetrics", "to", "another", "slice" ]
[ "func", "copyTaskHealthMetrics", "(", "from", "[", "]", "*", "ecstcs", ".", "TaskHealth", ")", "[", "]", "*", "ecstcs", ".", "TaskHealth", "{", "to", ":=", "make", "(", "[", "]", "*", "ecstcs", ".", "TaskHealth", ",", "len", "(", "from", ")", ")", "\n", "<mask>", "(", "to", ",", "from", ")", "\n", "return", "to", "\n", "}" ]
18,414
all-18415
[ "publishHealthMetricsOnce", "is", "invoked", "by", "the", "ticker", "to", "periodically", "publish", "metrics", "to", "backend", "." ]
[ "func", "(", "cs", "*", "clientServer", ")", "publishHealthMetricsOnce", "(", ")", "error", "{", "// Get the list of health request to send to backend.", "requests", ",", "err", ":=", "cs", ".", "createPublishHealthRequests", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// Make the publish metrics request to the backend.", "for", "_", ",", "<mask>", ":=", "range", "requests", "{", "err", "=", "cs", ".", "MakeRequest", "(", "request", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,415
all-18416
[ "Connect", "implements", "the", "database", "/", "sql", "/", "driver", "/", "Connector", "interface", "." ]
[ "func", "(", "c", "*", "Connector", ")", "Connect", "(", "ctx", "<mask>", ".", "Context", ")", "(", "driver", ".", "Conn", ",", "error", ")", "{", "return", "newConn", "(", "ctx", ",", "c", ")", "\n", "}" ]
18,416
all-18417
[ "Build", "a", "cloud", "-", "init", "user", "data", "string", "that", "will", "install", "and", "run", "docker", "." ]
[ "func", "(", "d", "*", "Driver", ")", "getCloudInit", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "var", "err", "error", "\n", "if", "d", ".", "UserDataFile", "!=", "\"", "\"", "{", "d", ".", "UserData", ",", "err", "=", "ioutil", ".", "ReadFile", "(", "d", ".", "UserDataFile", ")", "\n", "}", "\n\n", "return", "d", ".", "UserData", ",", "err", "\n", "}" ]
18,417
all-18418
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "KeyType", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "<mask>", ")", "{", "out", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
18,418
all-18419
[ "Returns", "an", "float", "at", "the", "key", "and", "whether", "or", "not", "the", "key", "existed", "and", "the", "value", "was", "an", "float" ]
[ "func", "(", "t", "Typed", ")", "FloatIf", "(", "key", "string", ")", "(", "float64", ",", "bool", ")", "{", "value", ",", "exists", ":=", "t", "[", "key", "]", "\n", "if", "exists", "==", "false", "{", "return", "0", ",", "<mask>", "\n", "}", "\n", "switch", "t", ":=", "value", ".", "(", "type", ")", "{", "case", "float64", ":", "return", "t", ",", "true", "\n", "case", "string", ":", "f", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "t", ",", "10", ")", "\n", "return", "f", ",", "err", "==", "nil", "\n", "}", "\n", "return", "0", ",", "false", "\n", "}" ]
18,419
all-18420
[ "Get", "provides", "your", "readHandler", "with", "the", "contents", "at", "key" ]
[ "func", "(", "c", "*", "Cache", ")", "Get", "(", "key", "string", ",", "readHandler", "ReadHandler", ")", "error", "{", "path", ":=", "c", ".", "KeyToPath", "(", "<mask>", ")", "\n", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "return", "readHandler", "(", "false", ",", "nil", ")", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "readHandler", "(", "true", ",", "f", ")", "\n", "}" ]
18,420
all-18421
[ "NewLogBackend", "creates", "a", "new", "LogBackend", "." ]
[ "func", "NewLogBackend", "(", "out", "io", ".", "Writer", ",", "<mask>", "string", ",", "flag", "int", ")", "*", "LogBackend", "{", "return", "&", "LogBackend", "{", "Logger", ":", "log", ".", "New", "(", "out", ",", "prefix", ",", "flag", ")", "}", "\n", "}" ]
18,421
all-18422
[ "GetMarginOk", "returns", "a", "tuple", "with", "the", "Margin", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "i", "*", "ImageDefinition", ")", "GetMarginOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "i", "==", "nil", "||", "i", ".", "Margin", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "i", ".", "Margin", ",", "<mask>", "\n", "}" ]
18,422
all-18423
[ "deleteRevKey", "deletes", "a", "key", "by", "revision", "returning", "false", "if", "key", "is", "missing" ]
[ "func", "deleteRevKey", "(", "kv", "v3", ".", "KV", ",", "key", "string", ",", "rev", "int64", ")", "(", "bool", ",", "error", ")", "{", "cmp", ":=", "v3", ".", "Compare", "(", "v3", ".", "ModRevision", "(", "key", ")", ",", "\"", "\"", ",", "rev", ")", "\n", "req", ":=", "v3", ".", "OpDelete", "(", "key", ")", "\n", "txnresp", ",", "err", ":=", "kv", ".", "Txn", "(", "context", ".", "TODO", "(", ")", ")", ".", "If", "(", "cmp", ")", ".", "Then", "(", "req", ")", ".", "Commit", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "else", "if", "!", "txnresp", ".", "Succeeded", "{", "return", "<mask>", ",", "nil", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}" ]
18,423
all-18424
[ "ContainerConfigGet", "returns", "the", "value", "of", "the", "given", "key", "in", "the", "configuration", "of", "the", "container", "with", "the", "given", "ID", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerConfigGet", "(", "id", "int", ",", "key", "string", ")", "(", "string", ",", "error", ")", "{", "q", ":=", "\"", "\"", "\n", "<mask>", ":=", "\"", "\"", "\n", "arg1", ":=", "[", "]", "interface", "{", "}", "{", "id", ",", "key", "}", "\n", "arg2", ":=", "[", "]", "interface", "{", "}", "{", "&", "value", "}", "\n", "err", ":=", "dbQueryRowScan", "(", "c", ".", "db", ",", "q", ",", "arg1", ",", "arg2", ")", "\n", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "\"", "\"", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "return", "value", ",", "err", "\n", "}" ]
18,424
all-18425
[ "PullDiff", "is", "like", "Pull", "except", "that", "it", "materializes", "a", "Diff", "of", "the", "content", "rather", "than", "a", "the", "actual", "content", ".", "If", "newOnly", "is", "true", "then", "only", "new", "files", "will", "be", "downloaded", "and", "they", "will", "be", "downloaded", "under", "root", ".", "Otherwise", "new", "and", "old", "files", "will", "be", "downloaded", "under", "root", "/", "new", "and", "root", "/", "old", "respectively", "." ]
[ "func", "(", "p", "*", "Puller", ")", "PullDiff", "(", "client", "*", "pachclient", ".", "APIClient", ",", "root", "string", ",", "newRepo", ",", "newCommit", ",", "newPath", ",", "oldRepo", ",", "oldCommit", ",", "oldPath", "string", ",", "newOnly", "bool", ",", "pipes", "bool", ",", "emptyFiles", "bool", ",", "concurrency", "int", ",", "<mask>", "hashtree", ".", "HashTree", ",", "treeRoot", "string", ")", "error", "{", "limiter", ":=", "limit", ".", "New", "(", "concurrency", ")", "\n", "var", "eg", "errgroup", ".", "Group", "\n", "newFiles", ",", "oldFiles", ",", "err", ":=", "client", ".", "DiffFile", "(", "newRepo", ",", "newCommit", ",", "newPath", ",", "oldRepo", ",", "oldCommit", ",", "oldPath", ",", "false", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "newFile", ":=", "range", "newFiles", "{", "basepath", ",", "err", ":=", "filepath", ".", "Rel", "(", "newPath", ",", "newFile", ".", "File", ".", "Path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "tree", "!=", "nil", "{", "treePath", ":=", "path", ".", "Join", "(", "treeRoot", ",", "\"", "\"", ",", "basepath", ")", "\n", "if", "newOnly", "{", "treePath", "=", "path", ".", "Join", "(", "treeRoot", ",", "basepath", ")", "\n", "}", "\n", "if", "err", ":=", "tree", ".", "PutFile", "(", "treePath", ",", "newFile", ".", "Objects", ",", "int64", "(", "newFile", ".", "SizeBytes", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "path", ":=", "filepath", ".", "Join", "(", "root", ",", "\"", "\"", ",", "basepath", ")", "\n", "if", "newOnly", "{", "path", "=", "filepath", ".", "Join", "(", "root", ",", "basepath", ")", "\n", "}", "\n", "if", "pipes", "{", "if", "err", ":=", "p", ".", "makePipe", "(", "path", ",", "func", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "client", ".", "GetFile", "(", "newFile", ".", "File", ".", "Commit", ".", "Repo", ".", "Name", ",", "newFile", ".", "File", ".", "Commit", ".", "ID", ",", "newFile", ".", "File", ".", "Path", ",", "0", ",", "0", ",", "w", ")", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "if", "emptyFiles", "{", "if", "err", ":=", "p", ".", "makeFile", "(", "path", ",", "func", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "nil", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "newFile", ":=", "newFile", "\n", "limiter", ".", "Acquire", "(", ")", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "defer", "limiter", ".", "Release", "(", ")", "\n", "return", "p", ".", "makeFile", "(", "path", ",", "func", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "client", ".", "GetFile", "(", "newFile", ".", "File", ".", "Commit", ".", "Repo", ".", "Name", ",", "newFile", ".", "File", ".", "Commit", ".", "ID", ",", "newFile", ".", "File", ".", "Path", ",", "0", ",", "0", ",", "w", ")", "\n", "}", ")", "\n", "}", ")", "\n", "}", "\n", "}", "\n", "if", "!", "newOnly", "{", "for", "_", ",", "oldFile", ":=", "range", "oldFiles", "{", "basepath", ",", "err", ":=", "filepath", ".", "Rel", "(", "oldPath", ",", "oldFile", ".", "File", ".", "Path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "tree", "!=", "nil", "{", "treePath", ":=", "path", ".", "Join", "(", "treeRoot", ",", "\"", "\"", ",", "basepath", ")", "\n", "if", "err", ":=", "tree", ".", "PutFile", "(", "treePath", ",", "oldFile", ".", "Objects", ",", "int64", "(", "oldFile", ".", "SizeBytes", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "path", ":=", "filepath", ".", "Join", "(", "root", ",", "\"", "\"", ",", "basepath", ")", "\n", "if", "pipes", "{", "if", "err", ":=", "p", ".", "makePipe", "(", "path", ",", "func", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "client", ".", "GetFile", "(", "oldFile", ".", "File", ".", "Commit", ".", "Repo", ".", "Name", ",", "oldFile", ".", "File", ".", "Commit", ".", "ID", ",", "oldFile", ".", "File", ".", "Path", ",", "0", ",", "0", ",", "w", ")", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "else", "{", "oldFile", ":=", "oldFile", "\n", "limiter", ".", "Acquire", "(", ")", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "defer", "limiter", ".", "Release", "(", ")", "\n", "return", "p", ".", "makeFile", "(", "path", ",", "func", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "client", ".", "GetFile", "(", "oldFile", ".", "File", ".", "Commit", ".", "Repo", ".", "Name", ",", "oldFile", ".", "File", ".", "Commit", ".", "ID", ",", "oldFile", ".", "File", ".", "Path", ",", "0", ",", "0", ",", "w", ")", "\n", "}", ")", "\n", "}", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "eg", ".", "Wait", "(", ")", "\n", "}" ]
18,425
all-18426
[ "Send", "a", "message", "using", "SMTP", "configuration", "or", "returns", "an", "error", "if", "something", "goes", "wrong", "." ]
[ "func", "(", "sm", "SMTPSender", ")", "Send", "(", "message", "Message", ")", "error", "{", "gm", ":=", "gomail", ".", "NewMessage", "(", ")", "\n\n", "gm", ".", "SetHeader", "(", "\"", "\"", ",", "message", ".", "From", ")", "\n", "gm", ".", "SetHeader", "(", "\"", "\"", ",", "message", ".", "To", "...", ")", "\n", "gm", ".", "SetHeader", "(", "\"", "\"", ",", "message", ".", "Subject", ")", "\n", "gm", ".", "SetHeader", "(", "\"", "\"", ",", "<mask>", ".", "CC", "...", ")", "\n", "gm", ".", "SetHeader", "(", "\"", "\"", ",", "message", ".", "Bcc", "...", ")", "\n\n", "sm", ".", "addBodies", "(", "message", ",", "gm", ")", "\n", "sm", ".", "addAttachments", "(", "message", ",", "gm", ")", "\n\n", "for", "field", ",", "value", ":=", "range", "message", ".", "Headers", "{", "gm", ".", "SetHeader", "(", "field", ",", "value", ")", "\n", "}", "\n\n", "err", ":=", "sm", ".", "Dialer", ".", "DialAndSend", "(", "gm", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,426
all-18427
[ "SetVisibleChildFull", "is", "a", "wrapper", "around", "gtk_stack_set_visible_child_full", "()", "." ]
[ "func", "(", "v", "*", "Stack", ")", "SetVisibleChildFull", "(", "<mask>", "string", ",", "transaction", "StackTransitionType", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_stack_set_visible_child_full", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "GtkStackTransitionType", "(", "transaction", ")", ")", "\n", "}" ]
18,427
all-18428
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "ToplistDefinition", ")", "GetType", "(", ")", "string", "{", "if", "t", "==", "nil", "||", "t", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "Type", "\n", "}" ]
18,428
all-18429
[ "SetRetryOptions", "sets", "RetryOptions", "in", "the", "context", "." ]
[ "func", "(", "cb", "*", "ContextBuilder", ")", "SetRetryOptions", "(", "retryOptions", "*", "RetryOptions", ")", "*", "ContextBuilder", "{", "cb", ".", "RetryOptions", "=", "retryOptions", "\n", "<mask>", "cb", "\n", "}" ]
18,429
all-18430
[ "GetOrAdd", "returns", "a", "peer", "for", "the", "given", "hostPort", "creating", "one", "if", "it", "doesn", "t", "yet", "exist", "." ]
[ "func", "(", "l", "*", "RootPeerList", ")", "GetOrAdd", "(", "hostPort", "string", ")", "*", "Peer", "{", "<mask>", ",", "ok", ":=", "l", ".", "Get", "(", "hostPort", ")", "\n", "if", "ok", "{", "return", "peer", "\n", "}", "\n\n", "return", "l", ".", "Add", "(", "hostPort", ")", "\n", "}" ]
18,430
all-18431
[ "/", "*", "load", "image", "from", "file", "iscolor", "can", "be", "a", "combination", "of", "above", "flags", "where", "CV_LOAD_IMAGE_UNCHANGED", "overrides", "the", "other", "flags", "using", "CV_LOAD_IMAGE_ANYCOLOR", "alone", "is", "equivalent", "to", "CV_LOAD_IMAGE_UNCHANGED", "unless", "CV_LOAD_IMAGE_ANYDEPTH", "is", "specified", "images", "are", "converted", "to", "8bit" ]
[ "func", "LoadImage", "(", "filename", "string", ",", "iscolor_", "...", "int", ")", "*", "IplImage", "{", "iscolor", ":=", "CV_LOAD_IMAGE_COLOR", "\n", "if", "len", "(", "iscolor_", ")", ">", "0", "{", "iscolor", "=", "iscolor_", "[", "0", "]", "\n", "}", "\n", "name_c", ":=", "C", ".", "CString", "(", "<mask>", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "name_c", ")", ")", "\n\n", "rv", ":=", "C", ".", "cvLoadImage", "(", "name_c", ",", "C", ".", "int", "(", "iscolor", ")", ")", "\n", "return", "(", "*", "IplImage", ")", "(", "rv", ")", "\n", "}" ]
18,431
all-18432
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "ResourcePriority", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "ResourcePriority", "(", "in", ".", "String", "(", ")", ")", "{", "case", "ResourcePriorityVeryLow", ":", "*", "t", "=", "ResourcePriorityVeryLow", "\n", "case", "ResourcePriorityLow", ":", "*", "t", "=", "ResourcePriorityLow", "\n", "<mask>", "ResourcePriorityMedium", ":", "*", "t", "=", "ResourcePriorityMedium", "\n", "case", "ResourcePriorityHigh", ":", "*", "t", "=", "ResourcePriorityHigh", "\n", "case", "ResourcePriorityVeryHigh", ":", "*", "t", "=", "ResourcePriorityVeryHigh", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
18,432
all-18433
[ "Advance", "()", ":", "non", "-", "standard", "but", "better", "than", "Next", "()", "because", "we", "don", "t", "have", "to", "unwrap", "our", "buffer", "and", "pay", "the", "cpu", "time", "for", "the", "copy", "that", "unwrapping", "may", "need", ".", "Useful", "in", "conjuction", "/", "after", "ReadWithoutAdvance", "()", "above", "." ]
[ "func", "(", "b", "*", "FixedSizeRingBuf", ")", "Advance", "(", "n", "int", ")", "{", "if", "n", "<=", "0", "{", "<mask>", "\n", "}", "\n", "if", "n", ">", "b", ".", "Readable", "{", "n", "=", "b", ".", "Readable", "\n", "}", "\n", "b", ".", "Readable", "-=", "n", "\n", "b", ".", "Beg", "=", "(", "b", ".", "Beg", "+", "n", ")", "%", "b", ".", "N", "\n", "}" ]
18,433
all-18434
[ "Getfilecon", "returns", "the", "SELinux", "label", "for", "this", "path", "or", "returns", "an", "error", "." ]
[ "func", "Getfilecon", "(", "path", "string", ")", "(", "string", ",", "error", ")", "{", "con", ",", "err", ":=", "system", ".", "Lgetxattr", "(", "<mask>", ",", "xattrNameSelinux", ")", "\n\n", "// Trim the NUL byte at the end of the byte buffer, if present.", "if", "con", "[", "len", "(", "con", ")", "-", "1", "]", "==", "'\\x00'", "{", "con", "=", "con", "[", ":", "len", "(", "con", ")", "-", "1", "]", "\n", "}", "\n", "return", "string", "(", "con", ")", ",", "err", "\n", "}" ]
18,434
all-18435
[ "Start", "will", "start", "the", "indicator" ]
[ "func", "(", "s", "*", "Spinner", ")", "Start", "(", ")", "{", "s", ".", "lock", ".", "Lock", "(", ")", "\n", "if", "s", ".", "active", "{", "s", ".", "lock", ".", "Unlock", "(", ")", "\n", "return", "\n", "}", "\n", "if", "s", ".", "HideCursor", "&&", "runtime", ".", "GOOS", "!=", "\"", "\"", "{", "// hides the cursor", "fmt", ".", "Print", "(", "\"", "\\033", "\"", ")", "\n", "}", "\n", "s", ".", "active", "=", "true", "\n", "s", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "go", "func", "(", ")", "{", "for", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "s", ".", "chars", ")", ";", "i", "++", "{", "select", "{", "case", "<-", "s", ".", "stopChan", ":", "return", "\n", "default", ":", "s", ".", "lock", ".", "Lock", "(", ")", "\n", "s", ".", "erase", "(", ")", "\n", "var", "outColor", "string", "\n", "if", "runtime", ".", "GOOS", "==", "\"", "\"", "{", "if", "s", ".", "Writer", "==", "os", ".", "Stderr", "{", "outColor", "=", "fmt", ".", "Sprintf", "(", "\"", "\\r", "\"", ",", "s", ".", "Prefix", ",", "s", ".", "chars", "[", "i", "]", ",", "s", ".", "Suffix", ")", "\n", "}", "else", "{", "outColor", "=", "fmt", ".", "Sprintf", "(", "\"", "\\r", "\"", ",", "s", ".", "Prefix", ",", "s", ".", "color", "(", "s", ".", "chars", "[", "i", "]", ")", ",", "s", ".", "Suffix", ")", "\n", "}", "\n", "}", "else", "{", "outColor", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "Prefix", ",", "s", ".", "color", "(", "s", ".", "chars", "[", "i", "]", ")", ",", "s", ".", "Suffix", ")", "\n", "}", "\n", "outPlain", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "Prefix", ",", "s", ".", "chars", "[", "i", "]", ",", "s", ".", "Suffix", ")", "\n", "fmt", ".", "Fprint", "(", "s", ".", "Writer", ",", "outColor", ")", "\n", "s", ".", "lastOutput", "=", "outPlain", "\n", "<mask>", ":=", "s", ".", "Delay", "\n", "s", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "time", ".", "Sleep", "(", "delay", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "}" ]
18,435
all-18436
[ "New", "handler", "." ]
[ "func", "New", "(", "w", "io", ".", "Writer", ")", "*", "Handler", "{", "var", "useColor", "bool", "\n", "if", "os", ".", "Getenv", "(", "\"", "\"", ")", "!=", "\"", "\"", "{", "useColor", "=", "true", "\n", "}", "\n", "if", "term", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "term", "!=", "\"", "\"", "{", "for", "_", ",", "substring", ":=", "range", "colorTermSubstrings", "{", "if", "strings", ".", "Contains", "(", "term", ",", "substring", ")", "{", "useColor", "=", "<mask>", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "&", "Handler", "{", "Writer", ":", "w", ",", "UseColor", ":", "useColor", ",", "}", "\n", "}" ]
18,436
all-18437
[ "expireExists", "returns", "true", "if", "expiry", "items", "exist", ".", "It", "pops", "only", "when", "expiry", "item", "exists", ".", "next", "is", "true", "to", "indicate", "that", "it", "may", "exist", "in", "next", "attempt", "." ]
[ "func", "(", "le", "*", "lessor", ")", "expireExists", "(", ")", "(", "l", "*", "Lease", ",", "ok", "bool", ",", "next", "bool", ")", "{", "if", "le", ".", "leaseHeap", ".", "Len", "(", ")", "==", "0", "{", "return", "nil", ",", "false", ",", "false", "\n", "}", "\n\n", "item", ":=", "le", ".", "leaseHeap", "[", "0", "]", "\n", "l", "=", "le", ".", "leaseMap", "[", "item", ".", "id", "]", "\n", "if", "l", "==", "nil", "{", "// lease has expired or been revoked", "// no need to revoke (nothing is expiry)", "heap", ".", "Pop", "(", "&", "le", ".", "leaseHeap", ")", "// O(log N)", "\n", "return", "nil", ",", "false", ",", "true", "\n", "}", "\n\n", "if", "time", ".", "Now", "(", ")", ".", "UnixNano", "(", ")", "<", "item", ".", "time", "/* expiration time */", "{", "// Candidate expirations are caught up, reinsert this item", "// and no need to revoke (nothing is expiry)", "return", "l", ",", "false", ",", "false", "\n", "}", "\n", "// if the lease is actually expired, add to the removal list. If it is not expired, we can ignore it because another entry will have been inserted into the heap", "heap", ".", "Pop", "(", "&", "le", ".", "leaseHeap", ")", "// O(log N)", "\n", "return", "l", ",", "true", ",", "<mask>", "\n", "}" ]
18,437
all-18438
[ "WithColor", "the", "highlight", "fill", "color", "(", "default", ":", "transparent", ")", "." ]
[ "func", "(", "p", "HighlightQuadParams", ")", "WithColor", "(", "color", "*", "cdp", ".", "RGBA", ")", "*", "HighlightQuadParams", "{", "p", ".", "<mask>", "=", "color", "\n", "return", "&", "p", "\n", "}" ]
18,438
all-18439
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetAttributesAsTextParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,439
all-18440
[ "BoolVar", "defines", "a", "bool", "flag", "with", "specified", "name", "default", "value", "and", "usage", "string", ".", "The", "argument", "p", "points", "to", "a", "bool", "variable", "in", "which", "to", "store", "the", "value", "of", "the", "flag", "." ]
[ "func", "BoolVar", "(", "p", "*", "bool", ",", "name", "string", ",", "<mask>", "bool", ",", "usage", "string", ")", "{", "EnvironmentFlags", ".", "BoolVar", "(", "p", ",", "name", ",", "value", ",", "usage", ")", "\n", "}" ]
18,440
all-18441
[ "QueryInt", "returns", "query", "result", "in", "int", "type", "." ]
[ "func", "(", "ctx", "*", "Context", ")", "QueryInt", "(", "<mask>", "string", ")", "int", "{", "return", "com", ".", "StrTo", "(", "ctx", ".", "Query", "(", "name", ")", ")", ".", "MustInt", "(", ")", "\n", "}" ]
18,441
all-18442
[ "flattenHostNicFailureCriteria", "reads", "various", "fields", "from", "a", "HostNicFailureCriteria", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenHostNicFailureCriteria", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "HostNicFailureCriteria", ")", "error", "{", "if", "obj", ".", "CheckBeacon", "!=", "nil", "{", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "CheckBeacon", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,442
all-18443
[ "GetPullStartedAt", "returns", "the", "PullStartedAt", "timestamp" ]
[ "func", "(", "task", "*", "Task", ")", "GetPullStartedAt", "(", ")", "time", ".", "Time", "{", "<mask>", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "task", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "task", ".", "PullStartedAtUnsafe", "\n", "}" ]
18,443
all-18444
[ "Sorta", "rearranges", "the", "position", "of", "string", "entries", "in", "this", "list", "so", "that", "they", "are", "ascending", "." ]
[ "func", "(", "list", "*", "LinkedList", ")", "Sorta", "(", ")", "error", "{", "list", ".", "key", ".", "Lock", "(", ")", "\n", "defer", "list", ".", "key", ".", "Unlock", "(", ")", "\n\n", "var", "err", "error", "\n", "list", ".", "first", ",", "err", "=", "mergeSort", "(", "list", ".", "first", ",", "func", "(", "a", ",", "b", "<mask>", "{", "}", ")", "(", "int", ",", "error", ")", "{", "castA", ",", "ok", ":=", "a", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "0", ",", "ErrUnexpectedType", "\n", "}", "\n", "castB", ",", "ok", ":=", "b", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "0", ",", "ErrUnexpectedType", "\n", "}", "\n\n", "return", "strings", ".", "Compare", "(", "castA", ",", "castB", ")", ",", "nil", "\n", "}", ")", "\n", "list", ".", "last", "=", "findLast", "(", "list", ".", "first", ")", "\n", "return", "err", "\n", "}" ]
18,444
all-18445
[ "focus", "on", "provided", "window", ".", "This", "will", "implicitly", "focus", "on", "a", "window", "widget", "that", "can", "have", "focus", ".", "Render", "and", "flush", "it", "onto", "the", "terminal", ".", "focus", "shall", "be", "called", "from", "queue", "context", "." ]
[ "func", "focusWindow", "(", "w", "*", "Window", ")", "{", "if", "w", "==", "nil", "{", "return", "\n", "}", "\n", "_", ",", "found", ":=", "windows", "[", "w", ".", "id", "]", "\n", "if", "!", "<mask>", "{", "return", "\n", "}", "\n", "if", "focus", "==", "w", "{", "return", "\n", "}", "\n", "prevFocus", "=", "focus", "\n", "focus", "=", "w", "\n\n", "resizeAndRender", "(", "w", ")", "\n", "}" ]
18,445
all-18446
[ "RemoveTeamMembership", "removes", "the", "user", "from", "the", "team", "(", "but", "not", "the", "org", ")", ".", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "teams", "/", "members", "/", "#remove", "-", "team", "-", "member" ]
[ "func", "(", "c", "*", "Client", ")", "RemoveTeamMembership", "(", "id", "int", ",", "user", "string", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "id", ",", "user", ")", "\n", "if", "c", ".", "fake", "{", "return", "nil", "\n", "}", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "<mask>", "{", "method", ":", "http", ".", "MethodDelete", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "id", ",", "user", ")", ",", "exitCodes", ":", "[", "]", "int", "{", "204", "}", ",", "}", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
18,446
all-18447
[ "GetTabDetachable", "()", "is", "a", "wrapper", "around", "gtk_notebook_get_tab_detachable", "()", "." ]
[ "func", "(", "v", "*", "Notebook", ")", "GetTabDetachable", "(", "child", "IWidget", ")", "bool", "{", "c", ":=", "C", ".", "gtk_notebook_get_tab_detachable", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
18,447
all-18448
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "GetType", "(", ")", "string", "{", "if", "t", "==", "nil", "||", "t", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "t", ".", "Type", "\n", "}" ]
18,448
all-18449
[ "JobParameterized", "tells", "us", "if", "the", "Jenkins", "job", "for", "this", "ProwJob", "is", "parameterized" ]
[ "func", "(", "c", "*", "Client", ")", "JobParameterized", "(", "jobInfo", "*", "JobInfo", ")", "bool", "{", "for", "_", ",", "prop", ":=", "range", "jobInfo", ".", "Property", "{", "if", "<mask>", ".", "ParameterDefinitions", "!=", "nil", "&&", "len", "(", "prop", ".", "ParameterDefinitions", ")", ">", "0", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
18,449
all-18450
[ "HasChangeType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "HasChangeType", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "ChangeType", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
18,450
all-18451
[ "SearchAccounts", "returns", "accounts", "matching", "a", "filter", "(", "search", "queries", "are", "not", "suppoted", "by", "the", "account", "endpoint", ")", ".", "Pass", "nil", "as", "filter", "for", "all", "accounts", "the", "API", "Token", "can", "access", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchAccounts", "(", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "Account", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "range", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchAccounts", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "AccountPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "<mask>", "accounts", "[", "]", "Account", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "accounts", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "accounts", ",", "nil", "\n", "}" ]
18,451
all-18452
[ "Fatalf", "outputs", "formatted", "Failed", "log", "and", "exit", "program" ]
[ "func", "(", "g", "*", "Glg", ")", "Fatalf", "(", "format", "string", ",", "val", "...", "interface", "{", "}", ")", "{", "err", ":=", "g", ".", "out", "(", "FATAL", ",", "format", ",", "val", "...", ")", "\n", "if", "err", "!=", "nil", "{", "err", "=", "g", ".", "Error", "(", "err", ".", "<mask>", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}", "\n", "exit", "(", "1", ")", "\n", "}" ]
18,452
all-18453
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventFrameNavigated", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage64", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,453
all-18454
[ "HasTickEdge", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "Widget", ")", "HasTickEdge", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "TickEdge", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
18,454
all-18455
[ "Template", "renders", "the", "named", "files", "using", "the", "specified", "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", "}}", "." ]
[ "func", "(", "e", "*", "Engine", ")", "Template", "(", "c", "string", ",", "names", "...", "string", ")", "Renderer", "{", "return", "&", "templateRenderer", "{", "Engine", ":", "e", ",", "contentType", ":", "c", ",", "<mask>", ":", "names", ",", "}", "\n", "}" ]
18,455
all-18456
[ "Using", "the", "EZ", "API", "posts", "a", "value", "to", "a", "stat", "using", "DefaultReporter", "." ]
[ "func", "PostEZValue", "(", "statName", ",", "ezkey", "string", ",", "value", "float64", ")", "error", "{", "return", "DefaultReporter", ".", "PostEZValue", "(", "statName", ",", "ezkey", ",", "<mask>", ")", "\n", "}" ]
18,456
all-18457
[ "PushBatchPoints", "pushes", "the", "batch", "points", "(", "for", "real", ")" ]
[ "func", "(", "i", "*", "InfluxDB", ")", "PushBatchPoints", "(", ")", "error", "{", "// Push", "err", ":=", "i", ".", "client", ".", "Write", "(", "i", ".", "batch", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "glog", ".", "Infof", "(", "\"", "\"", ",", "i", ".", "batchSize", ")", "\n\n", "// Recreate new batch", "i", ".", "batch", ",", "err", "=", "influxdb", ".", "NewBatchPoints", "(", "influxdb", ".", "BatchPointsConfig", "{", "<mask>", ":", "i", ".", "database", ",", "Precision", ":", "\"", "\"", ",", "}", ")", "\n", "i", ".", "batchSize", "=", "0", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,457
all-18458
[ "IsApproved", "returns", "a", "bool", "indicating", "whether", "the", "PR", "is", "fully", "approved", ".", "If", "a", "human", "manually", "added", "the", "approved", "label", "this", "returns", "true", "ignoring", "normal", "approval", "rules", "." ]
[ "func", "(", "ap", "Approvers", ")", "IsApproved", "(", ")", "bool", "{", "reqsMet", ":=", "ap", ".", "RequirementsMet", "(", ")", "\n", "if", "!", "reqsMet", "&&", "ap", ".", "ManuallyApproved", "(", ")", "{", "return", "<mask>", "\n", "}", "\n", "return", "reqsMet", "\n", "}" ]
18,458
all-18459
[ "Returns", "a", "float", "slice", "+", "true", "if", "valid", "Returns", "nil", "+", "false", "otherwise", "(", "returns", "nil", "+", "false", "if", "one", "of", "the", "values", "is", "not", "a", "valid", "float", ")" ]
[ "func", "(", "t", "Typed", ")", "FloatsIf", "(", "key", "string", ")", "(", "[", "]", "float64", ",", "bool", ")", "{", "value", ",", "exists", ":=", "t", "[", "key", "]", "\n", "if", "exists", "==", "false", "{", "return", "nil", ",", "false", "\n", "}", "\n", "if", "n", ",", "ok", ":=", "value", ".", "(", "[", "]", "float64", ")", ";", "ok", "{", "return", "n", ",", "true", "\n", "}", "\n", "if", "a", ",", "<mask>", ":=", "value", ".", "(", "[", "]", "interface", "{", "}", ")", ";", "ok", "{", "l", ":=", "len", "(", "a", ")", "\n", "n", ":=", "make", "(", "[", "]", "float64", ",", "l", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "l", ";", "i", "++", "{", "switch", "t", ":=", "a", "[", "i", "]", ".", "(", "type", ")", "{", "case", "float64", ":", "n", "[", "i", "]", "=", "t", "\n", "case", "string", ":", "f", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "t", ",", "10", ")", "\n", "if", "err", "!=", "nil", "{", "return", "n", ",", "false", "\n", "}", "\n", "n", "[", "i", "]", "=", "f", "\n", "default", ":", "return", "n", ",", "false", "\n", "}", "\n", "}", "\n", "return", "n", ",", "true", "\n", "}", "\n", "return", "nil", ",", "false", "\n", "}" ]
18,459
all-18460
[ "Result", "returns", "the", "result", "of", "the", "last", "action", "." ]
[ "func", "(", "p", "*", "Pipeline", ")", "Result", "(", ")", "Result", "{", "action", ":=", "p", ".", "actions", "[", "len", "(", "p", ".", "actions", ")", "-", "1", "]", "\n", "action", ".", "rMutex", ".", "Lock", "(", ")", "\n", "defer", "<mask>", ".", "rMutex", ".", "Unlock", "(", ")", "\n", "return", "action", ".", "result", "\n", "}" ]
18,460
all-18461
[ "DiffGeneral", "performs", "complex", "validation", "of", "an", "individual", "disk", "sub", "-", "resource", "that", "can", "t", "be", "done", "in", "schema", "alone", ".", "Should", "be", "run", "on", "new", "and", "existing", "disks", "." ]
[ "func", "(", "r", "*", "DiskSubresource", ")", "DiffGeneral", "(", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "r", ")", "\n", "name", ",", "err", ":=", "diskLabelOrName", "(", "r", ".", "data", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Enforce the maximum unit number, which is the current value of", "// scsi_controller_count * 15 - 1.", "ctlrCount", ":=", "r", ".", "rdd", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", "\n", "maxUnit", ":=", "ctlrCount", "*", "15", "-", "1", "\n", "currentUnit", ":=", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", "\n", "if", "currentUnit", ">", "maxUnit", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ",", "currentUnit", ",", "maxUnit", ",", "ctlrCount", ")", "\n", "}", "\n\n", "if", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "bool", ")", "{", "switch", "{", "case", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "==", "\"", "\"", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "case", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", ">", "0", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "case", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "bool", ")", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "case", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "bool", ")", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "}", "else", "{", "// Enforce size as a required field when attach is not set", "if", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "int", ")", "<", "1", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "}", "\n", "// Block certain options from being set depending on the vSphere version.", "version", ":=", "viapi", ".", "ParseVersionFromClient", "(", "r", ".", "client", ")", "\n", "if", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "string", ")", "!=", "string", "(", "types", ".", "VirtualDiskSharingSharingNone", ")", "{", "if", "version", ".", "Older", "(", "viapi", ".", "VSphereVersion", "{", "Product", ":", "version", ".", "Product", ",", "Major", ":", "6", "}", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "// Prevent eagerly_scrub and thin_provisioned from both being set to true. A", "// thin_provisioned disk cannot be eagerly scrubbed since it would then be", "// allocating the entire disk.", "if", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "bool", ")", "&&", "r", ".", "Get", "(", "\"", "\"", ")", ".", "(", "bool", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "r", ")", "\n", "return", "nil", "\n", "}" ]
18,461
all-18462
[ "Sub", "returns", "a", "new", "vector", "that", "is", "the", "result", "of", "v", "-", "v1", ".", "It", "allocates", "a", "new", "vector", "/", "slice", "." ]
[ "func", "(", "v", "Vec2", ")", "Sub", "(", "v1", "Vec2", ")", "Vec2", "{", "<mask>", "NewVec2XY", "(", "v", "[", "0", "]", "-", "v1", "[", "0", "]", ",", "v", "[", "1", "]", "-", "v1", "[", "1", "]", ",", ")", "\n", "}" ]
18,462
all-18463
[ "Item", "returns", "pointer", "to", "the", "current", "key", "-", "value", "pair", ".", "This", "item", "is", "only", "valid", "until", "it", ".", "Next", "()", "gets", "called", "." ]
[ "func", "(", "<mask>", "*", "Iterator", ")", "Item", "(", ")", "*", "Item", "{", "tx", ":=", "it", ".", "txn", "\n", "tx", ".", "addReadKey", "(", "it", ".", "item", ".", "Key", "(", ")", ")", "\n", "return", "it", ".", "item", "\n", "}" ]
18,463
all-18464
[ "gtk_action_bar_set_center_widget", "(", "GtkActionBar", "*", "action_bar", "GtkWidget", "*", "center_widget", ")" ]
[ "func", "(", "a", "*", "ActionBar", ")", "SetCenterWidget", "(", "child", "IWidget", ")", "{", "if", "<mask>", "==", "nil", "{", "C", ".", "gtk_action_bar_set_center_widget", "(", "a", ".", "native", "(", ")", ",", "nil", ")", "\n", "}", "else", "{", "C", ".", "gtk_action_bar_set_center_widget", "(", "a", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ")", "\n", "}", "\n", "}" ]
18,464
all-18465
[ "RunBot", "runs", "a", "bot", ".", "It", "will", "block", "until", "either", "something", "very", "bad", "happens", "or", "closing", "is", "closed", "." ]
[ "func", "RunBot", "(", "apiKey", "string", ",", "bot", "BotFunc", ",", "name", ",", "description", "string", ")", "{", "closing", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "name", ",", "description", ")", "\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n\n", "api", ",", "err", ":=", "tbotapi", ".", "New", "(", "apiKey", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Fatal", "(", "err", ")", "\n", "}", "\n\n", "// Just to show its working.", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "api", ".", "ID", ")", "\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "api", ".", "Name", ")", "\n", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "api", ".", "Username", ")", "\n\n", "closed", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "wg", ":=", "&", "sync", ".", "WaitGroup", "{", "}", "\n\n", "wg", ".", "Add", "(", "1", ")", "\n", "go", "func", "(", ")", "{", "defer", "wg", ".", "Done", "(", ")", "\n", "for", "{", "select", "{", "case", "<-", "closed", ":", "return", "\n", "case", "update", ":=", "<-", "api", ".", "Updates", ":", "if", "update", ".", "Error", "(", ")", "!=", "nil", "{", "// TODO handle this properly", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "update", ".", "Error", "(", ")", ")", "\n", "continue", "\n", "}", "\n\n", "bot", "(", "update", ".", "Update", "(", ")", ",", "api", ")", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "// Ensure a clean shutdown.", "shutdown", ":=", "make", "(", "chan", "<mask>", ".", "Signal", ")", "\n", "signal", ".", "Notify", "(", "shutdown", ",", "syscall", ".", "SIGINT", ",", "syscall", ".", "SIGTERM", ")", "\n\n", "go", "func", "(", ")", "{", "<-", "shutdown", "\n", "close", "(", "closing", ")", "\n", "}", "(", ")", "\n\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n\n", "// Wait for the signal.", "<-", "closing", "\n", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n\n", "// Always close the API first, let it clean up the update loop.", "// This might take a while.", "api", ".", "Close", "(", ")", "\n", "close", "(", "closed", ")", "\n", "wg", ".", "Wait", "(", ")", "\n", "}" ]
18,465
all-18466
[ "Static", "returns", "a", "middleware", "handler", "that", "serves", "static", "files", "in", "the", "given", "directory", "." ]
[ "func", "Static", "(", "directory", "string", ",", "staticOpt", "...", "StaticOptions", ")", "Handler", "{", "if", "!", "path", ".", "IsAbs", "(", "directory", ")", "{", "directory", "=", "path", ".", "Join", "(", "Root", ",", "directory", ")", "\n", "}", "\n", "dir", ":=", "http", ".", "Dir", "(", "directory", ")", "\n", "opt", ":=", "prepareStaticOptions", "(", "staticOpt", ")", "\n\n", "return", "func", "(", "res", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "log", "*", "log", ".", "Logger", ")", "{", "if", "req", ".", "Method", "!=", "\"", "\"", "&&", "req", ".", "Method", "!=", "\"", "\"", "{", "return", "\n", "}", "\n", "file", ":=", "req", ".", "URL", ".", "Path", "\n", "// if we have a prefix, filter requests by stripping the prefix", "if", "opt", ".", "Prefix", "!=", "\"", "\"", "{", "if", "!", "strings", ".", "HasPrefix", "(", "file", ",", "opt", ".", "Prefix", ")", "{", "return", "\n", "}", "\n", "file", "=", "file", "[", "len", "(", "opt", ".", "Prefix", ")", ":", "]", "\n", "if", "file", "!=", "\"", "\"", "&&", "file", "[", "0", "]", "!=", "'/'", "{", "return", "\n", "}", "\n", "}", "\n", "f", ",", "err", ":=", "dir", ".", "Open", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "// discard the error?", "return", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "fi", ",", "err", ":=", "f", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// try to serve index file", "if", "fi", ".", "IsDir", "(", ")", "{", "// redirect if missing trailing slash", "if", "!", "strings", ".", "HasSuffix", "(", "req", ".", "URL", ".", "Path", ",", "\"", "\"", ")", "{", "http", ".", "Redirect", "(", "res", ",", "req", ",", "req", ".", "URL", ".", "Path", "+", "\"", "\"", ",", "http", ".", "StatusFound", ")", "\n", "return", "\n", "}", "\n\n", "file", "=", "path", ".", "Join", "(", "file", ",", "opt", ".", "IndexFile", ")", "\n", "f", ",", "err", "=", "dir", ".", "Open", "(", "file", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "fi", ",", "err", "=", "f", ".", "Stat", "(", ")", "\n", "if", "err", "!=", "nil", "||", "fi", ".", "IsDir", "(", ")", "{", "return", "\n", "}", "\n", "}", "\n\n", "if", "!", "opt", ".", "SkipLogging", "{", "log", ".", "Println", "(", "\"", "\"", "+", "<mask>", ")", "\n", "}", "\n\n", "// Add an Expires header to the static content", "if", "opt", ".", "Expires", "!=", "nil", "{", "res", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "opt", ".", "Expires", "(", ")", ")", "\n", "}", "\n\n", "http", ".", "ServeContent", "(", "res", ",", "req", ",", "file", ",", "fi", ".", "ModTime", "(", ")", ",", "f", ")", "\n", "}", "\n", "}" ]
18,466
all-18467
[ "void", "pango_layout_set_width", "(", "PangoLayout", "*", "layout", "int", "width", ")", ";" ]
[ "func", "(", "v", "*", "Layout", ")", "SetWidth", "(", "<mask>", "int", ")", "{", "C", ".", "pango_layout_set_width", "(", "v", ".", "native", "(", ")", ",", "C", ".", "int", "(", "width", ")", ")", "\n", "}" ]
18,467
all-18468
[ "StreamContext", "provides", "the", "same", "functionality", "as", "Stream", "with", "Context", "instance", "passing", "to", "http", ".", "Request", "." ]
[ "func", "(", "c", "Client", ")", "StreamContext", "(", "ctx", "context", ".", "Context", ",", "method", ",", "path", "string", ",", "query", "url", ".", "Values", ",", "body", "io", ".", "Reader", ",", "accept", "[", "]", "string", ")", "(", "data", "io", ".", "ReadCloser", ",", "contentType", "string", ",", "err", "error", ")", "{", "resp", ",", "err", ":=", "c", ".", "RequestContext", "(", "ctx", ",", "method", ",", "<mask>", ",", "query", ",", "body", ",", "accept", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "contentType", "=", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "data", "=", "resp", ".", "Body", "\n", "return", "\n", "}" ]
18,468
all-18469
[ "WithdrawNotification", "is", "a", "wrapper", "around", "g_application_withdraw_notification", "()", "." ]
[ "func", "(", "v", "*", "Application", ")", "WithdrawNotification", "(", "id", "string", ")", "{", "cstr1", ":=", "(", "*", "C", ".", "gchar", ")", "(", "C", ".", "CString", "(", "id", ")", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr1", ")", ")", "\n\n", "C", ".", "g_application_withdraw_notification", "(", "v", ".", "native", "(", ")", ",", "cstr1", ")", "\n", "}" ]
18,469
all-18470
[ "Setup", "MAAS" ]
[ "func", "(", "d", "*", "Daemon", ")", "setupMAASController", "(", "server", "string", ",", "key", "string", ",", "machine", "string", ")", "error", "{", "var", "err", "error", "\n", "d", ".", "maas", "=", "nil", "\n\n", "// Default the machine name to the hostname", "if", "machine", "==", "\"", "\"", "{", "machine", ",", "err", "=", "os", ".", "Hostname", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "// We need both URL and key, otherwise disable MAAS", "if", "server", "==", "\"", "\"", "||", "key", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "// Get a new controller struct", "controller", ",", "err", ":=", "maas", ".", "NewController", "(", "server", ",", "<mask>", ",", "machine", ")", "\n", "if", "err", "!=", "nil", "{", "d", ".", "maas", "=", "nil", "\n", "return", "err", "\n", "}", "\n\n", "d", ".", "maas", "=", "controller", "\n", "return", "nil", "\n", "}" ]
18,470
all-18471
[ "ArmForSwitch", "returns", "which", "field", "name", "should", "be", "used", "for", "storing", "the", "value", "for", "an", "instance", "of", "InflationResult" ]
[ "func", "(", "u", "InflationResult", ")", "ArmForSwitch", "(", "sw", "int32", ")", "(", "string", ",", "bool", ")", "{", "switch", "InflationResultCode", "(", "sw", ")", "{", "case", "InflationResultCodeInflationSuccess", ":", "return", "\"", "\"", ",", "true", "\n", "<mask>", ":", "return", "\"", "\"", ",", "true", "\n", "}", "\n", "}" ]
18,471
all-18472
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StopCastingParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,472
all-18473
[ "IncidentLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "IncidentLocator", "(", "href", "string", ")", "*", "IncidentLocator", "{", "<mask>", "&", "IncidentLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
18,473
all-18474
[ "Output", "calls", "UI", ".", "Output", "to", "write", ".", "OutputPrefix", "is", "used", "to", "prefix", "the", "message", "." ]
[ "func", "(", "ui", "*", "PrefixUI", ")", "Output", "(", "message", "string", ")", "{", "if", "ui", ".", "OutputPrefix", "==", "\"", "\"", "{", "//Lets keep the space if they want one", "message", "=", "ui", ".", "OutputPrefix", "+", "<mask>", "\n", "}", "else", "if", "ui", ".", "OutputPrefix", "!=", "\"", "\"", "{", "message", "=", "ui", ".", "OutputPrefix", "+", "\"", "\"", "+", "message", "\n", "}", "\n", "ui", ".", "UI", ".", "Output", "(", "message", ")", "\n", "}" ]
18,474
all-18475
[ "GetIncludeZeroOk", "returns", "a", "tuple", "with", "the", "IncludeZero", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "y", "*", "Yaxis", ")", "GetIncludeZeroOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "y", "==", "nil", "||", "y", ".", "IncludeZero", "==", "nil", "{", "return", "false", ",", "false", "\n", "}", "\n", "return", "*", "y", ".", "IncludeZero", ",", "<mask>", "\n", "}" ]
18,475
all-18476
[ "This", "function", "should", "be", "used", "to", "register", "concrete", "types", "that", "will", "appear", "in", "interface", "fields", "/", "elements", "to", "be", "encoded", "/", "decoded", "by", "go", "-", "amino", ".", "Usage", ":", "amino", ".", "RegisterConcrete", "(", "MyStruct1", "{}", "com", ".", "tendermint", "/", "MyStruct1", "nil", ")" ]
[ "func", "(", "cdc", "*", "Codec", ")", "RegisterConcrete", "(", "o", "interface", "{", "}", ",", "name", "string", ",", "copts", "*", "ConcreteOptions", ")", "{", "cdc", ".", "assertNotSealed", "(", ")", "\n\n", "<mask>", "pointerPreferred", "bool", "\n\n", "// Get reflect.Type.", "rt", ":=", "reflect", ".", "TypeOf", "(", "o", ")", "\n", "if", "rt", ".", "Kind", "(", ")", "==", "reflect", ".", "Interface", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rt", ")", ")", "\n", "}", "\n", "if", "rt", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "rt", "=", "rt", ".", "Elem", "(", ")", "\n", "if", "rt", ".", "Kind", "(", ")", "==", "reflect", ".", "Ptr", "{", "// We can encode/decode pointer-pointers, but not register them.", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rt", ")", ")", "\n", "}", "\n", "if", "rt", ".", "Kind", "(", ")", "==", "reflect", ".", "Interface", "{", "// MARKER: No interface-pointers", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rt", ")", ")", "\n", "}", "\n", "pointerPreferred", "=", "true", "\n", "}", "\n\n", "// Construct ConcreteInfo.", "var", "info", "=", "cdc", ".", "newTypeInfoFromRegisteredConcreteType", "(", "rt", ",", "pointerPreferred", ",", "name", ",", "copts", ")", "\n\n", "// Finally, check conflicts and register.", "func", "(", ")", "{", "cdc", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "cdc", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "cdc", ".", "addCheckConflictsWithConcrete_nolock", "(", "info", ")", "\n", "cdc", ".", "setTypeInfo_nolock", "(", "info", ")", "\n", "}", "(", ")", "\n", "}" ]
18,476
all-18477
[ "This", "file", "contains", "helpers", "for", "working", "with", "xdr", ".", "Asset", "structs", "SetCredit", "overwrites", "a", "with", "a", "credit", "asset", "using", "code", "and", "issuer", ".", "The", "asset", "type", "(", "CreditAlphanum4", "or", "CreditAlphanum12", ")", "is", "chosen", "automatically", "based", "upon", "the", "length", "of", "code", "." ]
[ "func", "(", "a", "*", "Asset", ")", "SetCredit", "(", "code", "string", ",", "issuer", "AccountId", ")", "error", "{", "length", ":=", "len", "(", "code", ")", "\n", "var", "typ", "AssetType", "\n", "var", "body", "interface", "{", "}", "\n\n", "switch", "{", "case", "length", ">=", "1", "&&", "length", "<=", "4", ":", "newbody", ":=", "AssetAlphaNum4", "{", "Issuer", ":", "issuer", "}", "\n", "copy", "(", "newbody", ".", "AssetCode", "[", ":", "]", ",", "[", "]", "byte", "(", "code", ")", "[", ":", "length", "]", ")", "\n", "typ", "=", "AssetTypeAssetTypeCreditAlphanum4", "\n", "body", "=", "newbody", "\n", "<mask>", "length", ">=", "5", "&&", "length", "<=", "12", ":", "newbody", ":=", "AssetAlphaNum12", "{", "Issuer", ":", "issuer", "}", "\n", "copy", "(", "newbody", ".", "AssetCode", "[", ":", "]", ",", "[", "]", "byte", "(", "code", ")", "[", ":", "length", "]", ")", "\n", "typ", "=", "AssetTypeAssetTypeCreditAlphanum4", "\n", "body", "=", "newbody", "\n", "default", ":", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "newa", ",", "err", ":=", "NewAsset", "(", "typ", ",", "body", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "*", "a", "=", "newa", "\n", "return", "nil", "\n", "}" ]
18,477
all-18478
[ "Calculate", "the", "route", "to", "answer", "the", "question", ":", "if", "we", "receive", "a", "broadcast", "originally", "from", "Peer", "X", "which", "peers", "should", "we", "pass", "the", "frames", "on", "to?", "When", "the", "topology", "is", "stable", "and", "thus", "all", "peers", "perform", "route", "calculations", "based", "on", "the", "same", "data", "the", "algorithm", "ensures", "that", "broadcasts", "reach", "every", "peer", "exactly", "once", ".", "This", "is", "largely", "due", "to", "properties", "of", "the", "Peer", ".", "Routes", "algorithm", ".", "In", "particular", ":", "ForAll", "X", "Y", "Z", "in", "Peers", ".", "X", ".", "Routes", "(", "Y", ")", "<", "=", "X", ".", "Routes", "(", "Z", ")", "\\", "/", "X", ".", "Routes", "(", "Z", ")", "<", "=", "X", ".", "Routes", "(", "Y", ")", "ForAll", "X", "Y", "Z", "in", "Peers", ".", "Y", "=", "/", "=", "Z", "/", "\\", "X", ".", "Routes", "(", "Y", ")", "<", "=", "X", ".", "Routes", "(", "Z", ")", "=", ">", "X", ".", "Routes", "(", "Y", ")", "u", "[", "P", "|", "Y", ".", "HasSymmetricConnectionTo", "(", "P", ")", "]", "<", "=", "X", ".", "Routes", "(", "Z", ")", "where", "<", "=", "is", "the", "subset", "relationship", "on", "keys", "of", "the", "returned", "map", "." ]
[ "func", "(", "r", "*", "routes", ")", "calculateBroadcast", "(", "name", "PeerName", ",", "establishedAndSymmetric", "bool", ")", "[", "]", "PeerName", "{", "hops", ":=", "[", "]", "PeerName", "{", "}", "\n", "peer", ",", "found", ":=", "r", ".", "peers", ".", "byName", "[", "name", "]", "\n", "if", "!", "found", "{", "return", "hops", "\n", "}", "\n", "if", "found", ",", "reached", ":=", "peer", ".", "routes", "(", "r", ".", "ourself", ".", "Peer", ",", "establishedAndSymmetric", ")", ";", "<mask>", "{", "r", ".", "ourself", ".", "forEachConnectedPeer", "(", "establishedAndSymmetric", ",", "reached", ",", "func", "(", "remotePeer", "*", "Peer", ")", "{", "hops", "=", "append", "(", "hops", ",", "remotePeer", ".", "Name", ")", "}", ")", "\n", "}", "\n", "return", "hops", "\n", "}" ]
18,478
all-18479
[ "NetworkInterfaceSubresourceSchema", "returns", "the", "schema", "for", "the", "disk", "sub", "-", "resource", "." ]
[ "func", "NetworkInterfaceSubresourceSchema", "(", ")", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "s", ":=", "map", "[", "string", "]", "*", "schema", ".", "Schema", "{", "// VirtualEthernetCardResourceAllocation", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Default", ":", "-", "1", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "-", "1", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Default", ":", "0", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "0", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Default", ":", "string", "(", "types", ".", "SharesLevelNormal", ")", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "sharesLevelAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "<mask>", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "0", ")", ",", "}", ",", "// VirtualEthernetCard and friends", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Required", ":", "true", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "NoZeroValues", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Default", ":", "networkInterfaceSubresourceTypeVmxnet3", ",", "Description", ":", "\"", "\"", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "networkInterfaceSubresourceTypeAllowedValues", ",", "false", ")", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeBool", ",", "Optional", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "\"", "\"", ":", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "Description", ":", "\"", "\"", ",", "}", ",", "}", "\n", "structure", ".", "MergeSchema", "(", "s", ",", "subresourceSchema", "(", ")", ")", "\n", "return", "s", "\n", "}" ]
18,479
all-18480
[ "GetSecret", "implements", "the", "GetSecret", "method", "of", "the", "SecretProvider", "interface", "." ]
[ "func", "(", "j", "*", "JWKClient", ")", "GetSecret", "(", "r", "*", "http", ".", "<mask>", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "token", ",", "err", ":=", "j", ".", "extractor", ".", "Extract", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "len", "(", "token", ".", "Headers", ")", "<", "1", "{", "return", "nil", ",", "ErrNoJWTHeaders", "\n", "}", "\n\n", "header", ":=", "token", ".", "Headers", "[", "0", "]", "\n\n", "return", "j", ".", "GetKey", "(", "header", ".", "KeyID", ")", "\n", "}" ]
18,480
all-18481
[ "ExpandRow", "is", "a", "wrapper", "around", "gtk_tree_view_expand_row", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "ExpandRow", "(", "<mask>", "*", "TreePath", ",", "openAll", "bool", ")", "bool", "{", "return", "gobool", "(", "C", ".", "gtk_tree_view_expand_row", "(", "v", ".", "native", "(", ")", ",", "path", ".", "native", "(", ")", ",", "gbool", "(", "openAll", ")", ")", ")", "\n", "}" ]
18,481
all-18482
[ "Shutdown", "raft", "and", "any", "raft", "-", "related", "resource", "we", "have", "instantiated", "." ]
[ "func", "(", "i", "*", "raftInstance", ")", "Shutdown", "(", ")", "error", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n\n", "// Invoke raft APIs asynchronously to allow for a timeout.", "timeout", ":=", "10", "*", "<mask>", ".", "Second", "\n\n", "errCh", ":=", "make", "(", "chan", "error", ")", "\n", "timer", ":=", "time", ".", "After", "(", "timeout", ")", "\n", "go", "func", "(", ")", "{", "errCh", "<-", "i", ".", "raft", ".", "Shutdown", "(", ")", ".", "Error", "(", ")", "\n", "}", "(", ")", "\n", "select", "{", "case", "err", ":=", "<-", "errCh", ":", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "case", "<-", "timer", ":", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "timeout", ")", "\n\n", "}", "\n", "err", ":=", "i", ".", "logs", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,482
all-18483
[ "GetUrl", "returns", "the", "Url", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "GetUrl", "(", ")", "string", "{", "if", "c", "==", "nil", "||", "c", ".", "Url", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "Url", "\n", "}" ]
18,483
all-18484
[ "render", "multiple", "sets", "of", "primitives", "by", "specifying", "indices", "of", "array", "data", "elements", "and", "an", "index", "to", "apply", "to", "each", "index" ]
[ "func", "MultiDrawElementsBaseVertex", "(", "mode", "uint32", ",", "count", "*", "int32", ",", "xtype", "uint32", ",", "indices", "*", "unsafe", ".", "Pointer", ",", "drawcount", "int32", ",", "basevertex", "*", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpMultiDrawElementsBaseVertex", ",", "6", ",", "uintptr", "(", "mode", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ",", "uintptr", "(", "xtype", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "indices", ")", ")", ",", "uintptr", "(", "drawcount", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "basevertex", ")", ")", ")", "\n", "}" ]
18,484
all-18485
[ "ConfigUpdate", "updates", "the", "image", "s", "default", "configuration", "and", "adds", "annotations", "which", "will", "be", "visible", "in", "source", "images", "created", "using", "this", "reference", "." ]
[ "func", "(", "r", "*", "tarballReference", ")", "ConfigUpdate", "(", "config", "imgspecv1", ".", "Image", ",", "annotations", "map", "[", "string", "]", "string", ")", "error", "{", "r", ".", "config", "=", "config", "\n", "if", "r", ".", "annotations", "==", "nil", "{", "r", ".", "annotations", "=", "<mask>", "(", "map", "[", "string", "]", "string", ")", "\n", "}", "\n", "for", "k", ",", "v", ":=", "range", "annotations", "{", "r", ".", "annotations", "[", "k", "]", "=", "v", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,485
all-18486
[ "Versions", "returns", "the", "names", "of", "the", "versions", "that", "belong", "to", "the", "specified", "module", ".", "If", "module", "is", "the", "empty", "string", "it", "means", "the", "default", "module", "." ]
[ "func", "Versions", "(", "c", "context", ".", "Context", ",", "module", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "req", ":=", "&", "pb", ".", "GetVersionsRequest", "{", "}", "\n", "if", "module", "!=", "\"", "\"", "{", "req", ".", "Module", "=", "&", "module", "\n", "}", "\n", "res", ":=", "&", "<mask>", ".", "GetVersionsResponse", "{", "}", "\n", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", "\n", "return", "res", ".", "GetVersion", "(", ")", ",", "err", "\n", "}" ]
18,486
all-18487
[ "MustInit", "blocks", "and", "retries", "until", "an", "engine", "can", "be", "initialized", "." ]
[ "func", "(", "engine", "*", "DockerTaskEngine", ")", "MustInit", "(", "ctx", "context", ".", "Context", ")", "{", "if", "engine", ".", "initialized", "{", "return", "\n", "}", "\n", "engine", ".", "mustInitLock", ".", "Lock", "(", ")", "\n", "defer", "engine", ".", "mustInitLock", ".", "Unlock", "(", ")", "\n\n", "errorOnce", ":=", "sync", ".", "Once", "{", "}", "\n", "taskEngineConnectBackoff", ":=", "retry", ".", "NewExponentialBackoff", "(", "minEngineConnectRetryDelay", ",", "maxEngineConnectRetryDelay", ",", "engineConnectRetryJitterMultiplier", ",", "engineConnectRetryDelayMultiplier", ")", "\n", "retry", ".", "RetryWithBackoff", "(", "taskEngineConnectBackoff", ",", "func", "(", ")", "error", "{", "if", "<mask>", ".", "initialized", "{", "return", "nil", "\n", "}", "\n", "err", ":=", "engine", ".", "Init", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "errorOnce", ".", "Do", "(", "func", "(", ")", "{", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", ")", "\n", "}", "\n", "return", "err", "\n", "}", ")", "\n", "}" ]
18,487
all-18488
[ "TODO", "(", "jrick", ")", "SetMimeData", "(", "depends", "on", "DestroyFunc", ")", "GetMimeData", "is", "a", "wrapper", "around", "cairo_surface_get_mime_data", "()", ".", "The", "returned", "mimetype", "data", "is", "returned", "as", "a", "Go", "byte", "slice", "." ]
[ "func", "(", "v", "*", "Surface", ")", "GetMimeData", "(", "mimeType", "MimeType", ")", "[", "]", "byte", "{", "cstr", ":=", "C", ".", "CString", "(", "string", "(", "mimeType", ")", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "<mask>", "data", "*", "C", ".", "uchar", "\n", "var", "length", "C", ".", "ulong", "\n", "C", ".", "cairo_surface_get_mime_data", "(", "v", ".", "native", "(", ")", ",", "cstr", ",", "&", "data", ",", "&", "length", ")", "\n", "return", "C", ".", "GoBytes", "(", "unsafe", ".", "Pointer", "(", "data", ")", ",", "C", ".", "int", "(", "length", ")", ")", "\n", "}" ]
18,488
all-18489
[ "mkV2Node", "creates", "a", "V2", "NodeExtern", "from", "a", "V3", "KeyValue" ]
[ "func", "(", "s", "*", "v2v3Store", ")", "mkV2Node", "(", "kv", "*", "mvccpb", ".", "KeyValue", ")", "*", "v2store", ".", "NodeExtern", "{", "if", "kv", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "n", ":=", "&", "v2store", ".", "NodeExtern", "{", "Key", ":", "s", ".", "mkNodePath", "(", "string", "(", "kv", ".", "Key", ")", ")", ",", "Dir", ":", "kv", ".", "Key", "[", "len", "(", "kv", ".", "Key", ")", "-", "1", "]", "==", "'/'", ",", "CreatedIndex", ":", "mkV2Rev", "(", "kv", ".", "CreateRevision", ")", ",", "ModifiedIndex", ":", "mkV2Rev", "(", "kv", ".", "ModRevision", ")", ",", "}", "\n", "if", "!", "n", ".", "Dir", "{", "v", ":=", "string", "(", "kv", ".", "<mask>", ")", "\n", "n", ".", "Value", "=", "&", "v", "\n", "}", "\n", "return", "n", "\n", "}" ]
18,489
all-18490
[ "main", "handles", "rendering", "a", "gTLD", "map", "to", "either", "standard", "out", "(", "when", "no", "argument", "is", "provided", ")", "or", "to", "the", "provided", "filename", ".", "If", "an", "error", "occurs", "it", "is", "printed", "to", "standard", "err", "and", "the", "program", "terminates", "with", "a", "non", "-", "zero", "exit", "status", "." ]
[ "func", "main", "(", ")", "{", "errQuit", ":=", "func", "(", "err", "error", ")", "{", "fmt", ".", "Fprintf", "(", "os", ".", "Stderr", ",", "\"", "\\n", "\"", ",", "err", ")", "\n", "os", ".", "Exit", "(", "1", ")", "\n", "}", "\n\n", "// Default to writing to standard out", "writer", ":=", "os", ".", "Stdout", "\n", "if", "flag", ".", "NArg", "(", ")", ">", "0", "{", "// If a filename is specified as a command line flag then open it (creating", "// if needed), truncate the existing contents, and use the file as the", "// writer instead of standard out", "filename", ":=", "flag", ".", "Args", "(", ")", "[", "0", "]", "\n", "f", ",", "err", ":=", "<mask>", ".", "OpenFile", "(", "filename", ",", "os", ".", "O_CREATE", "|", "os", ".", "O_TRUNC", "|", "os", ".", "O_WRONLY", ",", "0664", ")", "\n", "if", "err", "!=", "nil", "{", "errQuit", "(", "err", ")", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n", "writer", "=", "f", "\n", "}", "\n\n", "if", "err", ":=", "renderGTLDMap", "(", "writer", ")", ";", "err", "!=", "nil", "{", "errQuit", "(", "err", ")", "\n", "}", "\n", "}" ]
18,490
all-18491
[ "isSafeRetry", "returns", "true", "if", "request", "is", "safe", "for", "retry", "with", "the", "given", "error", "." ]
[ "func", "isSafeRetry", "(", "lg", "*", "zap", ".", "Logger", ",", "err", "error", ",", "callOpts", "*", "<mask>", ")", "bool", "{", "if", "isContextError", "(", "err", ")", "{", "return", "false", "\n", "}", "\n", "switch", "callOpts", ".", "retryPolicy", "{", "case", "repeatable", ":", "return", "isSafeRetryImmutableRPC", "(", "err", ")", "\n", "case", "nonRepeatable", ":", "return", "isSafeRetryMutableRPC", "(", "err", ")", "\n", "default", ":", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "callOpts", ".", "retryPolicy", ".", "String", "(", ")", ")", ")", "\n", "return", "false", "\n", "}", "\n", "}" ]
18,491
all-18492
[ "AfterAccountAddBalance", "updates", "psc", "and", "ptc", "balance", "of", "an", "account", "." ]
[ "func", "(", "w", "*", "Worker", ")", "AfterAccountAddBalance", "(", "job", "*", "data", ".", "<mask>", ")", "error", "{", "return", "w", ".", "updateAccountBalancesJob", "(", "job", ",", "data", ".", "JobAfterAccountAddBalance", ")", "\n", "}" ]
18,492
all-18493
[ "Get", "is", "used", "to", "lookup", "a", "specific", "key", "returning", "the", "value", "and", "if", "it", "was", "found" ]
[ "func", "(", "t", "*", "Tree", ")", "Get", "(", "s", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "n", ":=", "t", ".", "root", "\n", "search", ":=", "s", "\n", "for", "{", "// Check for key exhaution", "if", "len", "(", "search", ")", "==", "0", "{", "if", "n", ".", "isLeaf", "(", ")", "{", "return", "n", ".", "leaf", ".", "val", ",", "true", "\n", "}", "\n", "break", "\n", "}", "\n\n", "// Look for an edge", "n", "=", "n", ".", "getEdge", "(", "search", "[", "0", "]", ")", "\n", "if", "n", "==", "nil", "{", "<mask>", "\n", "}", "\n\n", "// Consume the search prefix", "if", "strings", ".", "HasPrefix", "(", "search", ",", "n", ".", "prefix", ")", "{", "search", "=", "search", "[", "len", "(", "n", ".", "prefix", ")", ":", "]", "\n", "}", "else", "{", "break", "\n", "}", "\n", "}", "\n", "return", "nil", ",", "false", "\n", "}" ]
18,493
all-18494
[ "GetServerResources", "returns", "the", "resources", "available", "to", "a", "given", "LXD", "server" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetServerResources", "(", ")", "(", "*", "api", ".", "Resources", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "resources", ":=", "api", ".", "Resources", "{", "}", "\n\n", "// Fetch the raw value", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "\"", "\"", ",", "&", "resources", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "<mask>", ",", "nil", "\n", "}" ]
18,494
all-18495
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StartRuleUsageTrackingParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,495
all-18496
[ "heartbeat", "is", "used", "to", "periodically", "invoke", "AppendEntries", "on", "a", "peer", "to", "ensure", "they", "don", "t", "time", "out", ".", "This", "is", "done", "async", "of", "replicate", "()", "since", "that", "routine", "could", "potentially", "be", "blocked", "on", "disk", "IO", "." ]
[ "func", "(", "r", "*", "Raft", ")", "heartbeat", "(", "s", "*", "followerReplication", ",", "stopCh", "chan", "struct", "{", "}", ")", "{", "var", "failures", "uint64", "\n", "req", ":=", "AppendEntriesRequest", "{", "RPCHeader", ":", "r", ".", "getRPCHeader", "(", ")", ",", "Term", ":", "s", ".", "currentTerm", ",", "Leader", ":", "r", ".", "trans", ".", "EncodePeer", "(", "r", ".", "localID", ",", "r", ".", "localAddr", ")", ",", "}", "\n", "var", "resp", "AppendEntriesResponse", "\n", "for", "{", "// Wait for the next heartbeat interval or forced notify", "select", "{", "case", "<-", "s", ".", "notifyCh", ":", "case", "<-", "randomTimeout", "(", "r", ".", "conf", ".", "HeartbeatTimeout", "/", "10", ")", ":", "case", "<-", "stopCh", ":", "return", "\n", "}", "\n\n", "start", ":=", "time", ".", "Now", "(", ")", "\n", "if", "err", ":=", "r", ".", "trans", ".", "AppendEntries", "(", "s", ".", "peer", ".", "ID", ",", "s", ".", "peer", ".", "Address", ",", "&", "req", ",", "&", "resp", ")", ";", "err", "!=", "nil", "{", "r", ".", "logger", ".", "Error", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "s", ".", "peer", ".", "Address", ",", "err", ")", ")", "\n", "failures", "++", "\n", "select", "{", "case", "<-", "<mask>", ".", "After", "(", "backoff", "(", "failureWait", ",", "failures", ",", "maxFailureScale", ")", ")", ":", "case", "<-", "stopCh", ":", "}", "\n", "}", "else", "{", "s", ".", "setLastContact", "(", ")", "\n", "failures", "=", "0", "\n", "metrics", ".", "MeasureSince", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "string", "(", "s", ".", "peer", ".", "ID", ")", "}", ",", "start", ")", "\n", "s", ".", "notifyAll", "(", "resp", ".", "Success", ")", "\n", "}", "\n", "}", "\n", "}" ]
18,496
all-18497
[ "SendProtocolMsg", "implements", "ProtocolSender", "." ]
[ "func", "(", "<mask>", "*", "LocalConnection", ")", "SendProtocolMsg", "(", "m", "protocolMsg", ")", "error", "{", "if", "err", ":=", "conn", ".", "sendProtocolMsg", "(", "m", ")", ";", "err", "!=", "nil", "{", "conn", ".", "shutdown", "(", "err", ")", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,497
all-18498
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "cairo_surface_t", "." ]
[ "func", "(", "v", "*", "Surface", ")", "native", "(", ")", "*", "C", ".", "cairo_surface_t", "{", "if", "v", "==", "nil", "{", "<mask>", "nil", "\n", "}", "\n", "return", "v", ".", "surface", "\n", "}" ]
18,498
all-18499
[ "GetExecutionCredentialsID", "returns", "the", "execution", "role", "s", "credential", "ID" ]
[ "func", "(", "auth", "*", "ASMAuthResource", ")", "GetExecutionCredentialsID", "(", ")", "string", "{", "auth", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "auth", ".", "<mask>", ".", "RUnlock", "(", ")", "\n\n", "return", "auth", ".", "executionCredentialsID", "\n", "}" ]
18,499
all-18500
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventStyleSheetAdded", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss53", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]