id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
16,800
all-16801
[ "map", "all", "of", "a", "buffer", "object", "s", "data", "store", "into", "the", "client", "s", "address", "space" ]
[ "func", "MapNamedBuffer", "(", "buffer", "uint32", ",", "access", "uint32", ")", "unsafe", ".", "Pointer", "{", "<mask>", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpMapNamedBuffer", ",", "2", ",", "uintptr", "(", "buffer", ")", ",", "uintptr", "(", "access", ")", ",", "0", ")", "\n", "return", "(", "unsafe", ".", "Pointer", ")", "(", "ret", ")", "\n", "}" ]
16,801
all-16802
[ "Get", "returns", "the", "cached", "ByteCode" ]
[ "func", "(", "c", "MemoryCache", ")", "Get", "(", "key", "string", ")", "(", "*", "CacheEntity", ",", "error", ")", "{", "bc", ",", "<mask>", ":=", "c", "[", "key", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "bc", ",", "nil", "\n", "}" ]
16,802
all-16803
[ "ArchitectureGetLocal", "returns", "the", "local", "hardware", "architecture" ]
[ "func", "ArchitectureGetLocal", "(", ")", "(", "string", ",", "error", ")", "{", "uname", ",", "err", ":=", "<mask>", ".", "Uname", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "ArchitectureDefault", ",", "err", "\n", "}", "\n\n", "return", "uname", ".", "Machine", ",", "nil", "\n", "}" ]
16,803
all-16804
[ "HTTPClient", "provides", "an", "Option", "for", "specifying", "a", "*", "http", ".", "Client" ]
[ "func", "HTTPClient", "(", "<mask>", "*", "http", ".", "Client", ")", "Option", "{", "return", "func", "(", "c", "*", "config", ")", "{", "c", ".", "HTTPClient", "=", "client", "\n", "}", "\n", "}" ]
16,804
all-16805
[ "extractID", "extracts", "and", "returns", "an", "ID", "." ]
[ "func", "extractID", "(", "s", "string", ",", "ln", "*", "<mask>", ")", "(", "string", ",", "error", ")", "{", "tokens", ":=", "strings", ".", "Split", "(", "s", ",", "sharp", ")", "\n\n", "l", ":=", "len", "(", "tokens", ")", "\n\n", "if", "l", "<", "2", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "if", "l", ">", "2", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "ln", ".", "fileName", "(", ")", ",", "ln", ".", "no", ")", "\n", "}", "\n\n", "return", "strings", ".", "Split", "(", "tokens", "[", "1", "]", ",", "dot", ")", "[", "0", "]", ",", "nil", "\n", "}" ]
16,805
all-16806
[ "GetApmQuery", "returns", "the", "ApmQuery", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "h", "*", "HeatmapRequest", ")", "GetApmQuery", "(", ")", "WidgetApmOrLogQuery", "{", "if", "h", "==", "nil", "||", "h", ".", "ApmQuery", "==", "nil", "{", "return", "WidgetApmOrLogQuery", "{", "}", "\n", "}", "\n", "<mask>", "*", "h", ".", "ApmQuery", "\n", "}" ]
16,806
all-16807
[ "WithContext", "adds", "the", "context", "to", "the", "update", "Vm", "params" ]
[ "func", "(", "o", "*", "UpdateVMParams", ")", "WithContext", "(", "ctx", "<mask>", ".", "Context", ")", "*", "UpdateVMParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
16,807
all-16808
[ "ImageAliasGet", "returns", "the", "alias", "with", "the", "given", "name", "in", "the", "given", "project", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ImageAliasGet", "(", "project", ",", "name", "string", ",", "isTrustedClient", "bool", ")", "(", "int", ",", "api", ".", "ImageAliasesEntry", ",", "error", ")", "{", "id", ":=", "-", "1", "\n", "entry", ":=", "api", ".", "ImageAliasesEntry", "{", "}", "\n\n", "err", ":=", "c", ".", "Transaction", "(", "func", "(", "tx", "*", "ClusterTx", ")", "error", "{", "enabled", ",", "err", ":=", "tx", ".", "ProjectHasImages", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "enabled", "{", "project", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "id", ",", "entry", ",", "err", "\n", "}", "\n\n", "q", ":=", "`SELECT images_aliases.id, images.fingerprint, images_aliases.description\n\t\t\t FROM images_aliases\n\t\t\t INNER JOIN images\n\t\t\t ON images_aliases.image_id=images.id\n INNER JOIN projects\n ON images_aliases.project_id=projects.id\n\t\t\t WHERE projects.name=? AND images_aliases.name=?`", "\n", "if", "!", "isTrustedClient", "{", "q", "=", "q", "+", "` AND images.public=1`", "\n", "}", "\n\n", "var", "fingerprint", ",", "description", "string", "\n\n", "arg1", ":=", "[", "]", "interface", "{", "}", "{", "project", ",", "name", "}", "\n", "arg2", ":=", "[", "]", "interface", "{", "}", "{", "&", "id", ",", "&", "fingerprint", ",", "&", "description", "}", "\n", "err", "=", "dbQueryRowScan", "(", "c", ".", "db", ",", "q", ",", "arg1", ",", "arg2", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "-", "1", ",", "entry", ",", "ErrNoSuchObject", "\n", "}", "\n\n", "return", "-", "1", ",", "entry", ",", "err", "\n", "}", "\n\n", "entry", ".", "Name", "=", "name", "\n", "entry", ".", "Target", "=", "fingerprint", "\n", "entry", ".", "Description", "=", "description", "\n\n", "return", "id", ",", "entry", ",", "nil", "\n", "}" ]
16,808
all-16809
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "VersionStatus", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "out", ".", "<mask>", "(", "string", "(", "t", ")", ")", "\n", "}" ]
16,809
all-16810
[ "void", "pango_font_description_set_variant", "(", "PangoFontDescription", "*", "desc", "PangoVariant", "variant", ")", ";", "PangoVariant", "pango_font_description_get_variant", "(", "const", "PangoFontDescription", "*", "desc", ")", "G_GNUC_PURE", ";", "void", "pango_font_description_set_weight", "(", "PangoFontDescription", "*", "desc", "PangoWeight", "weight", ")", ";" ]
[ "func", "(", "v", "*", "FontDescription", ")", "SetWeight", "(", "<mask>", "Weight", ")", "{", "C", ".", "pango_font_description_set_weight", "(", "v", ".", "native", "(", ")", ",", "(", "C", ".", "PangoWeight", ")", "(", "weight", ")", ")", "\n", "}" ]
16,810
all-16811
[ "DevicesAdd", "adds", "a", "new", "device", "." ]
[ "func", "DevicesAdd", "(", "<mask>", "*", "sql", ".", "Tx", ",", "w", "string", ",", "cID", "int64", ",", "devices", "types", ".", "Devices", ")", "error", "{", "// Prepare the devices entry SQL", "str1", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "w", ",", "w", ")", "\n", "stmt1", ",", "err", ":=", "tx", ".", "Prepare", "(", "str1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "stmt1", ".", "Close", "(", ")", "\n\n", "// Prepare the devices config entry SQL", "str2", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "w", ",", "w", ")", "\n", "stmt2", ",", "err", ":=", "tx", ".", "Prepare", "(", "str2", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "stmt2", ".", "Close", "(", ")", "\n\n", "// Insert all the devices", "for", "k", ",", "v", ":=", "range", "devices", "{", "t", ",", "err", ":=", "dbDeviceTypeToInt", "(", "v", "[", "\"", "\"", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "result", ",", "err", ":=", "stmt1", ".", "Exec", "(", "cID", ",", "k", ",", "t", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "id64", ",", "err", ":=", "result", ".", "LastInsertId", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "k", ")", "\n", "}", "\n", "id", ":=", "int", "(", "id64", ")", "\n\n", "for", "ck", ",", "cv", ":=", "range", "v", "{", "// The type is stored as int in the parent entry", "if", "ck", "==", "\"", "\"", "||", "cv", "==", "\"", "\"", "{", "continue", "\n", "}", "\n\n", "_", ",", "err", "=", "stmt2", ".", "Exec", "(", "id", ",", "ck", ",", "cv", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
16,811
all-16812
[ "Calculates", "the", "per", "-", "element", "difference", "between", "two", "arrays", "with", "a", "mask", ".", "dst", "=", "src1", "-", "src2" ]
[ "func", "SubtractWithMask", "(", "src1", ",", "src2", ",", "dst", ",", "mask", "*", "IplImage", ")", "{", "C", ".", "cvSub", "(", "unsafe", ".", "Pointer", "(", "src1", ")", ",", "unsafe", ".", "Pointer", "(", "src2", ")", ",", "unsafe", ".", "Pointer", "(", "dst", ")", ",", "unsafe", ".", "Pointer", "(", "<mask>", ")", ",", ")", "\n", "}" ]
16,812
all-16813
[ "NewManager", "is", "the", "manager", "constructor", "." ]
[ "func", "NewManager", "(", "o", "*", "Options", ",", "logger", "log", ".", "Logger", ")", "*", "Manager", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "context", ".", "Background", "(", ")", ")", "\n\n", "if", "o", ".", "Do", "==", "nil", "{", "o", ".", "Do", "=", "do", "\n", "}", "\n", "if", "logger", "==", "nil", "{", "logger", "=", "<mask>", ".", "NewNopLogger", "(", ")", "\n", "}", "\n\n", "n", ":=", "&", "Manager", "{", "queue", ":", "make", "(", "[", "]", "*", "Alert", ",", "0", ",", "o", ".", "QueueCapacity", ")", ",", "ctx", ":", "ctx", ",", "cancel", ":", "cancel", ",", "more", ":", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "opts", ":", "o", ",", "logger", ":", "logger", ",", "}", "\n\n", "queueLenFunc", ":=", "func", "(", ")", "float64", "{", "return", "float64", "(", "n", ".", "queueLen", "(", ")", ")", "}", "\n", "alertmanagersDiscoveredFunc", ":=", "func", "(", ")", "float64", "{", "return", "float64", "(", "len", "(", "n", ".", "Alertmanagers", "(", ")", ")", ")", "}", "\n\n", "n", ".", "metrics", "=", "newAlertMetrics", "(", "o", ".", "Registerer", ",", "o", ".", "QueueCapacity", ",", "queueLenFunc", ",", "alertmanagersDiscoveredFunc", ",", ")", "\n\n", "return", "n", "\n", "}" ]
16,813
all-16814
[ "genQueryOptions", "generates", "standard", "query", "options", "." ]
[ "func", "genQueryOptions", "(", "q", "<mask>", ".", "Values", ")", "string", "{", "if", "s", ":=", "q", ".", "Encode", "(", ")", ";", "s", "!=", "\"", "\"", "{", "return", "\"", "\"", "+", "s", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
16,814
all-16815
[ "LoadFromDisk", "restores", "Nitro", "from", "a", "disk", "backup" ]
[ "func", "(", "m", "*", "Nitro", ")", "LoadFromDisk", "(", "dir", "string", ",", "concurr", "int", ",", "callb", "ItemCallback", ")", "(", "*", "Snapshot", ",", "error", ")", "{", "var", "wg", "sync", ".", "WaitGroup", "\n", "var", "files", "[", "]", "string", "\n", "var", "bs", "[", "]", "byte", "\n", "var", "err", "error", "\n", "datadir", ":=", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", "\n\n", "if", "bs", ",", "err", "=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "datadir", ",", "\"", "\"", ")", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "json", ".", "Unmarshal", "(", "bs", ",", "&", "files", ")", "\n\n", "var", "nodeCallb", "skiplist", ".", "NodeCallback", "\n", "wchan", ":=", "make", "(", "chan", "int", ")", "\n", "b", ":=", "skiplist", ".", "NewBuilderWithConfig", "(", "m", ".", "newStoreConfig", "(", ")", ")", "\n", "b", ".", "SetItemSizeFunc", "(", "ItemSize", ")", "\n", "segments", ":=", "make", "(", "[", "]", "*", "skiplist", ".", "Segment", ",", "len", "(", "files", ")", ")", "\n", "readers", ":=", "make", "(", "[", "]", "FileReader", ",", "len", "(", "files", ")", ")", "\n", "errors", ":=", "make", "(", "[", "]", "error", ",", "len", "(", "files", ")", ")", "\n\n", "if", "callb", "!=", "nil", "{", "nodeCallb", "=", "func", "(", "n", "*", "skiplist", ".", "Node", ")", "{", "callb", "(", "&", "ItemEntry", "{", "itm", ":", "(", "*", "Item", ")", "(", "n", ".", "Item", "(", ")", ")", ",", "n", ":", "n", "}", ")", "\n", "}", "\n", "}", "\n\n", "defer", "func", "(", ")", "{", "for", "_", ",", "r", ":=", "range", "readers", "{", "if", "r", "!=", "nil", "{", "r", ".", "Close", "(", ")", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "for", "i", ",", "file", ":=", "range", "files", "{", "segments", "[", "i", "]", "=", "b", ".", "NewSegment", "(", ")", "\n", "segments", "[", "i", "]", ".", "SetNodeCallback", "(", "nodeCallb", ")", "\n", "r", ":=", "m", ".", "newFileReader", "(", "m", ".", "fileType", ")", "\n", "datafile", ":=", "filepath", ".", "Join", "(", "datadir", ",", "file", ")", "\n", "if", "err", ":=", "r", ".", "Open", "(", "datafile", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "readers", "[", "i", "]", "=", "r", "\n", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "concurr", ";", "i", "++", "{", "wg", ".", "Add", "(", "1", ")", "\n", "<mask>", "func", "(", "wg", "*", "sync", ".", "WaitGroup", ")", "{", "defer", "wg", ".", "Done", "(", ")", "\n\n", "for", "shard", ":=", "range", "wchan", "{", "r", ":=", "readers", "[", "shard", "]", "\n", "loop", ":", "for", "{", "itm", ",", "err", ":=", "r", ".", "ReadItem", "(", ")", "\n", "if", "err", "!=", "nil", "{", "errors", "[", "shard", "]", "=", "err", "\n", "return", "\n", "}", "\n\n", "if", "itm", "==", "nil", "{", "break", "loop", "\n", "}", "\n", "segments", "[", "shard", "]", ".", "Add", "(", "unsafe", ".", "Pointer", "(", "itm", ")", ")", "\n", "}", "\n", "}", "\n", "}", "(", "&", "wg", ")", "\n", "}", "\n\n", "for", "i", ":=", "range", "files", "{", "wchan", "<-", "i", "\n", "}", "\n", "close", "(", "wchan", ")", "\n", "wg", ".", "Wait", "(", ")", "\n\n", "for", "_", ",", "err", ":=", "range", "errors", "{", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "m", ".", "store", "=", "b", ".", "Assemble", "(", "segments", "...", ")", "\n\n", "// Delta processing", "if", "m", ".", "useDeltaFiles", "{", "m", ".", "DeltaRestoreFailed", "=", "0", "\n", "m", ".", "DeltaRestored", "=", "0", "\n\n", "wchan", ":=", "make", "(", "chan", "int", ")", "\n", "deltadir", ":=", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", "\n", "var", "files", "[", "]", "string", "\n", "if", "bs", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "deltadir", ",", "\"", "\"", ")", ")", ";", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "bs", ",", "&", "files", ")", "\n", "}", "\n\n", "readers", ":=", "make", "(", "[", "]", "FileReader", ",", "len", "(", "files", ")", ")", "\n", "errors", ":=", "make", "(", "[", "]", "error", ",", "len", "(", "files", ")", ")", "\n", "writers", ":=", "make", "(", "[", "]", "*", "Writer", ",", "concurr", ")", "\n\n", "defer", "func", "(", ")", "{", "for", "_", ",", "r", ":=", "range", "readers", "{", "if", "r", "!=", "nil", "{", "r", ".", "Close", "(", ")", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "for", "i", ",", "file", ":=", "range", "files", "{", "r", ":=", "m", ".", "newFileReader", "(", "m", ".", "fileType", ")", "\n", "deltafile", ":=", "filepath", ".", "Join", "(", "deltadir", ",", "file", ")", "\n", "if", "err", ":=", "r", ".", "Open", "(", "deltafile", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "readers", "[", "i", "]", "=", "r", "\n", "}", "\n\n", "for", "i", ":=", "0", ";", "i", "<", "concurr", ";", "i", "++", "{", "writers", "[", "i", "]", "=", "m", ".", "newWriter", "(", ")", "\n", "wg", ".", "Add", "(", "1", ")", "\n", "go", "func", "(", "wg", "*", "sync", ".", "WaitGroup", ",", "id", "int", ")", "{", "defer", "wg", ".", "Done", "(", ")", "\n\n", "for", "shard", ":=", "range", "wchan", "{", "r", ":=", "readers", "[", "shard", "]", "\n", "loop", ":", "for", "{", "itm", ",", "err", ":=", "r", ".", "ReadItem", "(", ")", "\n", "if", "err", "!=", "nil", "{", "errors", "[", "shard", "]", "=", "err", "\n", "return", "\n", "}", "\n\n", "if", "itm", "==", "nil", "{", "break", "loop", "\n", "}", "\n\n", "w", ":=", "writers", "[", "id", "]", "\n", "if", "n", ",", "success", ":=", "w", ".", "store", ".", "Insert2", "(", "unsafe", ".", "Pointer", "(", "itm", ")", ",", "w", ".", "insCmp", ",", "w", ".", "existCmp", ",", "w", ".", "buf", ",", "w", ".", "rand", ".", "Float32", ",", "&", "w", ".", "slSts1", ")", ";", "success", "{", "w", ".", "resSts", ".", "DeltaRestored", "++", "\n", "if", "nodeCallb", "!=", "nil", "{", "nodeCallb", "(", "n", ")", "\n", "}", "\n", "}", "else", "{", "w", ".", "freeItem", "(", "itm", ")", "\n", "w", ".", "resSts", ".", "DeltaRestoreFailed", "++", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Aggregate stats", "w", ":=", "writers", "[", "id", "]", "\n", "m", ".", "store", ".", "Stats", ".", "Merge", "(", "&", "w", ".", "slSts1", ")", "\n", "atomic", ".", "AddUint64", "(", "&", "m", ".", "restoreStats", ".", "DeltaRestored", ",", "w", ".", "resSts", ".", "DeltaRestored", ")", "\n", "atomic", ".", "AddUint64", "(", "&", "m", ".", "restoreStats", ".", "DeltaRestoreFailed", ",", "w", ".", "resSts", ".", "DeltaRestoreFailed", ")", "\n", "}", "(", "&", "wg", ",", "i", ")", "\n", "}", "\n\n", "for", "i", ":=", "range", "files", "{", "wchan", "<-", "i", "\n", "}", "\n", "close", "(", "wchan", ")", "\n", "wg", ".", "Wait", "(", ")", "\n\n", "for", "_", ",", "err", ":=", "range", "errors", "{", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "}", "\n\n", "stats", ":=", "m", ".", "store", ".", "GetStats", "(", ")", "\n", "m", ".", "itemsCount", "=", "int64", "(", "stats", ".", "NodeCount", ")", "\n", "return", "m", ".", "NewSnapshot", "(", ")", "\n", "}" ]
16,815
all-16816
[ "HasTime", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ChangeDefinition", ")", "HasTime", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "Time", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
16,816
all-16817
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "SyntheticsTest", ")", "GetType", "(", ")", "string", "{", "if", "s", "==", "nil", "||", "s", ".", "Type", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "<mask>", "\n", "}" ]
16,817
all-16818
[ "newComment", "creates", "and", "returns", "a", "comment", "." ]
[ "func", "newComment", "(", "ln", "*", "<mask>", ",", "rslt", "*", "result", ",", "src", "*", "source", ",", "parent", "element", ",", "opts", "*", "Options", ")", "*", "comment", "{", "return", "&", "comment", "{", "elementBase", ":", "newElementBase", "(", "ln", ",", "rslt", ",", "src", ",", "parent", ",", "opts", ")", ",", "}", "\n", "}" ]
16,818
all-16819
[ "NewDynProvider", "initializes", "a", "new", "Dyn", "Provider", "." ]
[ "func", "NewDynProvider", "(", "config", "DynConfig", ")", "(", "Provider", ",", "error", ")", "{", "return", "&", "dynProviderState", "{", "DynConfig", ":", "config", ",", "ZoneSnapshot", ":", "&", "ZoneSnapshot", "{", "endpoints", ":", "<mask>", "[", "string", "]", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "}", ",", "serials", ":", "map", "[", "string", "]", "int", "{", "}", ",", "}", ",", "}", ",", "nil", "\n", "}" ]
16,819
all-16820
[ "UnmarshalJSON", "unmarshals", "CgroupResource", "object", "using", "duplicate", "struct", "CgroupResourceJSON" ]
[ "func", "(", "cgroup", "*", "CgroupResource", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "temp", ":=", "cgroupResourceJSON", "{", "}", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "&", "temp", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "cgroup", ".", "cgroupRoot", "=", "temp", ".", "CgroupRoot", "\n", "cgroup", ".", "cgroupMountPath", "=", "temp", ".", "CgroupMountPath", "\n", "cgroup", ".", "resourceSpec", "=", "temp", ".", "LinuxSpec", "\n", "if", "temp", ".", "DesiredStatus", "!=", "nil", "{", "cgroup", ".", "SetDesiredStatus", "(", "resourcestatus", ".", "ResourceStatus", "(", "*", "temp", ".", "DesiredStatus", ")", ")", "\n", "}", "\n", "if", "<mask>", ".", "KnownStatus", "!=", "nil", "{", "cgroup", ".", "SetKnownStatus", "(", "resourcestatus", ".", "ResourceStatus", "(", "*", "temp", ".", "KnownStatus", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,820
all-16821
[ "parseConfig", "parses", "the", "configuration", "options", "(", "e", ".", "g", ".", "InitialNodesFile", ")" ]
[ "func", "parseConfig", "(", "config", "*", "Configuration", ")", "error", "{", "if", "config", ".", "InitialNodesFile", "!=", "\"", "\"", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "config", ".", "InitialNodesFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n\n", "decoder", ":=", "json", ".", "NewDecoder", "(", "f", ")", "\n", "if", "err", ":=", "decoder", ".", "Decode", "(", "&", "config", ".", "InitialNodes", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "if", "len", "(", "config", ".", "InitialNodes", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "for", "_", ",", "<mask>", ":=", "range", "config", ".", "InitialNodes", "{", "if", "_", ",", "_", ",", "err", ":=", "net", ".", "SplitHostPort", "(", "node", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "node", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
16,821
all-16822
[ "Discard", "discards", "a", "created", "transaction", ".", "This", "method", "is", "very", "important", "and", "must", "be", "called", ".", "Commit", "method", "calls", "this", "internally", "however", "calling", "this", "multiple", "times", "doesn", "t", "cause", "any", "issues", ".", "So", "this", "can", "safely", "be", "called", "via", "a", "defer", "right", "when", "transaction", "is", "created", ".", "NOTE", ":", "If", "any", "operations", "are", "run", "on", "a", "discarded", "transaction", "ErrDiscardedTxn", "is", "returned", "." ]
[ "func", "(", "txn", "*", "Txn", ")", "Discard", "(", ")", "{", "if", "txn", ".", "discarded", "{", "// Avoid a re-run.", "return", "\n", "}", "\n", "if", "atomic", ".", "LoadInt32", "(", "&", "txn", ".", "numIterators", ")", ">", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "txn", ".", "discarded", "=", "true", "\n", "if", "!", "txn", ".", "db", ".", "orc", ".", "isManaged", "{", "txn", ".", "<mask>", ".", "orc", ".", "readMark", ".", "Done", "(", "txn", ".", "readTs", ")", "\n", "}", "\n", "if", "txn", ".", "update", "{", "txn", ".", "db", ".", "orc", ".", "decrRef", "(", ")", "\n", "}", "\n", "}" ]
16,822
all-16823
[ "Tag", "adds", "a", "tag", "to", "the", "last", "pushed", "span", "." ]
[ "func", "(", "t", "*", "Tracer", ")", "Tag", "(", "key", "string", ",", "value", "<mask>", "{", "}", ")", "{", "t", ".", "Last", "(", ")", ".", "SetTag", "(", "key", ",", "value", ")", "\n", "}" ]
16,823
all-16824
[ "Do", "executes", "Cast", ".", "setSinkToUse", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetSinkToUseParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetSinkToUse", ",", "p", ",", "nil", ")", "\n", "}" ]
16,824
all-16825
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetAsyncCallStackDepthParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger18", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
16,825
all-16826
[ "SendCustomHostNotification", "creates", "a", "new", "SEND_CUSTOM_HOST_NOTIFICATION", "Nagios", "command", ".", "Allows", "you", "to", "send", "a", "custom", "host", "notification", ".", "Very", "useful", "in", "dire", "situations", "emergencies", "or", "to", "communicate", "with", "all", "admins", "that", "are", "responsible", "for", "a", "particular", "host", ".", "When", "the", "host", "notification", "is", "sent", "out", "the", "$NOTIFICATIONTYPE$", "macro", "will", "be", "set", "to", "CUSTOM", ".", "The", "<options", ">", "field", "is", "a", "logical", "OR", "of", "the", "following", "integer", "values", "that", "affect", "aspects", "of", "the", "notification", "that", "are", "sent", "out", ":", "0", "=", "No", "option", "(", "default", ")", "1", "=", "Broadcast", "(", "send", "notification", "to", "all", "normal", "and", "all", "escalated", "contacts", "for", "the", "host", ")", "2", "=", "Forced", "(", "notification", "is", "sent", "out", "regardless", "of", "current", "time", "whether", "or", "not", "notifications", "are", "enabled", "etc", ".", ")", "4", "=", "Increment", "current", "notification", "#", "for", "the", "host", "(", "this", "is", "not", "done", "by", "default", "for", "custom", "notifications", ")", ".", "The", "comment", "field", "can", "be", "used", "with", "the", "$NOTIFICATIONCOMMENT$", "macro", "in", "notification", "commands", "." ]
[ "func", "SendCustomHostNotification", "(", "host_name", "string", ",", "options", "int", ",", "author", "string", ",", "comment", "string", ",", ")", "*", "livestatus", ".", "Command", "{", "return", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "host_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "<mask>", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "author", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "comment", ")", ",", ")", "\n", "}" ]
16,826
all-16827
[ "formatString", "prints", "s", "as", "a", "double", "-", "quoted", "or", "backtick", "-", "quoted", "string", "." ]
[ "func", "formatString", "(", "s", "string", ")", "string", "{", "// Use quoted string if it the same length as a raw string literal.", "// Otherwise, attempt to use the raw string form.", "qs", ":=", "strconv", ".", "Quote", "(", "s", ")", "\n", "if", "len", "(", "qs", ")", "==", "1", "+", "len", "(", "s", ")", "+", "1", "{", "return", "<mask>", "\n", "}", "\n\n", "// Disallow newlines to ensure output is a single line.", "// Only allow printable runes for readability purposes.", "rawInvalid", ":=", "func", "(", "r", "rune", ")", "bool", "{", "return", "r", "==", "'`'", "||", "r", "==", "'\\n'", "||", "!", "(", "unicode", ".", "IsPrint", "(", "r", ")", "||", "r", "==", "'\\t'", ")", "\n", "}", "\n", "if", "strings", ".", "IndexFunc", "(", "s", ",", "rawInvalid", ")", "<", "0", "{", "return", "\"", "\"", "+", "s", "+", "\"", "\"", "\n", "}", "\n", "return", "qs", "\n", "}" ]
16,827
all-16828
[ "Dereference", "returns", "a", "pointer", "s", "element", "type", ";", "otherwise", "it", "returns", "T", "." ]
[ "func", "Dereference", "(", "T", "types", ".", "Type", ")", "types", ".", "Type", "{", "if", "p", ",", "ok", ":=", "T", ".", "Underlying", "(", ")", ".", "(", "*", "types", ".", "Pointer", ")", ";", "<mask>", "{", "return", "p", ".", "Elem", "(", ")", "\n", "}", "\n", "return", "T", "\n", "}" ]
16,828
all-16829
[ "tagCategoryByName", "locates", "a", "tag", "category", "by", "name", ".", "It", "s", "used", "by", "the", "vsphere_tag_category", "data", "source", "and", "the", "resource", "importer", "." ]
[ "func", "tagCategoryByName", "(", "client", "*", "tags", ".", "RestClient", ",", "name", "string", ")", "(", "string", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "defaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "cats", ",", "err", ":=", "<mask>", ".", "GetCategoriesByName", "(", "ctx", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "cats", ")", "<", "1", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "if", "len", "(", "cats", ")", ">", "1", "{", "// Although GetCategoriesByName does not seem to think that tag categories", "// are unique, empirical observation via the console and API show that they", "// are. If for some reason the returned results includes more than one ID,", "// we give an error, indicating that this is a bug and the user should", "// submit an issue.", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "vSphereTagCategorySearchErrMultiple", ",", "name", ")", "\n", "}", "\n\n", "return", "cats", "[", "0", "]", ".", "ID", ",", "nil", "\n", "}" ]
16,829
all-16830
[ "ContainerBackupsGetExpired", "returns", "a", "list", "of", "expired", "container", "backups", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerBackupsGetExpired", "(", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "<mask>", "[", "]", "string", "\n", "var", "name", "string", "\n", "var", "expiryDate", "string", "\n\n", "q", ":=", "`SELECT containers_backups.name, containers_backups.expiry_date FROM containers_backups`", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "name", ",", "expiryDate", "}", "\n", "dbResults", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "q", ",", "nil", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "r", ":=", "range", "dbResults", "{", "timestamp", ":=", "r", "[", "1", "]", "\n\n", "var", "backupExpiry", "time", ".", "Time", "\n", "err", "=", "backupExpiry", ".", "UnmarshalText", "(", "[", "]", "byte", "(", "timestamp", ".", "(", "string", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "string", "{", "}", ",", "err", "\n", "}", "\n\n", "if", "backupExpiry", ".", "IsZero", "(", ")", "{", "// Backup doesn't expire", "continue", "\n", "}", "\n\n", "// Backup has expired", "if", "time", ".", "Now", "(", ")", ".", "Unix", "(", ")", "-", "backupExpiry", ".", "Unix", "(", ")", ">=", "0", "{", "result", "=", "append", "(", "result", ",", "r", "[", "0", "]", ".", "(", "string", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "result", ",", "nil", "\n", "}" ]
16,830
all-16831
[ "MustParse", "is", "the", "panic", "-", "on", "-", "fail", "version", "of", "Parse" ]
[ "func", "MustParse", "(", "addressOrSeed", "string", ")", "KP", "{", "kp", ",", "<mask>", ":=", "Parse", "(", "addressOrSeed", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "return", "kp", "\n", "}" ]
16,831
all-16832
[ "CreateLoadBalancer", "creates", "a", "new", "load", "balancer", ".", "It", "takes", "a", "LoadBalancerOptions", "struct", "for", "specifying", "name", "and", "other", "attributes", ".", "Not", "all", "attributes", "can", "be", "specified", "at", "create", "time", "(", "such", "as", "Id", "which", "is", "allocated", "for", "you", ")" ]
[ "func", "(", "c", "*", "<mask>", ")", "CreateLoadBalancer", "(", "newLB", "*", "LoadBalancerOptions", ")", "(", "*", "LoadBalancer", ",", "error", ")", "{", "lb", ":=", "new", "(", "LoadBalancer", ")", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "newLB", ",", "&", "lb", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "lb", ",", "nil", "\n", "}" ]
16,832
all-16833
[ "Do", "executes", "Debugger", ".", "restartFrame", "against", "the", "provided", "context", ".", "returns", ":", "callFrames", "-", "New", "stack", "trace", ".", "asyncStackTrace", "-", "Async", "stack", "trace", "if", "any", ".", "asyncStackTraceID", "-", "Async", "stack", "trace", "if", "any", "." ]
[ "func", "(", "p", "*", "RestartFrameParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "callFrames", "[", "]", "*", "CallFrame", ",", "asyncStackTrace", "*", "runtime", ".", "StackTrace", ",", "asyncStackTraceID", "*", "runtime", ".", "StackTraceID", ",", "err", "error", ")", "{", "// execute", "var", "<mask>", "RestartFrameReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRestartFrame", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "CallFrames", ",", "res", ".", "AsyncStackTrace", ",", "res", ".", "AsyncStackTraceID", ",", "nil", "\n", "}" ]
16,833
all-16834
[ "RecurringVolumeAttachmentLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "RecurringVolumeAttachmentLocator", "(", "href", "<mask>", ")", "*", "RecurringVolumeAttachmentLocator", "{", "return", "&", "RecurringVolumeAttachmentLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
16,834
all-16835
[ "export", "FileSequence_New_Pad" ]
[ "func", "FileSequence_New_Pad", "(", "frange", "*", "C", ".", "char", ",", "padStyle", "C", ".", "int", ")", "(", "FileSeqId", ",", "Error", ")", "{", "style", ":=", "fileseq", ".", "PadStyle", "(", "padStyle", ")", "\n", "<mask>", ",", "e", ":=", "fileseq", ".", "NewFileSequencePad", "(", "C", ".", "GoString", "(", "frange", ")", ",", "style", ")", "\n", "if", "e", "!=", "nil", "{", "// err string is freed by caller", "return", "0", ",", "C", ".", "CString", "(", "e", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "id", ":=", "sFileSeqs", ".", "Add", "(", "fs", ")", "\n", "return", "id", ",", "nil", "\n", "}" ]
16,835
all-16836
[ "Create", "is", "used", "to", "start", "a", "new", "snapshot" ]
[ "func", "(", "f", "*", "FileSnapshotStore", ")", "Create", "(", "version", "SnapshotVersion", ",", "index", ",", "term", "uint64", ",", "configuration", "Configuration", ",", "configurationIndex", "uint64", ",", "trans", "Transport", ")", "(", "SnapshotSink", ",", "error", ")", "{", "// We only support version 1 snapshots at this time.", "if", "<mask>", "!=", "1", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "version", ")", "\n", "}", "\n\n", "// Create a new path", "name", ":=", "snapshotName", "(", "term", ",", "index", ")", "\n", "path", ":=", "filepath", ".", "Join", "(", "f", ".", "path", ",", "name", "+", "tmpSuffix", ")", "\n", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "path", ")", "\n\n", "// Make the directory", "if", "err", ":=", "os", ".", "MkdirAll", "(", "path", ",", "0755", ")", ";", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Create the sink", "sink", ":=", "&", "FileSnapshotSink", "{", "store", ":", "f", ",", "logger", ":", "f", ".", "logger", ",", "dir", ":", "path", ",", "parentDir", ":", "f", ".", "path", ",", "meta", ":", "fileSnapshotMeta", "{", "SnapshotMeta", ":", "SnapshotMeta", "{", "Version", ":", "version", ",", "ID", ":", "name", ",", "Index", ":", "index", ",", "Term", ":", "term", ",", "Peers", ":", "encodePeers", "(", "configuration", ",", "trans", ")", ",", "Configuration", ":", "configuration", ",", "ConfigurationIndex", ":", "configurationIndex", ",", "}", ",", "CRC", ":", "nil", ",", "}", ",", "}", "\n\n", "// Write out the meta data", "if", "err", ":=", "sink", ".", "writeMeta", "(", ")", ";", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Open the state file", "statePath", ":=", "filepath", ".", "Join", "(", "path", ",", "stateFilePath", ")", "\n", "fh", ",", "err", ":=", "os", ".", "Create", "(", "statePath", ")", "\n", "if", "err", "!=", "nil", "{", "f", ".", "logger", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "sink", ".", "stateFile", "=", "fh", "\n\n", "// Create a CRC64 hash", "sink", ".", "stateHash", "=", "crc64", ".", "New", "(", "crc64", ".", "MakeTable", "(", "crc64", ".", "ECMA", ")", ")", "\n\n", "// Wrap both the hash and file in a MultiWriter with buffering", "multi", ":=", "io", ".", "MultiWriter", "(", "sink", ".", "stateFile", ",", "sink", ".", "stateHash", ")", "\n", "sink", ".", "buffered", "=", "bufio", ".", "NewWriter", "(", "multi", ")", "\n\n", "// Done", "return", "sink", ",", "nil", "\n", "}" ]
16,836
all-16837
[ "Get", "retrieves", "the", "value", "assigned", "to", "key" ]
[ "func", "(", "args", "Args", ")", "Get", "(", "key", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "ret", ",", "ok", ":=", "args", "[", "<mask>", "]", "\n", "return", "ret", ",", "ok", "\n", "}" ]
16,837
all-16838
[ "Returns", "an", "int", "or", "panics" ]
[ "func", "(", "t", "Typed", ")", "IntMust", "(", "key", "string", ")", "int", "{", "i", ",", "exists", ":=", "t", ".", "IntIf", "(", "key", ")", "\n", "if", "exists", "==", "false", "{", "panic", "(", "\"", "\"", "+", "<mask>", ")", "\n", "}", "\n", "return", "i", "\n", "}" ]
16,838
all-16839
[ "Remove", "deletes", "the", "GCE", "instance", "and", "the", "disk", "." ]
[ "func", "(", "d", "*", "Driver", ")", "Remove", "(", ")", "error", "{", "c", ",", "err", ":=", "newComputeUtil", "(", "d", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "c", ".", "deleteInstance", "(", ")", ";", "err", "!=", "nil", "{", "if", "isNotFound", "(", "err", ")", "{", "<mask>", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "else", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "if", "err", ":=", "c", ".", "deleteDisk", "(", ")", ";", "err", "!=", "nil", "{", "if", "isNotFound", "(", "err", ")", "{", "log", ".", "Warn", "(", "\"", "\"", ")", "\n", "}", "else", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
16,839
all-16840
[ "ParamsInt", "returns", "params", "result", "in", "int", "type", ".", "e", ".", "g", ".", "ctx", ".", "ParamsInt", "(", ":", "uid", ")" ]
[ "func", "(", "ctx", "*", "Context", ")", "ParamsInt", "(", "<mask>", "string", ")", "int", "{", "return", "com", ".", "StrTo", "(", "ctx", ".", "Params", "(", "name", ")", ")", ".", "MustInt", "(", ")", "\n", "}" ]
16,840
all-16841
[ "Marshal", "prints", "the", "result", "tree", "r", "in", "XML", "form", "to", "w", "." ]
[ "func", "Marshal", "(", "n", "tree", ".", "Node", ",", "w", "<mask>", ".", "Writer", ")", "error", "{", "return", "marshal", "(", "n", ",", "w", ")", "\n", "}" ]
16,841
all-16842
[ "prowJobStatus", "returns", "the", "desired", "state", "and", "description", "based", "on", "the", "build", "status", "." ]
[ "func", "prowJobStatus", "(", "bs", "buildv1alpha1", ".", "BuildStatus", ")", "(", "prowjobv1", ".", "ProwJobState", ",", "string", ")", "{", "started", ":=", "bs", ".", "StartTime", "\n", "finished", ":=", "bs", ".", "CompletionTime", "\n", "pcond", ":=", "bs", ".", "GetCondition", "(", "buildv1alpha1", ".", "BuildSucceeded", ")", "\n", "if", "pcond", "==", "nil", "{", "if", "!", "finished", ".", "IsZero", "(", ")", "{", "return", "prowjobv1", ".", "ErrorState", ",", "descMissingCondition", "\n", "}", "\n", "return", "prowjobv1", ".", "TriggeredState", ",", "descScheduling", "\n", "}", "\n", "cond", ":=", "*", "pcond", "\n", "switch", "{", "case", "cond", ".", "Status", "==", "coreapi", ".", "ConditionTrue", ":", "return", "prowjobv1", ".", "SuccessState", ",", "description", "(", "cond", ",", "descSucceeded", ")", "\n", "case", "cond", ".", "Status", "==", "coreapi", ".", "ConditionFalse", ":", "return", "prowjobv1", ".", "FailureState", ",", "description", "(", "cond", ",", "descFailed", ")", "\n", "case", "started", ".", "IsZero", "(", ")", ":", "return", "prowjobv1", ".", "TriggeredState", ",", "description", "(", "cond", ",", "descInitializing", ")", "\n", "case", "cond", ".", "Status", "==", "coreapi", ".", "ConditionUnknown", ",", "finished", ".", "IsZero", "(", ")", ":", "return", "prowjobv1", ".", "PendingState", ",", "<mask>", "(", "cond", ",", "descRunning", ")", "\n", "}", "\n", "logrus", ".", "Warnf", "(", "\"", "\"", ",", "cond", ")", "\n", "return", "prowjobv1", ".", "ErrorState", ",", "description", "(", "cond", ",", "descUnknown", ")", "// shouldn't happen", "\n", "}" ]
16,842
all-16843
[ "NewAzureProvider", "creates", "a", "new", "Azure", "provider", ".", "Returns", "the", "provider", "or", "an", "error", "if", "a", "provider", "could", "not", "be", "created", "." ]
[ "func", "NewAzureProvider", "(", "configFile", "string", ",", "domainFilter", "DomainFilter", ",", "zoneIDFilter", "ZoneIDFilter", ",", "resourceGroup", "string", ",", "dryRun", "bool", ")", "(", "*", "AzureProvider", ",", "error", ")", "{", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "configFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "configFile", ",", "err", ")", "\n", "}", "\n", "cfg", ":=", "config", "{", "}", "\n", "err", "=", "yaml", ".", "Unmarshal", "(", "contents", ",", "&", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "configFile", ",", "err", ")", "\n", "}", "\n\n", "// If a resource group was given, override what was present in the config file", "if", "resourceGroup", "!=", "\"", "\"", "{", "cfg", ".", "ResourceGroup", "=", "resourceGroup", "\n", "}", "\n\n", "var", "environment", "azure", ".", "Environment", "\n", "if", "cfg", ".", "Cloud", "==", "\"", "\"", "{", "environment", "=", "azure", ".", "PublicCloud", "\n", "}", "else", "{", "environment", ",", "err", "=", "azure", ".", "EnvironmentFromName", "(", "cfg", ".", "Cloud", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cfg", ".", "Cloud", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "token", ",", "err", ":=", "getAccessToken", "(", "cfg", ",", "environment", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "zonesClient", ":=", "dns", ".", "NewZonesClientWithBaseURI", "(", "environment", ".", "ResourceManagerEndpoint", ",", "cfg", ".", "SubscriptionID", ")", "\n", "zonesClient", ".", "Authorizer", "=", "autorest", ".", "NewBearerAuthorizer", "(", "token", ")", "\n", "recordsClient", ":=", "dns", ".", "NewRecordSetsClientWithBaseURI", "(", "<mask>", ".", "ResourceManagerEndpoint", ",", "cfg", ".", "SubscriptionID", ")", "\n", "recordsClient", ".", "Authorizer", "=", "autorest", ".", "NewBearerAuthorizer", "(", "token", ")", "\n\n", "provider", ":=", "&", "AzureProvider", "{", "domainFilter", ":", "domainFilter", ",", "zoneIDFilter", ":", "zoneIDFilter", ",", "dryRun", ":", "dryRun", ",", "resourceGroup", ":", "cfg", ".", "ResourceGroup", ",", "zonesClient", ":", "zonesClient", ",", "recordsClient", ":", "recordsClient", ",", "}", "\n", "return", "provider", ",", "nil", "\n", "}" ]
16,843
all-16844
[ "Caution", ":", "hdb", "counts", "4", "byte", "utf", "-", "8", "encodings", "(", "cesu", "-", "8", "6", "bytes", ")", "as", "2", "(", "3", "byte", ")", "chars" ]
[ "func", "(", "l", "*", "charLobChunkWriter", ")", "runeCount", "(", "b", "[", "]", "byte", ")", "int", "{", "numChars", ":=", "0", "\n", "for", "len", "(", "b", ")", ">", "0", "{", "_", ",", "size", ":=", "utf8", ".", "DecodeRune", "(", "b", ")", "\n", "b", "=", "b", "[", "size", ":", "]", "\n", "numChars", "++", "\n", "if", "<mask>", "==", "utf8", ".", "UTFMax", "{", "numChars", "++", "\n", "}", "\n", "}", "\n", "return", "numChars", "\n", "}" ]
16,844
all-16845
[ "DecodeRune", "unpacks", "the", "first", "CESU", "-", "8", "encoding", "in", "p", "and", "returns", "the", "rune", "and", "its", "width", "in", "bytes", "." ]
[ "func", "DecodeRune", "(", "p", "[", "]", "<mask>", ")", "(", "rune", ",", "int", ")", "{", "high", ",", "n1", ",", "_", ":=", "decodeRune", "(", "p", ")", "\n", "if", "!", "utf16", ".", "IsSurrogate", "(", "high", ")", "{", "return", "high", ",", "n1", "\n", "}", "\n", "low", ",", "n2", ",", "_", ":=", "decodeRune", "(", "p", "[", "n1", ":", "]", ")", "\n", "if", "low", "==", "utf8", ".", "RuneError", "{", "return", "low", ",", "n1", "+", "n2", "\n", "}", "\n", "return", "utf16", ".", "DecodeRune", "(", "high", ",", "low", ")", ",", "n1", "+", "n2", "\n", "}" ]
16,845
all-16846
[ "cast", "takes", "a", "native", "GObject", "and", "casts", "it", "to", "the", "appropriate", "Go", "struct", ".", "TODO", "change", "all", "wrapFns", "to", "return", "an", "IObject" ]
[ "func", "cast", "(", "c", "*", "C", ".", "GObject", ")", "(", "glib", ".", "IObject", ",", "error", ")", "{", "var", "(", "className", "=", "goString", "(", "C", ".", "object_get_class_name", "(", "c", ")", ")", "\n", "obj", "=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", ")", "\n\n", "fn", ",", "ok", ":=", "WrapMap", "[", "className", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", "+", "className", "+", "\"", "\"", ")", "\n", "}", "\n\n", "rf", ":=", "reflect", ".", "ValueOf", "(", "fn", ")", "\n", "if", "rf", ".", "Type", "(", ")", ".", "Kind", "(", ")", "!=", "reflect", ".", "Func", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "v", ":=", "reflect", ".", "ValueOf", "(", "obj", ")", "\n", "rv", ":=", "rf", ".", "Call", "(", "[", "]", "reflect", ".", "Value", "{", "v", "}", ")", "\n\n", "if", "len", "(", "rv", ")", "!=", "1", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "k", ":=", "rv", "[", "0", "]", ".", "Kind", "(", ")", ";", "k", "!=", "reflect", ".", "Ptr", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "k", ")", "\n", "}", "\n\n", "<mask>", ",", "ok", ":=", "rv", "[", "0", "]", ".", "Interface", "(", ")", ".", "(", "glib", ".", "IObject", ")", "\n", "if", "!", "ok", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "ret", ",", "nil", "\n", "}" ]
16,846
all-16847
[ "ForwardKey", "must", "be", "called", "from", "the", "application", "to", "route", "key", "strokes", "to", "windows", ".", "The", "life", "cycle", "of", "keystrokes", "is", "as", "follows", ":", "widgets", "-", ">", "global", "application", "context", "-", ">", "window", ".", "Care", "must", "be", "taken", "in", "the", "application", "to", "not", "rely", "on", "keystrokes", "that", "widgets", "may", "use", "." ]
[ "func", "ForwardKey", "(", "k", "<mask>", ")", "{", "if", "k", ".", "Window", "==", "nil", "{", "return", "\n", "}", "\n", "k", ".", "Window", ".", "KeyHandler", "(", "windower2window", "[", "k", ".", "Window", "]", ",", "k", ")", "\n", "}" ]
16,847
all-16848
[ "InitInnkeeperClient", "--", "initialize", "innkeeper", "client", "based", "on", "cf", "configuration" ]
[ "func", "(", "s", "*", "SkuM1Small", ")", "InitInnkeeperClient", "(", ")", "(", "clnt", "innkeeperclient", ".", "InnkeeperClient", ",", "err", "error", ")", "{", "if", "appEnv", ",", "err", ":=", "cfenv", ".", "Current", "(", ")", ";", "err", "==", "nil", "{", "if", "taskService", ",", "err", ":=", "appEnv", ".", "Services", ".", "WithName", "(", "\"", "\"", ")", ";", "err", "==", "nil", "{", "clnt", "=", "&", "innkeeperclient", ".", "IkClient", "{", "URI", ":", "taskService", ".", "Credentials", "[", "\"", "\"", "]", ".", "(", "string", ")", ",", "<mask>", ":", "taskService", ".", "Credentials", "[", "\"", "\"", "]", ".", "(", "string", ")", ",", "Password", ":", "taskService", ".", "Credentials", "[", "\"", "\"", "]", ".", "(", "string", ")", ",", "}", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
16,848
all-16849
[ "Tick", "constructs", "a", "ticker", "with", "interval", "and", "calls", "the", "given", "ProcessFunc", "every", "time", "the", "ticker", "fires", ".", "This", "is", "sequentially", "rate", "limited", "only", "one", "call", "will", "be", "in", "-", "flight", "at", "a", "time", ".", "p", ":", "=", "periodicproc", ".", "Tick", "(", "time", ".", "Second", "func", "(", "proc", "goprocess", ".", "Process", ")", "{", "fmt", ".", "Println", "(", "fire!", ")", "}", ")", "<", "-", "time", ".", "After", "(", "3", "*", "time", ".", "Second", ")", "p", ".", "Close", "()", "//", "Output", ":", "//", "fire!", "//", "fire!", "//", "fire!" ]
[ "func", "Tick", "(", "interval", "time", ".", "Duration", ",", "procfunc", "gp", ".", "ProcessFunc", ")", "gp", ".", "Process", "{", "return", "gp", ".", "Go", "(", "func", "(", "proc", "gp", ".", "Process", ")", "{", "ticker", ":=", "<mask>", ".", "NewTicker", "(", "interval", ")", "\n", "callOnTicker", "(", "ticker", ".", "C", ",", "procfunc", ")", "(", "proc", ")", "\n", "ticker", ".", "Stop", "(", ")", "\n", "}", ")", "\n", "}" ]
16,849
all-16850
[ "defaultPool", "returns", "a", "connection", "pool", "to", "one", "Sentinel", ".", "This", "allows", "us", "to", "call", "concurrent", "requests", "to", "Sentinel", "using", "connection", "Do", "method", "." ]
[ "func", "(", "s", "*", "Sentinel", ")", "defaultPool", "(", "addr", "string", ")", "*", "redis", ".", "Pool", "{", "return", "&", "redis", ".", "Pool", "{", "MaxIdle", ":", "3", ",", "MaxActive", ":", "10", ",", "Wait", ":", "true", ",", "IdleTimeout", ":", "240", "*", "time", ".", "Second", ",", "Dial", ":", "func", "(", ")", "(", "redis", ".", "Conn", ",", "error", ")", "{", "return", "s", ".", "Dial", "(", "addr", ")", "\n", "}", ",", "TestOnBorrow", ":", "func", "(", "c", "redis", ".", "Conn", ",", "t", "<mask>", ".", "Time", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "Do", "(", "\"", "\"", ")", "\n", "return", "err", "\n", "}", ",", "}", "\n", "}" ]
16,850
all-16851
[ "GetElapsedTime", "returns", "the", "elapsed", "time", "since", "an", "ExponentialBackOff", "instance", "is", "created", "and", "is", "reset", "when", "Reset", "()", "is", "called", ".", "The", "elapsed", "time", "is", "computed", "using", "time", ".", "Now", "()", ".", "UnixNano", "()", "." ]
[ "func", "(", "b", "*", "ExponentialBackOff", ")", "GetElapsedTime", "(", ")", "<mask>", ".", "Duration", "{", "return", "b", ".", "Clock", ".", "Now", "(", ")", ".", "Sub", "(", "b", ".", "startTime", ")", "\n", "}" ]
16,851
all-16852
[ "IsInvalidated", "returns", "a", "boolean", "value", "indicating", "whether", "the", "image", "is", "invalidated", ".", "If", "an", "image", "is", "invalidated", "GL", "context", "is", "lost", "and", "all", "the", "images", "should", "be", "restored", "asap", "." ]
[ "func", "(", "i", "*", "Image", ")", "IsInvalidated", "(", ")", "(", "bool", ",", "error", ")", "{", "// FlushCommands is required because c.offscreen.impl might not have an actual texture.", "graphicscommand", ".", "FlushCommands", "(", ")", "\n", "if", "!", "IsRestoringEnabled", "(", ")", "{", "return", "false", ",", "nil", "\n", "}", "\n\n", "return", "i", ".", "<mask>", ".", "IsInvalidated", "(", ")", ",", "nil", "\n", "}" ]
16,852
all-16853
[ "Return", "true", "if", "the", "input", "word", "is", "a", "Norwegian", "stop", "word", "." ]
[ "func", "isStopWord", "(", "word", "string", ")", "bool", "{", "switch", "<mask>", "{", "case", "\"", "\"", ",", "\"", ",", " ", "h", ",", " ", "h", ",", " ", "t", ",", " ", "v", ",", " ", "h", ",", " ", "m", ",", " ", "m", ",", " ", "v", ",", " ", "e", ",", " ", "f", "", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "h", ",", " ", "p", ",", " ", "r", ",", "", "\"", ",", " ", "d", ",", " ", "m", ",", " ", "i", ",", " ", "l", ",", " ", "n", ",", " ", "h", ",", " ", "h", ",", " ", "t", ",", " ", "v", ",", " ", "h", ",", " ", "o", ",", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "a", ",", " ", "a", ",", " ", "l", ",", " ", "l", ",", " ", "g", " ", "\"", "å", "\"", "s", "d", "", "", "\"", ",", " ", "b", ",", " ", "b", ",", " ", "e", ",", " ", "o", ",", " ", "t", ",", " ", "d", ",", " ", "e", ",", " ", "h", ",", " ", "n", " ", "\"", "i", " ", "\"", "l", "", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "m", ",", " ", "b", ",", " ", "d", ",", " ", "f", ",", " ", "g", " ", "\"", "o", " ", "\"", "a", " ", "\"", "t", "", "", "\"", "\"", ",", "\"", ",", " ", "m", ",", " ", "u", ",", " ", "m", ",", " ", "o", ",", " ", "i", ",", " ", "p", " ", "\"", "e", " ", "\"", "i", " ", "\"", "u", " ", "\"", "t", "", "", "\"", ",", " ", "s", ",", " ", "e", ",", " ", "f", ",", " ", "m", ",", " ", "r", ",", " ", "e", ",", " ", "b", ",", " ", "e", ",", " ", "n", ",", " ", "s", ",", " ", "v", " ", "\"", "i", "", "", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", ",", " ", "h", ",", " ", "a", ",", " ", "e", ",", " ", "f", ",", " ", "h", ",", " ", "f", " ", "\"", "v", "", "", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
16,853
all-16854
[ "Main", "draws", "vertically", "spaced", "lines", "and", "returns", "the", "filename", ".", "This", "should", "only", "be", "used", "during", "testing", "." ]
[ "func", "Main", "(", "gc", "draw2d", ".", "GraphicContext", ",", "ext", "string", ")", "(", "string", ",", "error", ")", "{", "gc", ".", "SetFillRule", "(", "draw2d", ".", "FillRuleWinding", ")", "\n", "gc", ".", "Clear", "(", ")", "\n", "// Draw the line", "for", "x", ":=", "5.0", ";", "x", "<", "297", ";", "x", "+=", "10", "{", "Draw", "(", "gc", ",", "x", ",", "0", ",", "x", ",", "210", ")", "\n", "}", "\n", "gc", ".", "ClearRect", "(", "100", ",", "75", ",", "197", ",", "135", ")", "\n", "draw2dkit", ".", "Ellipse", "(", "gc", ",", "148.5", ",", "105", ",", "35", ",", "25", ")", "\n", "gc", ".", "SetFillColor", "(", "<mask>", ".", "RGBA", "{", "0xff", ",", "0xff", ",", "0x44", ",", "0xff", "}", ")", "\n", "gc", ".", "FillStroke", "(", ")", "\n\n", "// Return the output filename", "return", "samples", ".", "Output", "(", "\"", "\"", ",", "ext", ")", ",", "nil", "\n", "}" ]
16,854
all-16855
[ "RaftNodes", "returns", "information", "about", "all", "LXD", "nodes", "that", "are", "members", "of", "the", "dqlite", "Raft", "cluster", "(", "possibly", "including", "the", "local", "node", ")", ".", "If", "this", "LXD", "instance", "is", "not", "running", "in", "clustered", "mode", "an", "empty", "list", "is", "returned", "." ]
[ "func", "(", "n", "*", "NodeTx", ")", "RaftNodes", "(", ")", "(", "[", "]", "RaftNode", ",", "error", ")", "{", "nodes", ":=", "[", "]", "RaftNode", "{", "}", "\n", "dest", ":=", "func", "(", "i", "int", ")", "[", "]", "interface", "{", "}", "{", "nodes", "=", "append", "(", "nodes", ",", "RaftNode", "{", "}", ")", "\n", "return", "[", "]", "<mask>", "{", "}", "{", "&", "nodes", "[", "i", "]", ".", "ID", ",", "&", "nodes", "[", "i", "]", ".", "Address", "}", "\n", "}", "\n", "stmt", ",", "err", ":=", "n", ".", "tx", ".", "Prepare", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "stmt", ".", "Close", "(", ")", "\n", "err", "=", "query", ".", "SelectObjects", "(", "stmt", ",", "dest", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "nodes", ",", "nil", "\n", "}" ]
16,855
all-16856
[ "MarshalEasyJSON", "satisfies", "easyjson", ".", "Marshaler", "." ]
[ "func", "(", "t", "StyleSheetOrigin", ")", "MarshalEasyJSON", "(", "out", "*", "jwriter", ".", "Writer", ")", "{", "<mask>", ".", "String", "(", "string", "(", "t", ")", ")", "\n", "}" ]
16,856
all-16857
[ "WithExecutionContextID", "specifies", "execution", "context", "which", "global", "object", "will", "be", "used", "to", "call", "function", "on", ".", "Either", "executionContextId", "or", "objectId", "should", "be", "specified", "." ]
[ "func", "(", "p", "CallFunctionOnParams", ")", "WithExecutionContextID", "(", "executionContextID", "ExecutionContextID", ")", "*", "CallFunctionOnParams", "{", "p", ".", "ExecutionContextID", "=", "executionContextID", "\n", "<mask>", "&", "p", "\n", "}" ]
16,857
all-16858
[ "RatioForStrings", "returns", "the", "Levenshtein", "ratio", "for", "the", "given", "strings", ".", "The", "ratio", "is", "computed", "as", "follows", ":", "(", "sourceLength", "+", "targetLength", "-", "distance", ")", "/", "(", "sourceLength", "+", "targetLength", ")" ]
[ "func", "RatioForStrings", "(", "<mask>", "[", "]", "rune", ",", "target", "[", "]", "rune", ",", "op", "Options", ")", "float64", "{", "matrix", ":=", "MatrixForStrings", "(", "source", ",", "target", ",", "op", ")", "\n", "return", "RatioForMatrix", "(", "matrix", ")", "\n", "}" ]
16,858
all-16859
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "StartPreciseCoverageParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler11", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
16,859
all-16860
[ "renewUserCredentials", "extends", "the", "TTL", "of", "the", "Pachyderm", "authentication", "token", "userToken", "using", "the", "vault", "plugin", "s", "Admin", "credentials", ".", "userToken", "belongs", "to", "the", "user", "who", "is", "calling", "vault", "and", "would", "like", "to", "extend", "their", "Pachyderm", "session", "." ]
[ "func", "renewUserCredentials", "(", "ctx", "context", ".", "Context", ",", "pachdAddress", "string", ",", "adminToken", "string", ",", "userToken", "string", ",", "ttl", "time", ".", "Duration", ")", "error", "{", "// Setup a single use client w the given admin token / address", "<mask>", ",", "err", ":=", "pclient", ".", "NewFromAddress", "(", "pachdAddress", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "client", ".", "Close", "(", ")", "// avoid leaking connections", "\n\n", "client", "=", "client", ".", "WithCtx", "(", "ctx", ")", "\n", "client", ".", "SetAuthToken", "(", "adminToken", ")", "\n\n", "_", ",", "err", "=", "client", ".", "AuthAPIClient", ".", "ExtendAuthToken", "(", "client", ".", "Ctx", "(", ")", ",", "&", "auth", ".", "ExtendAuthTokenRequest", "{", "Token", ":", "userToken", ",", "TTL", ":", "int64", "(", "ttl", ".", "Seconds", "(", ")", ")", ",", "}", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
16,860
all-16861
[ "Create", "a", "sub", "-", "scope", "for", "this", "set", "of", "known", "tags", "." ]
[ "func", "(", "kt", "knownTags", ")", "tallyTags", "(", ")", "<mask>", "[", "string", "]", "string", "{", "tallyTags", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "5", ")", "\n\n", "if", "kt", ".", "dest", "!=", "\"", "\"", "{", "tallyTags", "[", "\"", "\"", "]", "=", "kt", ".", "dest", "\n", "}", "\n", "if", "kt", ".", "source", "!=", "\"", "\"", "{", "tallyTags", "[", "\"", "\"", "]", "=", "kt", ".", "source", "\n", "}", "\n", "if", "kt", ".", "procedure", "!=", "\"", "\"", "{", "tallyTags", "[", "\"", "\"", "]", "=", "kt", ".", "procedure", "\n", "}", "\n", "if", "kt", ".", "retryCount", "!=", "\"", "\"", "{", "tallyTags", "[", "\"", "\"", "]", "=", "kt", ".", "retryCount", "\n", "}", "\n\n", "return", "tallyTags", "\n", "}" ]
16,861
all-16862
[ "SelectDay", "is", "a", "wrapper", "around", "gtk_calendar_select_day", "()", "." ]
[ "func", "(", "v", "*", "Calendar", ")", "SelectDay", "(", "<mask>", "uint", ")", "{", "C", ".", "gtk_calendar_select_day", "(", "v", ".", "native", "(", ")", ",", "C", ".", "guint", "(", "day", ")", ")", "\n", "}" ]
16,862
all-16863
[ "GetIdOk", "returns", "a", "tuple", "with", "the", "Id", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "a", "*", "Alert", ")", "GetIdOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "a", "==", "nil", "||", "a", ".", "Id", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "a", ".", "Id", ",", "<mask>", "\n", "}" ]
16,863
all-16864
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetFileInfoReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom44", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
16,864
all-16865
[ "PrivSay", "accepts", "a", "client", "id", "the", "name", "of", "the", "client", "and", "the", "message", "body", "and", "sends", "the", "private", "message", "to", "the", "HipChat", "user", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "PrivSay", "(", "user", ",", "name", ",", "body", "string", ")", "{", "c", ".", "connection", ".", "MUCSend", "(", "\"", "\"", ",", "user", ",", "c", ".", "Id", "+", "\"", "\"", "+", "name", ",", "body", ")", "\n", "}" ]
16,865
all-16866
[ "DetachCdrom", "detaches", "a", "CD", "rom" ]
[ "func", "(", "c", "*", "Client", ")", "DetachCdrom", "(", "dcid", ",", "srvid", ",", "cdid", "string", ")", "(", "*", "http", ".", "<mask>", ",", "error", ")", "{", "url", ":=", "serverCdromPath", "(", "dcid", ",", "srvid", ",", "cdid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "http", ".", "Header", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Delete", "(", "url", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
16,866
all-16867
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "NodeTreeSnapshot", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
16,867
all-16868
[ "Delete", "is", "used", "to", "delete", "a", "key", "returning", "the", "previous", "value", "and", "if", "it", "was", "deleted" ]
[ "func", "(", "t", "*", "Tree", ")", "Delete", "(", "s", "string", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "var", "parent", "*", "node", "\n", "var", "label", "byte", "\n", "n", ":=", "t", ".", "root", "\n", "search", ":=", "s", "\n", "for", "{", "// Check for key exhaution", "if", "len", "(", "search", ")", "==", "0", "{", "if", "!", "n", ".", "isLeaf", "(", ")", "{", "break", "\n", "}", "\n", "goto", "DELETE", "\n", "}", "\n\n", "// Look for an edge", "<mask>", "=", "n", "\n", "label", "=", "search", "[", "0", "]", "\n", "n", "=", "n", ".", "getEdge", "(", "label", ")", "\n", "if", "n", "==", "nil", "{", "break", "\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\n", "DELETE", ":", "// Delete the leaf", "leaf", ":=", "n", ".", "leaf", "\n", "n", ".", "leaf", "=", "nil", "\n", "t", ".", "size", "--", "\n\n", "// Check if we should delete this node from the parent", "if", "parent", "!=", "nil", "&&", "len", "(", "n", ".", "edges", ")", "==", "0", "{", "parent", ".", "delEdge", "(", "label", ")", "\n", "}", "\n\n", "// Check if we should merge this node", "if", "n", "!=", "t", ".", "root", "&&", "len", "(", "n", ".", "edges", ")", "==", "1", "{", "n", ".", "mergeChild", "(", ")", "\n", "}", "\n\n", "// Check if we should merge the parent's other child", "if", "parent", "!=", "nil", "&&", "parent", "!=", "t", ".", "root", "&&", "len", "(", "parent", ".", "edges", ")", "==", "1", "&&", "!", "parent", ".", "isLeaf", "(", ")", "{", "parent", ".", "mergeChild", "(", ")", "\n", "}", "\n\n", "return", "leaf", ".", "val", ",", "true", "\n", "}" ]
16,868
all-16869
[ "output", "returns", "the", "trimmed", "output", "of", "running", "args", "or", "an", "err", "on", "non", "-", "zero", "exit", "." ]
[ "func", "output", "(", "args", "...", "string", ")", "(", "string", ",", "error", ")", "{", "cmd", ":=", "exec", ".", "Command", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "...", ")", "\n", "cmd", ".", "Stderr", "=", "os", ".", "Stderr", "\n", "cmd", ".", "Stdin", "=", "<mask>", ".", "Stdin", "\n", "b", ",", "err", ":=", "cmd", ".", "Output", "(", ")", "\n", "return", "strings", ".", "TrimSpace", "(", "string", "(", "b", ")", ")", ",", "err", "\n", "}" ]
16,869
all-16870
[ "Make", "a", "boot2docker", "userdata", ".", "tar", "key", "bundle" ]
[ "func", "(", "d", "*", "Driver", ")", "generateKeyBundle", "(", ")", "error", "{", "log", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "magicString", ":=", "\"", "\"", "\n\n", "tf", ",", "err", ":=", "os", ".", "Create", "(", "d", ".", "ResolveStorePath", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "tf", ".", "Close", "(", ")", "\n", "var", "fileWriter", "=", "tf", "\n\n", "tw", ":=", "tar", ".", "NewWriter", "(", "fileWriter", ")", "\n", "defer", "tw", ".", "Close", "(", ")", "\n\n", "// magicString first so we can figure out who originally wrote the tar.", "<mask>", ":=", "&", "tar", ".", "Header", "{", "Name", ":", "magicString", ",", "Size", ":", "int64", "(", "len", "(", "magicString", ")", ")", "}", "\n", "if", "err", ":=", "tw", ".", "WriteHeader", "(", "file", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "_", ",", "err", ":=", "tw", ".", "Write", "(", "[", "]", "byte", "(", "magicString", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "// .ssh/key.pub => authorized_keys", "file", "=", "&", "tar", ".", "Header", "{", "Name", ":", "\"", "\"", ",", "Typeflag", ":", "tar", ".", "TypeDir", ",", "Mode", ":", "0700", "}", "\n", "if", "err", ":=", "tw", ".", "WriteHeader", "(", "file", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "pubKey", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "d", ".", "publicSSHKeyPath", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "file", "=", "&", "tar", ".", "Header", "{", "Name", ":", "\"", "\"", ",", "Size", ":", "int64", "(", "len", "(", "pubKey", ")", ")", ",", "Mode", ":", "0644", "}", "\n", "if", "err", ":=", "tw", ".", "WriteHeader", "(", "file", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "_", ",", "err", ":=", "tw", ".", "Write", "(", "[", "]", "byte", "(", "pubKey", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "file", "=", "&", "tar", ".", "Header", "{", "Name", ":", "\"", "\"", ",", "Size", ":", "int64", "(", "len", "(", "pubKey", ")", ")", ",", "Mode", ":", "0644", "}", "\n", "if", "err", ":=", "tw", ".", "WriteHeader", "(", "file", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "_", ",", "err", ":=", "tw", ".", "Write", "(", "[", "]", "byte", "(", "pubKey", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "tw", ".", "Close", "(", ")", "\n", "return", "err", "\n", "}" ]
16,870
all-16871
[ "flattenClusterProactiveDrsConfigInfo", "saves", "a", "ClusterProactiveDrsConfigInfo", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenClusterProactiveDrsConfigInfo", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "ClusterProactiveDrsConfigInfo", ")", "error", "{", "return", "structure", ".", "SetBatch", "(", "d", ",", "map", "[", "string", "]", "<mask>", "{", "}", "{", "\"", "\"", ":", "obj", ".", "Enabled", ",", "}", ")", "\n", "}" ]
16,871
all-16872
[ "GetKnownStatus", "safely", "returns", "the", "currently", "known", "status", "of", "the", "task" ]
[ "func", "(", "secret", "*", "ASMSecretResource", ")", "GetKnownStatus", "(", ")", "resourcestatus", ".", "ResourceStatus", "{", "secret", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "<mask>", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "secret", ".", "knownStatusUnsafe", "\n", "}" ]
16,872
all-16873
[ "QueryInt64", "returns", "query", "result", "in", "int64", "type", "." ]
[ "func", "(", "ctx", "*", "Context", ")", "QueryInt64", "(", "name", "string", ")", "int64", "{", "return", "com", ".", "StrTo", "(", "ctx", ".", "Query", "(", "<mask>", ")", ")", ".", "MustInt64", "(", ")", "\n", "}" ]
16,873
all-16874
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetTouchEmulationEnabledParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation3", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
16,874
all-16875
[ "NewFanout", "returns", "a", "new", "fan", "-", "out", "Storage", "which", "proxies", "reads", "and", "writes", "through", "to", "multiple", "underlying", "storages", "." ]
[ "func", "NewFanout", "(", "logger", "log", ".", "Logger", ",", "primary", "Storage", ",", "secondaries", "...", "Storage", ")", "<mask>", "{", "return", "&", "fanout", "{", "logger", ":", "logger", ",", "primary", ":", "primary", ",", "secondaries", ":", "secondaries", ",", "}", "\n", "}" ]
16,875
all-16876
[ "MakeHandler", "wraps", "all", "the", "Middlewares", "of", "the", "stack", "and", "the", "App", "together", "and", "returns", "an", "http", ".", "Handler", "ready", "to", "be", "used", ".", "If", "the", "Middleware", "stack", "is", "empty", "the", "App", "is", "used", "directly", ".", "If", "the", "App", "is", "nil", "a", "HandlerFunc", "that", "does", "nothing", "is", "used", "instead", "." ]
[ "func", "(", "api", "*", "Api", ")", "MakeHandler", "(", ")", "http", ".", "Handler", "{", "var", "appFunc", "HandlerFunc", "\n", "if", "api", ".", "app", "!=", "nil", "{", "appFunc", "=", "api", ".", "app", ".", "AppFunc", "(", ")", "\n", "}", "else", "{", "appFunc", "=", "func", "(", "w", "ResponseWriter", ",", "r", "*", "Request", ")", "{", "}", "\n", "}", "\n", "return", "<mask>", ".", "HandlerFunc", "(", "adapterFunc", "(", "WrapMiddlewares", "(", "api", ".", "stack", ",", "appFunc", ")", ",", ")", ",", ")", "\n", "}" ]
16,876
all-16877
[ "SliceLen", "returns", "the", "length", "of", "a", "slice", ".", "r", "must", "contain", "a", "slice", "." ]
[ "func", "(", "r", "<mask>", ")", "SliceLen", "(", ")", "int64", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindSlice", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "r", ".", "p", ".", "proc", ".", "ReadInt", "(", "r", ".", "a", ".", "Add", "(", "r", ".", "p", ".", "proc", ".", "PtrSize", "(", ")", ")", ")", "\n", "}" ]
16,877
all-16878
[ "NewClient", "returns", "a", "Client", "that", "makes", "calls", "over", "the", "given", "tchannel", "to", "the", "given", "Hyperbahn", "service", "." ]
[ "func", "NewClient", "(", "ch", "*", "tchannel", ".", "Channel", ",", "serviceName", "string", ",", "opts", "*", "ClientOptions", ")", "TChanClient", "{", "client", ":=", "&", "client", "{", "ch", ":", "ch", ",", "sc", ":", "ch", ".", "GetSubChannel", "(", "serviceName", ")", ",", "serviceName", ":", "serviceName", ",", "}", "\n", "if", "opts", "!=", "nil", "{", "<mask>", ".", "opts", "=", "*", "opts", "\n", "}", "\n", "return", "client", "\n", "}" ]
16,878
all-16879
[ "ExecuteFuncString", "calls", "f", "on", "each", "template", "tag", "(", "placeholder", ")", "occurrence", "and", "substitutes", "it", "with", "the", "data", "written", "to", "TagFunc", "s", "w", ".", "Returns", "the", "resulting", "string", ".", "This", "function", "is", "optimized", "for", "frozen", "templates", ".", "Use", "ExecuteFuncString", "for", "constantly", "changing", "templates", "." ]
[ "func", "(", "t", "*", "<mask>", ")", "ExecuteFuncString", "(", "f", "TagFunc", ")", "string", "{", "bb", ":=", "t", ".", "byteBufferPool", ".", "Get", "(", ")", "\n", "if", "_", ",", "err", ":=", "t", ".", "ExecuteFunc", "(", "bb", ",", "f", ")", ";", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "}", "\n", "s", ":=", "string", "(", "bb", ".", "Bytes", "(", ")", ")", "\n", "bb", ".", "Reset", "(", ")", "\n", "t", ".", "byteBufferPool", ".", "Put", "(", "bb", ")", "\n", "return", "s", "\n", "}" ]
16,879
all-16880
[ "ConfigGetBool", "is", "a", "convenience", "for", "loading", "the", "cluster", "configuration", "and", "returning", "the", "value", "of", "a", "particular", "boolean", "key", ".", "It", "s", "a", "deprecated", "API", "meant", "to", "be", "used", "by", "call", "sites", "that", "are", "not", "interacting", "with", "the", "database", "in", "a", "transactional", "way", "." ]
[ "func", "ConfigGetBool", "(", "cluster", "*", "db", ".", "Cluster", ",", "key", "string", ")", "(", "bool", ",", "error", ")", "{", "config", ",", "err", ":=", "configGet", "(", "cluster", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", ",", "err", "\n", "}", "\n", "return", "config", ".", "m", ".", "GetBool", "(", "key", ")", ",", "nil", "\n", "}" ]
16,880
all-16881
[ "AddError", "adds", "a", "new", "error", "with", "a", "code", "to", "the", "registry", ".", "It", "there", "already", "is", "an", "error", "or", "handler", "with", "the", "same", "code", "ErrErrorAlreadyRegistered", "will", "be", "returned", "." ]
[ "func", "(", "r", "*", "MapErrorRegistry", ")", "AddError", "(", "code", "int", ",", "err", "error", ")", "error", "{", "if", "_", ",", "ok", ":=", "r", ".", "errors", "[", "code", "]", ";", "ok", "{", "return", "ErrErrorAlreadyRegistered", "\n", "}", "\n", "if", "_", ",", "ok", ":=", "r", ".", "handlers", "[", "<mask>", "]", ";", "ok", "{", "return", "ErrErrorAlreadyRegistered", "\n", "}", "\n", "r", ".", "errors", "[", "code", "]", "=", "err", "\n", "return", "nil", "\n", "}" ]
16,881
all-16882
[ "Cascades", "a", "document", "s", "properties", "to", "related", "documents", "after", "it", "has", "been", "prepared", "for", "db", "insertion", "(", "encrypted", "etc", ")" ]
[ "func", "CascadeSave", "(", "collection", "*", "Collection", ",", "doc", "Document", ")", "error", "{", "// Find out which properties to cascade", "if", "conv", ",", "ok", ":=", "doc", ".", "(", "CascadingDocument", ")", ";", "ok", "{", "toCascade", ":=", "conv", ".", "GetCascade", "(", "collection", ")", "\n", "for", "_", ",", "conf", ":=", "range", "toCascade", "{", "if", "len", "(", "conf", ".", "ReferenceQuery", ")", "==", "0", "{", "conf", ".", "ReferenceQuery", "=", "[", "]", "*", "ReferenceField", "{", "&", "ReferenceField", "{", "\"", "\"", ",", "doc", ".", "GetId", "(", ")", "}", "}", "\n", "}", "\n", "_", ",", "err", ":=", "cascadeSaveWithConfig", "(", "conf", ",", "doc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "conf", ".", "Nest", "{", "results", ":=", "conf", ".", "Collection", ".", "Find", "(", "conf", ".", "Query", ")", "\n\n", "for", "<mask>", ".", "Next", "(", "conf", ".", "Instance", ")", "{", "err", "=", "CascadeSave", "(", "conf", ".", "Collection", ",", "conf", ".", "Instance", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
16,882
all-16883
[ "To", "check", "this", "line", "is", "a", "section", "or", "not", ".", "If", "it", "is", "not", "a", "section", "it", "returns", "." ]
[ "func", "checkSection", "(", "line", "string", ")", "(", "string", ",", "bool", ")", "{", "line", "=", "strings", ".", "TrimSpace", "(", "line", ")", "\n", "lineLen", ":=", "len", "(", "<mask>", ")", "\n", "if", "lineLen", "<", "2", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "if", "line", "[", "0", "]", "==", "'['", "&&", "line", "[", "lineLen", "-", "1", "]", "==", "']'", "{", "return", "line", "[", "1", ":", "lineLen", "-", "1", "]", ",", "true", "\n", "}", "\n", "return", "\"", "\"", ",", "false", "\n", "}" ]
16,883
all-16884
[ "VPCID", "returns", "the", "VPC", "id", "for", "the", "network", "interface", "given", "its", "mac", "address" ]
[ "func", "(", "c", "*", "ec2MetadataClientImpl", ")", "VPCID", "(", "mac", "string", ")", "(", "string", ",", "error", ")", "{", "return", "c", ".", "<mask>", ".", "GetMetadata", "(", "fmt", ".", "Sprintf", "(", "VPCIDResourceFormat", ",", "mac", ")", ")", "\n", "}" ]
16,884
all-16885
[ "/", "*", "It", "is", "possible", "to", "trigger", "an", "event", "on", "one", "or", "more", "channels", ".", "Channel", "names", "can", "contain", "only", "characters", "which", "are", "alphanumeric", "_", "or", "-", "and", "have", "to", "be", "at", "most", "200", "characters", "long", ".", "Event", "name", "can", "be", "at", "most", "200", "characters", "long", "too", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "Trigger", "(", "channel", "string", ",", "eventName", "string", ",", "data", "interface", "{", "}", ")", "(", "*", "BufferedEvents", ",", "error", ")", "{", "return", "c", ".", "trigger", "(", "[", "]", "string", "{", "channel", "}", ",", "eventName", ",", "data", ",", "nil", ")", "\n", "}" ]
16,885
all-16886
[ "WithDepth", "the", "maximum", "depth", "at", "which", "children", "should", "be", "retrieved", "defaults", "to", "1", ".", "Use", "-", "1", "for", "the", "entire", "subtree", "or", "provide", "an", "integer", "larger", "than", "0", "." ]
[ "func", "(", "p", "GetDocumentParams", ")", "WithDepth", "(", "depth", "int64", ")", "*", "GetDocumentParams", "{", "p", ".", "Depth", "=", "<mask>", "\n", "return", "&", "p", "\n", "}" ]
16,886
all-16887
[ "GetUrlOk", "returns", "a", "tuple", "with", "the", "Url", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "GetUrlOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "e", "==", "nil", "||", "e", ".", "Url", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "e", ".", "Url", ",", "true", "\n", "}" ]
16,887
all-16888
[ "InteractionCount", "gets", "the", "count", "of", "interactions", "that", "have", "happened", "between", "the", "bot", "and", "user", ".", "Returns", "-", "1", "if", "interactions_count", "is", "missing", "or", "parsing", "failed", "." ]
[ "func", "(", "s", "*", "Session", ")", "InteractionCount", "(", ")", "int", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "v", ",", "ok", ":=", "s", ".", "Decoded", "[", "\"", "\"", "]", ".", "(", "string", ")", ";", "ok", "{", "if", "<mask>", ",", "err", ":=", "strconv", ".", "Atoi", "(", "v", ")", ";", "err", "==", "nil", "{", "return", "count", "\n", "}", "\n", "}", "\n", "return", "-", "1", "\n", "}" ]
16,888
all-16889
[ "IsMetadataFileUpdated", "returns", "true", "if", "the", "metadata", "file", "has", "been", "once", "the", "metadata", "file", "is", "ready", "and", "will", "no", "longer", "change" ]
[ "func", "(", "c", "*", "Container", ")", "IsMetadataFileUpdated", "(", ")", "bool", "{", "c", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "<mask>", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "MetadataFileUpdated", "\n", "}" ]
16,889
all-16890
[ "Parse", "parses", "the", "XPath", "expression", "xp", "returning", "an", "XPath", "executor", "." ]
[ "func", "Parse", "(", "xp", "string", ")", "(", "XPathExec", ",", "error", ")", "{", "n", ",", "err", ":=", "<mask>", ".", "Parse", "(", "xp", ")", "\n", "return", "XPathExec", "{", "n", ":", "n", "}", ",", "err", "\n", "}" ]
16,890
all-16891
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "UniformMatrix3x2fv", "(", "location", "int32", ",", "count", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "syscall", ".", "Syscall6", "(", "gpUniformMatrix3x2fv", ",", "4", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "count", ")", ",", "boolToUintptr", "(", "transpose", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
16,891
all-16892
[ "ENIFromACS", "validates", "the", "information", "from", "acs", "message", "and", "create", "the", "ENI", "object" ]
[ "func", "ENIFromACS", "(", "acsenis", "[", "]", "*", "ecsacs", ".", "ElasticNetworkInterface", ")", "(", "*", "ENI", ",", "error", ")", "{", "err", ":=", "ValidateTaskENI", "(", "acsenis", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "ipv4", "[", "]", "*", "ENIIPV4Address", "\n", "var", "ipv6", "[", "]", "*", "ENIIPV6Address", "\n\n", "// Read ipv4 address information of the eni", "for", "_", ",", "ec2Ipv4", ":=", "range", "acsenis", "[", "0", "]", ".", "Ipv4Addresses", "{", "ipv4", "=", "append", "(", "ipv4", ",", "&", "ENIIPV4Address", "{", "Primary", ":", "aws", ".", "BoolValue", "(", "ec2Ipv4", ".", "Primary", ")", ",", "Address", ":", "aws", ".", "StringValue", "(", "ec2Ipv4", ".", "PrivateAddress", ")", ",", "}", ")", "\n", "}", "\n\n", "// Read ipv6 address information of the eni", "for", "_", ",", "ec2Ipv6", ":=", "<mask>", "acsenis", "[", "0", "]", ".", "Ipv6Addresses", "{", "ipv6", "=", "append", "(", "ipv6", ",", "&", "ENIIPV6Address", "{", "Address", ":", "aws", ".", "StringValue", "(", "ec2Ipv6", ".", "Address", ")", ",", "}", ")", "\n", "}", "\n\n", "eni", ":=", "&", "ENI", "{", "ID", ":", "aws", ".", "StringValue", "(", "acsenis", "[", "0", "]", ".", "Ec2Id", ")", ",", "IPV4Addresses", ":", "ipv4", ",", "IPV6Addresses", ":", "ipv6", ",", "MacAddress", ":", "aws", ".", "StringValue", "(", "acsenis", "[", "0", "]", ".", "MacAddress", ")", ",", "PrivateDNSName", ":", "aws", ".", "StringValue", "(", "acsenis", "[", "0", "]", ".", "PrivateDnsName", ")", ",", "SubnetGatewayIPV4Address", ":", "aws", ".", "StringValue", "(", "acsenis", "[", "0", "]", ".", "SubnetGatewayIpv4Address", ")", ",", "}", "\n", "for", "_", ",", "nameserverIP", ":=", "range", "acsenis", "[", "0", "]", ".", "DomainNameServers", "{", "eni", ".", "DomainNameServers", "=", "append", "(", "eni", ".", "DomainNameServers", ",", "aws", ".", "StringValue", "(", "nameserverIP", ")", ")", "\n", "}", "\n", "for", "_", ",", "nameserverDomain", ":=", "range", "acsenis", "[", "0", "]", ".", "DomainName", "{", "eni", ".", "DomainNameSearchList", "=", "append", "(", "eni", ".", "DomainNameSearchList", ",", "aws", ".", "StringValue", "(", "nameserverDomain", ")", ")", "\n", "}", "\n\n", "return", "eni", ",", "nil", "\n", "}" ]
16,892
all-16893
[ "RoundTrip", "indicates", "an", "expected", "call", "of", "RoundTrip" ]
[ "func", "(", "mr", "*", "MockRoundTripperMockRecorder", ")", "RoundTrip", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockRoundTripper", ")", "(", "nil", ")", ".", "RoundTrip", ")", ",", "arg0", ")", "\n", "}" ]
16,893
all-16894
[ "EquateApprox", "returns", "a", "Comparer", "option", "that", "determines", "float32", "or", "float64", "values", "to", "be", "equal", "if", "they", "are", "within", "a", "relative", "fraction", "or", "absolute", "margin", ".", "This", "option", "is", "not", "used", "when", "either", "x", "or", "y", "is", "NaN", "or", "infinite", ".", "The", "fraction", "determines", "that", "the", "difference", "of", "two", "values", "must", "be", "within", "the", "smaller", "fraction", "of", "the", "two", "values", "while", "the", "margin", "determines", "that", "the", "two", "values", "must", "be", "within", "some", "absolute", "margin", ".", "To", "express", "only", "a", "fraction", "or", "only", "a", "margin", "use", "0", "for", "the", "other", "parameter", ".", "The", "fraction", "and", "margin", "must", "be", "non", "-", "negative", ".", "The", "mathematical", "expression", "used", "is", "equivalent", "to", ":", "|x", "-", "y|", "≤", "max", "(", "fraction", "*", "min", "(", "|x|", "|y|", ")", "margin", ")", "EquateApprox", "can", "be", "used", "in", "conjunction", "with", "EquateNaNs", "." ]
[ "func", "EquateApprox", "(", "fraction", ",", "margin", "float64", ")", "cmp", ".", "Option", "{", "if", "margin", "<", "0", "||", "fraction", "<", "0", "||", "math", ".", "IsNaN", "(", "margin", ")", "||", "math", ".", "IsNaN", "(", "fraction", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "a", ":=", "approximator", "{", "fraction", ",", "margin", "}", "\n", "return", "cmp", ".", "<mask>", "{", "cmp", ".", "FilterValues", "(", "areRealF64s", ",", "cmp", ".", "Comparer", "(", "a", ".", "compareF64", ")", ")", ",", "cmp", ".", "FilterValues", "(", "areRealF32s", ",", "cmp", ".", "Comparer", "(", "a", ".", "compareF32", ")", ")", ",", "}", "\n", "}" ]
16,894
all-16895
[ "return", "the", "values", "of", "the", "current", "matrix" ]
[ "func", "QueryMatrixxOES", "(", "mantissa", "*", "int32", ",", "exponent", "*", "int32", ")", "uint32", "{", "ret", ":=", "C", ".", "glowQueryMatrixxOES", "(", "gpQueryMatrixxOES", ",", "(", "*", "C", ".", "GLfixed", ")", "(", "unsafe", ".", "Pointer", "(", "mantissa", ")", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "exponent", ")", ")", ")", "\n", "return", "(", "uint32", ")", "(", "<mask>", ")", "\n", "}" ]
16,895
all-16896
[ "Verify", "creates", "a", "signature", "for", "buf", "comparing", "it", "against", "the", "URL", "-", "safe", "base64", "encoded", "sig", "and", "returning", "the", "decoded", "signature", ".", "If", "the", "sig", "is", "invalid", "then", "ErrInvalidSignature", "will", "be", "returned", "." ]
[ "func", "(", "hs", "*", "HmacSigner", ")", "Verify", "(", "buf", ",", "sig", "[", "]", "<mask>", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "var", "err", "error", "\n\n", "// decode", "dec", ",", "err", ":=", "b64", ".", "DecodeString", "(", "string", "(", "sig", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// verify", "err", "=", "hs", ".", "VerifyBytes", "(", "buf", ",", "dec", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "dec", ",", "nil", "\n", "}" ]
16,896
all-16897
[ "FormatURL", "will", "return", "the", "GH", "markdown", "to", "show", "the", "image", "for", "a", "specific", "dogURL", "." ]
[ "func", "FormatURL", "(", "dogURL", "string", ")", "(", "string", ",", "error", ")", "{", "if", "dogURL", "==", "\"", "\"", "{", "return", "\"", "\"", ",", "<mask>", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "src", ",", "err", ":=", "url", ".", "ParseRequestURI", "(", "dogURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dogURL", ",", "err", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "src", ",", "src", ")", ",", "nil", "\n", "}" ]
16,897
all-16898
[ "deleteDisk", "deletes", "the", "persistent", "disk", "." ]
[ "func", "(", "c", "*", "ComputeUtil", ")", "deleteDisk", "(", ")", "error", "{", "disk", ",", "_", ":=", "c", ".", "disk", "(", ")", "\n", "if", "disk", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "op", ",", "err", ":=", "c", ".", "service", ".", "Disks", ".", "Delete", "(", "c", ".", "project", ",", "c", ".", "zone", ",", "c", ".", "diskName", "(", ")", ")", ".", "Do", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "<mask>", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "c", ".", "waitForRegionalOp", "(", "op", ".", "Name", ")", "\n", "}" ]
16,898
all-16899
[ "resourceVSphereResourcePoolApplyTags", "processes", "the", "tags", "step", "for", "both", "create", "and", "update", "for", "vsphere_resource_pool", "." ]
[ "func", "resourceVSphereResourcePoolApplyTags", "(", "d", "*", "schema", ".", "ResourceData", ",", "meta", "<mask>", "{", "}", ",", "rp", "*", "object", ".", "ResourcePool", ")", "error", "{", "tagsClient", ",", "err", ":=", "tagsClientIfDefined", "(", "d", ",", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Apply any pending tags now.", "if", "tagsClient", "==", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereComputeClusterIDString", "(", "d", ")", ")", "\n", "return", "nil", "\n", "}", "\n\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereResourcePoolIDString", "(", "d", ")", ")", "\n", "return", "processTagDiff", "(", "tagsClient", ",", "d", ",", "rp", ")", "\n", "}" ]
16,899
all-16900
[ "/", "*", "UserApiService", "create", "a", "user" ]
[ "func", "(", "a", "*", "UserApiService", ")", "CreateUser", "(", "ctx", "context", ".", "Context", ",", "localVarOptionals", "map", "[", "string", "]", "<mask>", "{", "}", ")", "(", "UserResponse", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "var", "(", "localVarHttpMethod", "=", "strings", ".", "ToUpper", "(", "\"", "\"", ")", "\n", "localVarPostBody", "interface", "{", "}", "\n", "localVarFileName", "string", "\n", "localVarFileBytes", "[", "]", "byte", "\n", "successPayload", "UserResponse", "\n", ")", "\n\n", "// create path and map variables", "localVarPath", ":=", "a", ".", "client", ".", "cfg", ".", "BasePath", "+", "\"", "\"", "\n\n", "localVarHeaderParams", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "localVarQueryParams", ":=", "url", ".", "Values", "{", "}", "\n", "localVarFormParams", ":=", "url", ".", "Values", "{", "}", "\n\n", "// to determine the Content-Type header", "localVarHttpContentTypes", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "\n\n", "// set Content-Type header", "localVarHttpContentType", ":=", "selectHeaderContentType", "(", "localVarHttpContentTypes", ")", "\n", "if", "localVarHttpContentType", "!=", "\"", "\"", "{", "localVarHeaderParams", "[", "\"", "\"", "]", "=", "localVarHttpContentType", "\n", "}", "\n\n", "// to determine the Accept header", "localVarHttpHeaderAccepts", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "}", "\n\n", "// set Accept header", "localVarHttpHeaderAccept", ":=", "selectHeaderAccept", "(", "localVarHttpHeaderAccepts", ")", "\n", "if", "localVarHttpHeaderAccept", "!=", "\"", "\"", "{", "localVarHeaderParams", "[", "\"", "\"", "]", "=", "localVarHttpHeaderAccept", "\n", "}", "\n", "// body params", "if", "localVarTempParam", ",", "localVarOk", ":=", "localVarOptionals", "[", "\"", "\"", "]", ".", "(", "User", ")", ";", "localVarOk", "{", "localVarPostBody", "=", "&", "localVarTempParam", "\n", "}", "\n", "r", ",", "err", ":=", "a", ".", "client", ".", "prepareRequest", "(", "ctx", ",", "localVarPath", ",", "localVarHttpMethod", ",", "localVarPostBody", ",", "localVarHeaderParams", ",", "localVarQueryParams", ",", "localVarFormParams", ",", "localVarFileName", ",", "localVarFileBytes", ")", "\n", "if", "err", "!=", "nil", "{", "return", "successPayload", ",", "nil", ",", "err", "\n", "}", "\n\n", "localVarHttpResponse", ",", "err", ":=", "a", ".", "client", ".", "callAPI", "(", "r", ")", "\n", "if", "err", "!=", "nil", "||", "localVarHttpResponse", "==", "nil", "{", "return", "successPayload", ",", "localVarHttpResponse", ",", "err", "\n", "}", "\n", "defer", "localVarHttpResponse", ".", "Body", ".", "Close", "(", ")", "\n", "if", "localVarHttpResponse", ".", "StatusCode", ">=", "300", "{", "bodyBytes", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "localVarHttpResponse", ".", "Body", ")", "\n", "return", "successPayload", ",", "localVarHttpResponse", ",", "reportError", "(", "\"", "\"", ",", "localVarHttpResponse", ".", "Status", ",", "bodyBytes", ")", "\n", "}", "\n\n", "if", "err", "=", "json", ".", "NewDecoder", "(", "localVarHttpResponse", ".", "Body", ")", ".", "Decode", "(", "&", "successPayload", ")", ";", "err", "!=", "nil", "{", "return", "successPayload", ",", "localVarHttpResponse", ",", "err", "\n", "}", "\n\n", "return", "successPayload", ",", "localVarHttpResponse", ",", "err", "\n", "}" ]