Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219

Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK!nO=XCXCjcryption/jquery.jcryption.jsnu[/* * jCryption JavaScript data encryption v1.2 * http://www.jcryption.org/ * * Copyright (c) 2010 Daniel Griesser * Dual licensed under the MIT and GPL licenses. * http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/gpl-2.0.php * * If you need any further information about this plugin please * visit my homepage or contact me under daniel.griesser@jcryption.org */ (function($) { $.jCryption = function(el, options) { var base = this; base.$el = $(el); base.el = el; base.$el.data("jCryption", base); base.init = function() { base.options = $.extend({},$.jCryption.defaultOptions, options); $encryptedElement = $("",{ type:'hidden', name:base.options.postVariable }); if (base.options.submitElement !== false) { var $submitElement = base.options.submitElement; } else { var $submitElement = base.$el.find(":input:submit"); } $submitElement.bind(base.options.submitEvent,function() { $(this).attr("disabled",true); if(base.options.beforeEncryption()) { $.jCryption.getKeys(base.options.getKeysURL, function(keys) { $.jCryption.encrypt(base.$el.serialize(), keys,function(encrypted) { $encryptedElement.val(encrypted); $(base.$el).find(base.options.formFieldSelector).attr("disabled",true).end().append($encryptedElement).submit(); }); }); } return false; }); }; base.init(); }; $.jCryption.getKeys = function(url,callback) { var jCryptionKeyPair = function(encryptionExponent, modulus, maxdigits) { setMaxDigits(parseInt(maxdigits,10)); this.e = biFromHex(encryptionExponent); this.m = biFromHex(modulus); this.chunkSize = 2 * biHighIndex(this.m); this.radix = 16; this.barrett = new BarrettMu(this.m); }; $.getJSON(url,function(data){ var keys = new jCryptionKeyPair(data.e,data.n,data.maxdigits); if($.isFunction(callback)) { callback.call(this, keys); } }); }; $.jCryption.encrypt = function(string,keyPair,callback) { var charSum = 0; for(var i = 0; i < string.length; i++){ charSum += string.charCodeAt(i); } var tag = '0123456789abcdef'; var hex = ''; hex += tag.charAt((charSum & 0xF0) >> 4) + tag.charAt(charSum & 0x0F); var taggedString = hex + string; var encrypt = []; var j = 0; while (j < taggedString.length) { encrypt[j] = taggedString.charCodeAt(j); j++; } while (encrypt.length % keyPair.chunkSize !== 0) { encrypt[j++] = 0; } function encryption(encryptObject) { var charCounter = 0; var j, block; var encrypted = ""; function encryptChar() { block = new BigInt(); j = 0; for (var k = charCounter; k < charCounter+keyPair.chunkSize; ++j) { block.digits[j] = encryptObject[k++]; block.digits[j] += encryptObject[k++] << 8; } var crypt = keyPair.barrett.powMod(block, keyPair.e); var text = keyPair.radix == 16 ? biToHex(crypt) : biToString(crypt, keyPair.radix); encrypted += text + " "; charCounter += keyPair.chunkSize; if (charCounter < encryptObject.length) { setTimeout(encryptChar, 1) } else { var encryptedString = encrypted.substring(0, encrypted.length - 1); if($.isFunction(callback)) { callback(encryptedString); } else { return encryptedString; } } } setTimeout(encryptChar, 1); } encryption(encrypt); }; $.jCryption.defaultOptions = { submitElement:false, submitEvent:"click", getKeysURL:"login.php?generateKeypair=true", beforeEncryption:function(){return true}, postVariable:"jCryption", formFieldSelector:":input" }; $.fn.jCryption = function(options) { return this.each(function(){ (new $.jCryption(this, options)); }); }; })(jQuery); /* * BigInt, a suite of routines for performing multiple-precision arithmetic in * JavaScript. * BarrettMu, a class for performing Barrett modular reduction computations in * JavaScript. * * * Copyright 1998-2005 David Shapiro. * dave@ohdave.com * * changed and improved by Daniel Griesser * http://www.jcryption.org/ * Daniel Griesser */ var biRadixBase = 2; var biRadixBits = 16; var bitsPerDigit = biRadixBits; var biRadix = 1 << 16; var biHalfRadix = biRadix >>> 1; var biRadixSquared = biRadix * biRadix; var maxDigitVal = biRadix - 1; var maxInteger = 9999999999999998; var maxDigits; var ZERO_ARRAY; var bigZero, bigOne; var dpl10 = 15; var highBitMasks = new Array(0x0000, 0x8000, 0xC000, 0xE000, 0xF000, 0xF800, 0xFC00, 0xFE00, 0xFF00, 0xFF80, 0xFFC0, 0xFFE0, 0xFFF0, 0xFFF8, 0xFFFC, 0xFFFE, 0xFFFF); var hexatrigesimalToChar = new Array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ); var hexToChar = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); var lowBitMasks = new Array(0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF); function setMaxDigits(value) { maxDigits = value; ZERO_ARRAY = new Array(maxDigits); for (var iza = 0; iza < ZERO_ARRAY.length; iza++) ZERO_ARRAY[iza] = 0; bigZero = new BigInt(); bigOne = new BigInt(); bigOne.digits[0] = 1; } function BigInt(flag) { if (typeof flag == "boolean" && flag == true) { this.digits = null; } else { this.digits = ZERO_ARRAY.slice(0); } this.isNeg = false; } function biFromDecimal(s) { var isNeg = s.charAt(0) == '-'; var i = isNeg ? 1 : 0; var result; while (i < s.length && s.charAt(i) == '0') ++i; if (i == s.length) { result = new BigInt(); } else { var digitCount = s.length - i; var fgl = digitCount % dpl10; if (fgl == 0) fgl = dpl10; result = biFromNumber(Number(s.substr(i, fgl))); i += fgl; while (i < s.length) { result = biAdd(biMultiply(result, biFromNumber(1000000000000000)), biFromNumber(Number(s.substr(i, dpl10)))); i += dpl10; } result.isNeg = isNeg; } return result; } function biCopy(bi) { var result = new BigInt(true); result.digits = bi.digits.slice(0); result.isNeg = bi.isNeg; return result; } function biFromNumber(i) { var result = new BigInt(); result.isNeg = i < 0; i = Math.abs(i); var j = 0; while (i > 0) { result.digits[j++] = i & maxDigitVal; i >>= biRadixBits; } return result; } function reverseStr(s) { var result = ""; for (var i = s.length - 1; i > -1; --i) { result += s.charAt(i); } return result; } function biToString(x, radix) { var b = new BigInt(); b.digits[0] = radix; var qr = biDivideModulo(x, b); var result = hexatrigesimalToChar[qr[1].digits[0]]; while (biCompare(qr[0], bigZero) == 1) { qr = biDivideModulo(qr[0], b); digit = qr[1].digits[0]; result += hexatrigesimalToChar[qr[1].digits[0]]; } return (x.isNeg ? "-" : "") + reverseStr(result); } function biToDecimal(x) { var b = new BigInt(); b.digits[0] = 10; var qr = biDivideModulo(x, b); var result = String(qr[1].digits[0]); while (biCompare(qr[0], bigZero) == 1) { qr = biDivideModulo(qr[0], b); result += String(qr[1].digits[0]); } return (x.isNeg ? "-" : "") + reverseStr(result); } function digitToHex(n) { var mask = 0xf; var result = ""; for (i = 0; i < 4; ++i) { result += hexToChar[n & mask]; n >>>= 4; } return reverseStr(result); } function biToHex(x) { var result = ""; var n = biHighIndex(x); for (var i = biHighIndex(x); i > -1; --i) { result += digitToHex(x.digits[i]); } return result; } function charToHex(c) { var ZERO = 48; var NINE = ZERO + 9; var littleA = 97; var littleZ = littleA + 25; var bigA = 65; var bigZ = 65 + 25; var result; if (c >= ZERO && c <= NINE) { result = c - ZERO; } else if (c >= bigA && c <= bigZ) { result = 10 + c - bigA; } else if (c >= littleA && c <= littleZ) { result = 10 + c - littleA; } else { result = 0; } return result; } function hexToDigit(s) { var result = 0; var sl = Math.min(s.length, 4); for (var i = 0; i < sl; ++i) { result <<= 4; result |= charToHex(s.charCodeAt(i)) } return result; } function biFromHex(s) { var result = new BigInt(); var sl = s.length; for (var i = sl, j = 0; i > 0; i -= 4, ++j) { result.digits[j] = hexToDigit(s.substr(Math.max(i - 4, 0), Math.min(i, 4))); } return result; } function biFromString(s, radix) { var isNeg = s.charAt(0) == '-'; var istop = isNeg ? 1 : 0; var result = new BigInt(); var place = new BigInt(); place.digits[0] = 1; // radix^0 for (var i = s.length - 1; i >= istop; i--) { var c = s.charCodeAt(i); var digit = charToHex(c); var biDigit = biMultiplyDigit(place, digit); result = biAdd(result, biDigit); place = biMultiplyDigit(place, radix); } result.isNeg = isNeg; return result; } function biDump(b) { return (b.isNeg ? "-" : "") + b.digits.join(" "); } function biAdd(x, y) { var result; if (x.isNeg != y.isNeg) { y.isNeg = !y.isNeg; result = biSubtract(x, y); y.isNeg = !y.isNeg; } else { result = new BigInt(); var c = 0; var n; for (var i = 0; i < x.digits.length; ++i) { n = x.digits[i] + y.digits[i] + c; result.digits[i] = n & 0xffff; c = Number(n >= biRadix); } result.isNeg = x.isNeg; } return result; } function biSubtract(x, y) { var result; if (x.isNeg != y.isNeg) { y.isNeg = !y.isNeg; result = biAdd(x, y); y.isNeg = !y.isNeg; } else { result = new BigInt(); var n, c; c = 0; for (var i = 0; i < x.digits.length; ++i) { n = x.digits[i] - y.digits[i] + c; result.digits[i] = n & 0xffff; if (result.digits[i] < 0) result.digits[i] += biRadix; c = 0 - Number(n < 0); } if (c == -1) { c = 0; for (var i = 0; i < x.digits.length; ++i) { n = 0 - result.digits[i] + c; result.digits[i] = n & 0xffff; if (result.digits[i] < 0) result.digits[i] += biRadix; c = 0 - Number(n < 0); } result.isNeg = !x.isNeg; } else { result.isNeg = x.isNeg; } } return result; } function biHighIndex(x) { var result = x.digits.length - 1; while (result > 0 && x.digits[result] == 0) --result; return result; } function biNumBits(x) { var n = biHighIndex(x); var d = x.digits[n]; var m = (n + 1) * bitsPerDigit; var result; for (result = m; result > m - bitsPerDigit; --result) { if ((d & 0x8000) != 0) break; d <<= 1; } return result; } function biMultiply(x, y) { var result = new BigInt(); var c; var n = biHighIndex(x); var t = biHighIndex(y); var u, uv, k; for (var i = 0; i <= t; ++i) { c = 0; k = i; for (j = 0; j <= n; ++j, ++k) { uv = result.digits[k] + x.digits[j] * y.digits[i] + c; result.digits[k] = uv & maxDigitVal; c = uv >>> biRadixBits; } result.digits[i + n + 1] = c; } result.isNeg = x.isNeg != y.isNeg; return result; } function biMultiplyDigit(x, y) { var n, c, uv; var result = new BigInt(); n = biHighIndex(x); c = 0; for (var j = 0; j <= n; ++j) { uv = result.digits[j] + x.digits[j] * y + c; result.digits[j] = uv & maxDigitVal; c = uv >>> biRadixBits; } result.digits[1 + n] = c; return result; } function arrayCopy(src, srcStart, dest, destStart, n) { var m = Math.min(srcStart + n, src.length); for (var i = srcStart, j = destStart; i < m; ++i, ++j) { dest[j] = src[i]; } } function biShiftLeft(x, n) { var digitCount = Math.floor(n / bitsPerDigit); var result = new BigInt(); arrayCopy(x.digits, 0, result.digits, digitCount,result.digits.length - digitCount); var bits = n % bitsPerDigit; var rightBits = bitsPerDigit - bits; for (var i = result.digits.length - 1, i1 = i - 1; i > 0; --i, --i1) { result.digits[i] = ((result.digits[i] << bits) & maxDigitVal) | ((result.digits[i1] & highBitMasks[bits]) >>> (rightBits)); } result.digits[0] = ((result.digits[i] << bits) & maxDigitVal); result.isNeg = x.isNeg; return result; } function biShiftRight(x, n) { var digitCount = Math.floor(n / bitsPerDigit); var result = new BigInt(); arrayCopy(x.digits, digitCount, result.digits, 0,x.digits.length - digitCount); var bits = n % bitsPerDigit; var leftBits = bitsPerDigit - bits; for (var i = 0, i1 = i + 1; i < result.digits.length - 1; ++i, ++i1) { result.digits[i] = (result.digits[i] >>> bits) | ((result.digits[i1] & lowBitMasks[bits]) << leftBits); } result.digits[result.digits.length - 1] >>>= bits; result.isNeg = x.isNeg; return result; } function biMultiplyByRadixPower(x, n) { var result = new BigInt(); arrayCopy(x.digits, 0, result.digits, n, result.digits.length - n); return result; } function biDivideByRadixPower(x, n) { var result = new BigInt(); arrayCopy(x.digits, n, result.digits, 0, result.digits.length - n); return result; } function biModuloByRadixPower(x, n) { var result = new BigInt(); arrayCopy(x.digits, 0, result.digits, 0, n); return result; } function biCompare(x, y) { if (x.isNeg != y.isNeg) { return 1 - 2 * Number(x.isNeg); } for (var i = x.digits.length - 1; i >= 0; --i) { if (x.digits[i] != y.digits[i]) { if (x.isNeg) { return 1 - 2 * Number(x.digits[i] > y.digits[i]); } else { return 1 - 2 * Number(x.digits[i] < y.digits[i]); } } } return 0; } function biDivideModulo(x, y) { var nb = biNumBits(x); var tb = biNumBits(y); var origYIsNeg = y.isNeg; var q, r; if (nb < tb) { if (x.isNeg) { q = biCopy(bigOne); q.isNeg = !y.isNeg; x.isNeg = false; y.isNeg = false; r = biSubtract(y, x); x.isNeg = true; y.isNeg = origYIsNeg; } else { q = new BigInt(); r = biCopy(x); } return new Array(q, r); } q = new BigInt(); r = x; var t = Math.ceil(tb / bitsPerDigit) - 1; var lambda = 0; while (y.digits[t] < biHalfRadix) { y = biShiftLeft(y, 1); ++lambda; ++tb; t = Math.ceil(tb / bitsPerDigit) - 1; } r = biShiftLeft(r, lambda); nb += lambda; var n = Math.ceil(nb / bitsPerDigit) - 1; var b = biMultiplyByRadixPower(y, n - t); while (biCompare(r, b) != -1) { ++q.digits[n - t]; r = biSubtract(r, b); } for (var i = n; i > t; --i) { var ri = (i >= r.digits.length) ? 0 : r.digits[i]; var ri1 = (i - 1 >= r.digits.length) ? 0 : r.digits[i - 1]; var ri2 = (i - 2 >= r.digits.length) ? 0 : r.digits[i - 2]; var yt = (t >= y.digits.length) ? 0 : y.digits[t]; var yt1 = (t - 1 >= y.digits.length) ? 0 : y.digits[t - 1]; if (ri == yt) { q.digits[i - t - 1] = maxDigitVal; } else { q.digits[i - t - 1] = Math.floor((ri * biRadix + ri1) / yt); } var c1 = q.digits[i - t - 1] * ((yt * biRadix) + yt1); var c2 = (ri * biRadixSquared) + ((ri1 * biRadix) + ri2); while (c1 > c2) { --q.digits[i - t - 1]; c1 = q.digits[i - t - 1] * ((yt * biRadix) | yt1); c2 = (ri * biRadix * biRadix) + ((ri1 * biRadix) + ri2); } b = biMultiplyByRadixPower(y, i - t - 1); r = biSubtract(r, biMultiplyDigit(b, q.digits[i - t - 1])); if (r.isNeg) { r = biAdd(r, b); --q.digits[i - t - 1]; } } r = biShiftRight(r, lambda); q.isNeg = x.isNeg != origYIsNeg; if (x.isNeg) { if (origYIsNeg) { q = biAdd(q, bigOne); } else { q = biSubtract(q, bigOne); } y = biShiftRight(y, lambda); r = biSubtract(y, r); } if (r.digits[0] == 0 && biHighIndex(r) == 0) r.isNeg = false; return new Array(q, r); } function biDivide(x, y) { return biDivideModulo(x, y)[0]; } function biModulo(x, y) { return biDivideModulo(x, y)[1]; } function biMultiplyMod(x, y, m) { return biModulo(biMultiply(x, y), m); } function biPow(x, y) { var result = bigOne; var a = x; while (true) { if ((y & 1) != 0) result = biMultiply(result, a); y >>= 1; if (y == 0) break; a = biMultiply(a, a); } return result; } function biPowMod(x, y, m) { var result = bigOne; var a = x; var k = y; while (true) { if ((k.digits[0] & 1) != 0) result = biMultiplyMod(result, a, m); k = biShiftRight(k, 1); if (k.digits[0] == 0 && biHighIndex(k) == 0) break; a = biMultiplyMod(a, a, m); } return result; } function BarrettMu(m) { this.modulus = biCopy(m); this.k = biHighIndex(this.modulus) + 1; var b2k = new BigInt(); b2k.digits[2 * this.k] = 1; this.mu = biDivide(b2k, this.modulus); this.bkplus1 = new BigInt(); this.bkplus1.digits[this.k + 1] = 1; this.modulo = BarrettMu_modulo; this.multiplyMod = BarrettMu_multiplyMod; this.powMod = BarrettMu_powMod; } function BarrettMu_modulo(x) { var q1 = biDivideByRadixPower(x, this.k - 1); var q2 = biMultiply(q1, this.mu); var q3 = biDivideByRadixPower(q2, this.k + 1); var r1 = biModuloByRadixPower(x, this.k + 1); var r2term = biMultiply(q3, this.modulus); var r2 = biModuloByRadixPower(r2term, this.k + 1); var r = biSubtract(r1, r2); if (r.isNeg) { r = biAdd(r, this.bkplus1); } var rgtem = biCompare(r, this.modulus) >= 0; while (rgtem) { r = biSubtract(r, this.modulus); rgtem = biCompare(r, this.modulus) >= 0; } return r; } function BarrettMu_multiplyMod(x, y) { var xy = biMultiply(x, y); return this.modulo(xy); } function BarrettMu_powMod(x, y) { var result = new BigInt(); result.digits[0] = 1; while (true) { if ((y.digits[0] & 1) != 0) result = this.multiplyMod(result, x); y = biShiftRight(y, 1); if (y.digits[0] == 0 && biHighIndex(y) == 0) break; x = this.multiplyMod(x, x); } return result; } PK!j5j5realtime_stats.jsnu[ function update_chart() { myChart.update(); } function get_server_data() { let get_args = {"graph_type": graph_type}; var jqxhr = $.get("graph_xml.php", get_args, function (data) { jd = JSON.parse(data); myChart.data.labels.push(jd.CURTIME); myChart.data.datasets[0].data.push(jd.BPS_IN); myChart.data.datasets[1].data.push(jd.BPS_OUT); myChart.data.datasets[2].data.push(jd.SSL_BPS_IN); myChart.data.datasets[3].data.push(jd.SSL_BPS_OUT); myChart.data.datasets[4].data.push(jd.PLAINCONN); myChart.data.datasets[5].data.push(jd.SSLCONN); myChart.data.datasets[6].data.push(jd.REQ_PROCESSING); myChart.data.datasets[7].data.push(jd.REQ_PER_SEC); myChart.data.datasets[8].data.push(jd.STATIC_HITS_PER_SEC); myChart.data.datasets[9].data.push(jd.CACHE_HITS_PER_SEC); $('#label_REQ_PROCESSING').text(jd.REQ_PROCESSING); $('#label_REQ_PER_SEC').text(jd.REQ_PER_SEC); $('#label_TOT_REQS').text(jd.TOT_REQS); $('#label_TOTAL_STATIC_HITS').text(jd.TOTAL_STATIC_HITS); $('#label_STATIC_HITS_PER_SEC').text(jd.STATIC_HITS_PER_SEC); $('#label_TOTAL_CACHE_HITS').text(jd.TOTAL_CACHE_HITS); $('#label_CACHE_HITS_PER_SEC').text(jd.CACHE_HITS_PER_SEC); $('#label_TOTAL_PRIVATE_CACHE_HITS').text(jd.TOTAL_PRIVATE_CACHE_HITS); $('#label_PRIVATE_CACHE_HITS_PER_SEC').text(jd.PRIVATE_CACHE_HITS_PER_SEC); $('#label_AVAILCONN').text(jd.AVAILCONN); $('#label_PLAINCONN').text(jd.PLAINCONN); $('#label_MAXCONN').text(jd.MAXCONN); $('#label_AVAILSSL').text(jd.AVAILSSL); $('#label_SSLCONN').text(jd.SSLCONN); $('#label_MAXSSL_CONN').text(jd.MAXSSL_CONN); update_chart(); }) .fail(function () { console.log('AJAX fail'); }); } function get_vh_data() { let get_args = {"graph_type": graph_type, "vhost": vhost}; var jqxhr = $.get("graph_xml.php", get_args, function (data) { jd = JSON.parse(data); myChart.data.labels.push(jd.CURTIME); myChart.data.datasets[0].data.push(jd.REQ_PROCESSING); myChart.data.datasets[1].data.push(jd.REQ_PER_SEC); myChart.data.datasets[2].data.push(jd.STATIC_HITS_PER_SEC); myChart.data.datasets[3].data.push(jd.CACHE_HITS_PER_SEC); myChart.data.datasets[4].data.push(jd.EAP_INUSE); myChart.data.datasets[5].data.push(jd.EAP_IDLE); myChart.data.datasets[6].data.push(jd.EAP_WAITQ); myChart.data.datasets[7].data.push(jd.EAP_REQ_PER_SEC); // EAP_REQ_PER_SEC $('#label_TOTAL_STATIC_HITS').text(jd.TOTAL_STATIC_HITS); $('#label_REQ_PROCESSING').text(jd.REQ_PROCESSING); $('#label_REQ_PER_SEC').text(jd.REQ_PER_SEC); $('#label_TOT_REQS').text(jd.TOT_REQS); $('#label_TOTAL_STATIC_HITS').text(jd.TOTAL_STATIC_HITS); $('#label_STATIC_HITS_PER_SEC').text(jd.STATIC_HITS_PER_SEC); $('#label_TOTAL_CACHE_HITS').text(jd.TOTAL_CACHE_HITS); $('#label_CACHE_HITS_PER_SEC').text(jd.CACHE_HITS_PER_SEC); $('#label_TOTAL_PRIVATE_CACHE_HITS').text(jd.TOTAL_PRIVATE_CACHE_HITS); $('#label_PRIVATE_CACHE_HITS_PER_SEC').text(jd.PRIVATE_CACHE_HITS_PER_SEC); $('#label_EAP_PROCESS').text(jd.EAP_PROCESS); $('#label_PLAINCONN').text(jd.PLAINCONN); $('#label_EAP_INUSE').text(jd.EAP_INUSE); $('#label_EAP_IDLE').text(jd.EAP_IDLE); $('#label_EAP_WAITQ').text(jd.EAP_WAITQ); $('#label_EAP_REQ_PER_SEC').text(jd.EAP_REQ_PER_SEC); update_chart(); }) .fail(function () { console.log('AJAX fail'); }); } function get_extapp_data() { let get_args = {"graph_type": graph_type, "vhost": vhost, "extapp": extapp}; var jqxhr = $.get("graph_xml.php", get_args, function (data) { jd = JSON.parse(data); myChart.data.labels.push(jd.CURTIME); myChart.data.datasets[0].data.push(jd.INUSE_CONN); myChart.data.datasets[1].data.push(jd.IDLE_CONN); myChart.data.datasets[2].data.push(jd.WAITQUEUE_DEPTH); myChart.data.datasets[3].data.push(jd.REQ_PER_SEC); $('#label_CONFIG_MAX_CONN').text(jd.CONFIG_MAX_CONN); $('#label_EFFECT_MAX_CONN').text(jd.EFFECT_MAX_CONN); $('#label_POOL_SIZE').text(jd.POOL_SIZE); $('#label_INUSE_CONN').text(jd.INUSE_CONN); $('#label_IDLE_CONN').text(jd.IDLE_CONN); $('#label_WAITQUEUE_DEPTH').text(jd.WAITQUEUE_DEPTH); $('#label_REQ_PER_SEC').text(jd.REQ_PER_SEC); update_chart(); }) .fail(function () { console.log('AJAX fail'); }); } function reset_interval(graph_type, seconds) { if (graph_type == 'Server') { interval_id = setInterval(get_server_data, seconds * 1000); } else if (graph_type == 'VH') { interval_id = setInterval(get_vh_data, seconds * 1000); } else { // EXTAPP interval_id = setInterval(get_extapp_data, seconds * 1000); } return interval_id; } var ctx = document.getElementById('realtimeChart').getContext('2d'); var data; if (graph_type == 'Server') { data = { labels: [], datasets: [ { label: 'Http In (KB)', data: [], parsing: { yAxisKey: 'BPS_IN' }, borderColor: '#6fe5bf', backgroundColor: '#6fe5bf' }, { label: 'Http Out (KB)', data: [], parsing: { yAxisKey: 'BPS_OUT' }, borderColor: '#f0a00e', backgroundColor: '#f0a00e' }, { label: 'Https In (KB)', data: [], parsing: { yAxisKey: 'SSL_BPS_IN' }, borderColor: '#4c8a4a', backgroundColor: '#4c8a4a' }, { label: 'Https Out (KB)', data: [], parsing: { yAxisKey: 'SSL_BPS_OUT' }, borderColor: '#e7e004', backgroundColor: '#e7e004' }, { label: 'Http Used', data: [], parsing: { yAxisKey: 'PLAINCONN' }, borderColor: '#fd20b9', backgroundColor: '#fd20b9' }, { label: 'Https Used', data: [], parsing: { yAxisKey: 'SSLCONN' }, borderColor: '#c23636', backgroundColor: '#c23636' }, { label: 'Req in Processing', data: [], parsing: { yAxisKey: 'REQ_PROCESSING' }, borderColor: '#70ab44', backgroundColor: '#70ab44' }, { label: 'Req/Sec', data: [], parsing: { yAxisKey: 'REQ_PER_SEC' }, borderColor: '#9628c6', backgroundColor: '#9628c6', }, { label: 'Static Hits/Sec', data: [], parsing: { yAxisKey: 'STATIC_HITS_PER_SEC' }, borderColor: '#a4c6e7', backgroundColor: '#a4c6e7' }, { label: 'Public Cache Hits/Sec', data: [], parsing: { yAxisKey: 'CACHE_HITS_PER_SEC' }, borderColor: '#3f81c3', backgroundColor: '#3f81c3' }] }; } else if (graph_type == 'VH') { data = { labels: [], datasets: [ { label: 'Req in Processing', data: [], parsing: { yAxisKey: 'REQ_PROCESSING' }, borderColor: '#70ab44', backgroundColor: '#70ab44' }, { label: 'Req/Sec', data: [], parsing: { yAxisKey: 'REQ_PER_SEC' }, borderColor: '#9628c6', backgroundColor: '#9628c6' }, { label: 'Static Hits/Sec', data: [], parsing: { yAxisKey: 'STATIC_HITS_PER_SEC' }, borderColor: '#a4c6e7', backgroundColor: '#a4c6e7' }, { label: 'Public Cache Hits/Sec', data: [], parsing: { yAxisKey: 'CACHE_HITS_PER_SEC' }, borderColor: '#3f81c3', backgroundColor: '#3f81c3' }, { label: 'EAProc In Use', data: [], parsing: { yAxisKey: 'EAP_INUSE' }, borderColor: '#009926', backgroundColor: '#009926' }, { label: 'EAProc Idle', data: [], parsing: { yAxisKey: 'EAP_IDLE' }, borderColor: '#f0a00e', backgroundColor: '#f0a00e' }, { label: 'EAProc WaitQ', data: [], parsing: { yAxisKey: 'EAP_WAITQ' }, borderColor: '#d13814', backgroundColor: '#d13814' }, { label: 'EAProc Req/Sec', data: [], parsing: { yAxisKey: 'EAP_REQ_PER_SEC' }, borderColor: '#6808d1', backgroundColor: '#6808d1' }] }; } else if (graph_type == 'EXTAPP') { data = { labels: [], datasets: [ { label: 'In Use Conn', data: [], parsing: { yAxisKey: 'INUSE_CONN' }, borderColor: '#009926', backgroundColor: '#009926' }, { label: 'Idle Conn', data: [], parsing: { yAxisKey: 'IDLE_CONN' }, borderColor: '#f0a00e', backgroundColor: '#f0a00e' }, { label: 'WaitQ', data: [], parsing: { yAxisKey: 'WAITQUEUE_DEPTH' }, borderColor: '#d13814', backgroundColor: '#d13814' }, { label: 'Req/Sec', data: [], parsing: { yAxisKey: 'REQ_PER_SEC' }, borderColor: '#6808d1', backgroundColor: '#6808d1' }] }; } else { console.log('graph_type error'); } var cfg = { type: 'line', data: data, options: { plugins: { title: { display: true, text: graph_title, font: { weight: 'bold', size: 24 } } } } }; var myChart = new Chart(ctx, cfg); $(document).ready(function () { let interval_id = reset_interval(graph_type, 15); // initial default to 15 secs $('#refresh_period').on('change', function (e) { var refresh_val = $('#refresh_period option:selected').val(); switch (refresh_val) { case 'STOP': clearInterval(interval_id); break; case '10': case '15': case '30': case '60': case '120': case '300': clearInterval(interval_id); interval_id = reset_interval(graph_type, refresh_val); break; default: console.log('Error: Invalid SELECT Input:#refresh_period option value: ' + refresh_val); } }); }); PK! 5chart.umd.min.jsnu[/** * Skipped minification because the original files appears to be already minified. * Original file: /npm/chart.js@4.0.1/dist/chart.umd.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ /*! * Chart.js v4.0.1 * https://www.chartjs.org * (c) 2022 Chart.js Contributors * Released under the MIT License */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";function t(){}const e=(()=>{let t=0;return()=>t++})();function i(t){return null==t}function s(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function n(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function o(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function a(t,e){return o(t)?t:e}function r(t,e){return void 0===t?e:t}const l=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function c(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function d(t,e,i,o){let a,r,l;if(s(t))if(r=t.length,o)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;at,x:t=>t.x,y:t=>t.y};function y(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function v(t,e){const i=_[e]||(_[e]=function(t){const e=y(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function M(t){return t.charAt(0).toUpperCase()+t.slice(1)}const w=t=>void 0!==t,k=t=>"function"==typeof t,S=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function P(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const D=Math.PI,C=2*D,O=C+D,A=Number.POSITIVE_INFINITY,T=D/180,L=D/2,E=D/4,R=2*D/3,I=Math.log10,z=Math.sign;function F(t,e,i){return Math.abs(t-e)t-e)).pop(),e}function N(t){return!isNaN(parseFloat(t))&&isFinite(t)}function W(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function H(t,e,i){let s,n,o;for(s=0,n=t.length;sl&&h=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function tt(t,e,i){i=i||(i=>t[i]1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const et=(t,e,i,s)=>tt(t,i,s?s=>{const n=t[s][e];return nt[s][e]tt(t,i,(s=>t[s][e]>=i));function st(t,e,i){let s=0,n=t.length;for(;ss&&t[n-1]>i;)n--;return s>0||n{const i="_onData"+M(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function at(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(nt.forEach((e=>{delete t[e]})),delete t._chartjs)}function rt(t){const e=new Set;let i,s;for(i=0,s=t.length;i{i=!1,t.apply(e,s)})))}}function ct(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const dt=t=>"start"===t?"left":"end"===t?"right":"center",ut=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,ft=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function gt(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:a,_parsed:r}=t,l=a.axis,{min:h,max:c,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(n=Z(Math.min(et(r,a.axis,h).lo,i?s:et(e,l,a.getPixelForValue(h)).lo),0,s-1)),o=u?Z(Math.max(et(r,a.axis,c,!0).hi+1,i?0:et(e,l,a.getPixelForValue(c),!0).hi+1),n,s)-n:s-n}return{start:n,count:o}}function pt(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}class mt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=lt.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var bt=new mt; /*! * @kurkle/color v0.2.1 * https://github.com/kurkle/color#readme * (c) 2022 Jukka Kurkela * Released under the MIT License */function xt(t){return t+.5|0}const _t=(t,e,i)=>Math.max(Math.min(t,i),e);function yt(t){return _t(xt(2.55*t),0,255)}function vt(t){return _t(xt(255*t),0,255)}function Mt(t){return _t(xt(t/2.55)/100,0,1)}function wt(t){return _t(xt(100*t),0,100)}const kt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},St=[..."0123456789ABCDEF"],Pt=t=>St[15&t],Dt=t=>St[(240&t)>>4]+St[15&t],Ct=t=>(240&t)>>4==(15&t);function Ot(t){var e=(t=>Ct(t.r)&&Ct(t.g)&&Ct(t.b)&&Ct(t.a))(t)?Pt:Dt;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const At=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Tt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Lt(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Et(t,e,i){const s=Tt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function Rt(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e>16&255,o>>8&255,255&o]}return t}(),Wt.transparent=[0,0,0,0]);const e=Wt[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const jt=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const $t=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Yt=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Ut(t,e,i){if(t){let s=Rt(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=zt(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function Xt(t,e){return t?Object.assign(e||{},t):t}function qt(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=vt(t[3]))):(e=Xt(t,{r:0,g:0,b:0,a:1})).a=vt(e.a),e}function Kt(t){return"r"===t.charAt(0)?function(t){const e=jt.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?yt(t):_t(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?yt(i):_t(i,0,255)),s=255&(e[4]?yt(s):_t(s,0,255)),n=255&(e[6]?yt(n):_t(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):Vt(t)}class Gt{constructor(t){if(t instanceof Gt)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=qt(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*kt[s[1]],g:255&17*kt[s[2]],b:255&17*kt[s[3]],a:5===o?17*kt[s[4]]:255}:7!==o&&9!==o||(n={r:kt[s[1]]<<4|kt[s[2]],g:kt[s[3]]<<4|kt[s[4]],b:kt[s[5]]<<4|kt[s[6]],a:9===o?kt[s[7]]<<4|kt[s[8]]:255})),i=n||Ht(t)||Kt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Xt(this._rgb);return t&&(t.a=Mt(t.a)),t}set rgb(t){this._rgb=qt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Mt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?Ot(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Rt(t),i=e[0],s=wt(e[1]),n=wt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${Mt(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=i.a-s.a,l=((a*r==-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=Yt(Mt(t.r)),n=Yt(Mt(t.g)),o=Yt(Mt(t.b));return{r:vt($t(s+i*(Yt(Mt(e.r))-s))),g:vt($t(n+i*(Yt(Mt(e.g))-n))),b:vt($t(o+i*(Yt(Mt(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Gt(this.rgb)}alpha(t){return this._rgb.a=vt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=xt(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Ut(this._rgb,2,t),this}darken(t){return Ut(this._rgb,2,-t),this}saturate(t){return Ut(this._rgb,1,t),this}desaturate(t){return Ut(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Rt(t);i[0]=Ft(i[0]+e),i=zt(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Zt(t){return new Gt(t)}function Jt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Qt(t){return Jt(t)?t:Zt(t)}function te(t){return Jt(t)?t:Zt(t).saturate(.5).darken(.1).hexString()}const ee=["x","y","borderWidth","radius","tension"],ie=["color","borderColor","backgroundColor"];const se=new Map;function ne(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=se.get(i);return s||(s=new Intl.NumberFormat(t,e),se.set(i,s)),s}(e,i).format(t)}const oe={values:t=>s(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=I(Math.abs(o)),r=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ne(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(I(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?oe.numeric.call(this,t,e,i):""}};var ae={formatters:oe};const re=Object.create(null),le=Object.create(null);function he(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;et.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>te(e.backgroundColor),this.hoverBorderColor=(t,e)=>te(e.borderColor),this.hoverColor=(t,e)=>te(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ce(this,t,e)}get(t){return he(this,t)}describe(t,e){return ce(le,t,e)}override(t,e){return ce(re,t,e)}route(t,e,i,s){const o=he(this,t),a=he(this,i),l="_"+e;Object.defineProperties(o,{[l]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[l],e=a[s];return n(t)?Object.assign({},e,t):r(t,e)},set(t){this[l]=t}}})}apply(t){t.forEach((t=>t(this)))}}var ue=new de({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ie},numbers:{type:"number",properties:ee}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ae.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function fe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ge(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function pe(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const me=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function be(t,e){return me(t).getPropertyValue(e)}const xe=["top","right","bottom","left"];function _e(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=xe[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function ye(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=me(i),o="border-box"===n.boxSizing,a=_e(n,"padding"),r=_e(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a,r,l=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const ve=t=>Math.round(10*t)/10;function Me(t,e,i,s){const n=me(t),o=_e(n,"margin"),a=pe(n.maxWidth,t,"clientWidth")||A,r=pe(n.maxHeight,t,"clientHeight")||A,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=ge(t);if(o){const t=o.getBoundingClientRect(),a=me(o),r=_e(a,"border","width"),l=_e(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=pe(a.maxWidth,o,"clientWidth"),n=pe(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||A,maxHeight:n||A}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=_e(n,"border","width"),e=_e(n,"padding");h-=e.width+t.width,c-=e.height+t.height}h=Math.max(0,h-o.width),c=Math.max(0,s?Math.floor(h/s):c-o.height),h=ve(Math.min(h,a,l.maxWidth)),c=ve(Math.min(c,r,l.maxHeight)),h&&!c&&(c=ve(h/2));return(void 0!==e||void 0!==i)&&s&&l.height&&c>l.height&&(c=l.height,h=ve(Math.floor(c*s))),{width:h,height:c}}function we(t,e,i){const s=e||1,n=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=n/s,t.width=o/s;const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const ke=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function Se(t,e){const i=be(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Pe(t){return!t||i(t.size)||i(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function De(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function Ce(t,e,i,n){let o=(n=n||{}).data=n.data||{},a=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},a=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const l=i.length;let h,c,d,u,f;for(h=0;hi.length){for(h=0;h0&&t.stroke()}}function Ee(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.xe.top-i&&t.y0&&""!==r.strokeColor;let c,d;for(t.save(),t.font=a.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]);i(e.rotation)||t.rotate(e.rotation);e.color&&(t.fillStyle=e.color);e.textAlign&&(t.textAlign=e.textAlign);e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,r),c=0;ct[0])){w(s)||(s=Qe("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:n,override:n=>He([n,...t],e,i,s)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Xe(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=Qe(Ye(o,t),i),w(n))return Ue(t,n)?Ze(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>ti(t).includes(e),ownKeys:t=>ti(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function je(t,e,i,o){const a={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:$e(t,o),setContext:e=>je(t,e,i,o),override:s=>je(t.override(s),e,i,o)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Xe(t,e,(()=>function(t,e,i){const{_proxy:o,_context:a,_subProxy:r,_descriptors:l}=t;let h=o[e];k(h)&&l.isScriptable(e)&&(h=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t),e=e(o,a||s),r.delete(t),Ue(t,e)&&(e=Ze(n._scopes,n,t,e));return e}(e,h,t,i));s(h)&&h.length&&(h=function(t,e,i,s){const{_proxy:o,_context:a,_subProxy:r,_descriptors:l}=i;if(w(a.index)&&s(t))e=e[a.index%e.length];else if(n(e[0])){const i=e,s=o._scopes.filter((t=>t!==i));e=[];for(const n of i){const i=Ze(s,o,t,n);e.push(je(i,a,r&&r[t],l))}}return e}(e,h,t,l.isIndexable));Ue(e,h)&&(h=je(h,a,r&&r[e],l));return h}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function $e(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:k(i)?i:()=>i,isIndexable:k(s)?s:()=>s}}const Ye=(t,e)=>t?t+M(e):e,Ue=(t,e)=>n(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Xe(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=i();return t[e]=s,s}function qe(t,e,i){return k(t)?t(e,i):t}const Ke=(t,e)=>!0===t?e:"string"==typeof t?v(e,t):void 0;function Ge(t,e,i,s,n){for(const o of e){const e=Ke(i,o);if(e){t.add(e);const o=qe(e._fallback,i,n);if(w(o)&&o!==i&&o!==s)return o}else if(!1===e&&w(s)&&i!==s)return null}return!1}function Ze(t,e,i,o){const a=e._rootScopes,r=qe(e._fallback,i,o),l=[...t,...a],h=new Set;h.add(o);let c=Je(h,l,i,r||i,o);return null!==c&&((!w(r)||r===i||(c=Je(h,l,r,c,o),null!==c))&&He(Array.from(h),[""],a,r,(()=>function(t,e,i){const o=t._getTarget();e in o||(o[e]={});const a=o[e];if(s(a)&&n(i))return i;return a||{}}(e,i,o))))}function Je(t,e,i,s,n){for(;i;)i=Ge(t,e,i,s,n);return i}function Qe(t,e){for(const i of e){if(!i)continue;const e=i[t];if(w(e))return e}}function ti(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function ei(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,h,c;for(r=0,l=s;re"x"===t?"y":"x";function oi(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=X(o,n),l=X(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function ai(t,e="x"){const i=ni(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=si(t,0);for(a=0;a!t.skip))),"monotone"===e.cubicInterpolationMode)ai(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o0===t||1===t,ci=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*C/i),di=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*C/i)+1,ui={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*L),easeOutSine:t=>Math.sin(t*L),easeInOutSine:t=>-.5*(Math.cos(D*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>hi(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>hi(t)?t:ci(t,.075,.3),easeOutElastic:t=>hi(t)?t:di(t,.075,.3),easeInOutElastic(t){const e=.1125;return hi(t)?t:t<.5?.5*ci(2*t,e,.45):.5+.5*di(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-ui.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*ui.easeInBounce(2*t):.5*ui.easeOutBounce(2*t-1)+.5};var fi=ui;function gi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function mi(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=gi(t,n,i),r=gi(n,o,i),l=gi(o,e,i),h=gi(a,r,i),c=gi(r,l,i);return gi(h,c,i)}const bi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,xi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _i(t,e){const i=(""+t).match(bi);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function yi(t,e){const i={},s=n(e),o=s?Object.keys(e):e,a=n(t)?s?i=>r(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=+a(t)||0;return i}function vi(t){return yi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Mi(t){return yi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function wi(t){const e=vi(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function ki(t,e){t=t||{},e=e||ue.font;let i=r(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=r(t.style,e.style);s&&!(""+s).match(xi)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:r(t.family,e.family),lineHeight:_i(r(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:r(t.weight,e.weight),string:""};return n.string=Pe(n),n}function Si(t,e,i,n){let o,a,r,l=!0;for(o=0,a=t.length;oi&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function Di(t,e){return Object.assign(Object.create(t),e)}function Ci(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Oi(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Ai(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Ti(t){return"angle"===t?{between:G,compare:q,normalize:K}:{between:Q,compare:(t,e)=>t-e,normalize:t=>t}}function Li({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function Ei(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=Ti(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=Ti(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;hx||l(n,b,p)&&0!==r(n,b),v=()=>!x||0===r(o,p)||l(o,b,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==b&&(x=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(Li({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,b=p));return null!==_&&g.push(Li({start:_,end:d,loop:u,count:a,style:f})),g}function Ri(t,e){const i=[],s=t.segments;for(let n=0;nn&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);if(!0===s)return zi(t,[{start:a,end:r,loop:o}],i,e);return zi(t,function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r{t[a](e[i],n)&&(o.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))})),s&&!r?[]:o}var Ui={evaluateInteractionItems:Wi,modes:{index(t,e,i,s){const n=ye(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Hi(t,n,o,s,a):$i(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,s){const n=ye(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Hi(t,n,o,s,a):$i(t,n,o,!1,s,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;tHi(t,ye(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=ye(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return $i(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>Yi(t,ye(e,t),"x",i.intersect,s),y:(t,e,i,s)=>Yi(t,ye(e,t),"y",i.intersect,s)}};const Xi=["left","top","right","bottom"];function qi(t,e){return t.filter((t=>t.pos===e))}function Ki(t,e){return t.filter((t=>-1===Xi.indexOf(t.pos)&&t.box.axis===e))}function Gi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Zi(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Xi.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function is(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;ot.box.fullSize)),!0),s=Gi(qi(e,"left"),!0),n=Gi(qi(e,"right")),o=Gi(qi(e,"top"),!0),a=Gi(qi(e,"bottom")),r=Ki(e,"x"),l=Ki(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:qi(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;d(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),f=Object.assign({},n);Qi(f,wi(s));const g=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=Zi(l.concat(h),u);is(r.fullSize,g,u,p),is(l,g,u,p),is(h,g,u,p)&&is(l,g,u,p),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(g),ns(r.leftAndTop,g,u,p),g.x+=g.w,g.y+=g.h,ns(r.rightAndBottom,g,u,p),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},d(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})}))}};class as{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class rs extends as{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ls={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},hs=t=>null===t||""===t;const cs=!!ke&&{passive:!0};function ds(t,e,i){t.canvas.removeEventListener(e,i,cs)}function us(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function fs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||us(i.addedNodes,s),e=e&&!us(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function gs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||us(i.removedNodes,s),e=e&&!us(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const ps=new Map;let ms=0;function bs(){const t=window.devicePixelRatio;t!==ms&&(ms=t,ps.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function xs(t,e,i){const s=t.canvas,n=s&&ge(s);if(!n)return;const o=ht(((t,e)=>{const s=n.clientWidth;i(t,e),s{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return a.observe(n),function(t,e){ps.size||window.addEventListener("resize",bs),ps.set(t,e)}(t,o),a}function _s(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){ps.delete(t),ps.size||window.removeEventListener("resize",bs)}(t)}function ys(t,e,i){const s=t.canvas,n=ht((e=>{null!==t.ctx&&i(function(t,e){const i=ls[t.type]||t.type,{x:s,y:n}=ye(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t.addEventListener(e,i,cs)}(s,e,n),n}class vs extends as{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t.$chartjs={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",hs(n)){const e=Se(t,"width");void 0!==e&&(t.width=e)}if(hs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Se(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const s=e.$chartjs.initial;["height","width"].forEach((t=>{const n=s[t];i(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=s.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:fs,detach:gs,resize:xs}[e]||ys;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:_s,detach:_s,resize:_s}[e]||ds)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Me(t,e,i,s)}isAttached(t){const e=ge(t);return!(!e||!e.isConnected)}}function Ms(t){return!fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?rs:vs}var ws=Object.freeze({__proto__:null,_detectPlatform:Ms,BasePlatform:as,BasicPlatform:rs,DomPlatform:vs});const ks="transparent",Ss={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Qt(t||ks),n=s.valid&&Qt(e||ks);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Ps{constructor(t,e,i,s){const n=e[i];s=Si([t.to,s,n,t.from]);const o=Si([t.from,n,s]);this._active=!0,this._fn=t.fn||Ss[t.type||typeof o],this._easing=fi[t.easing]||fi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Si([t.to,e,s,t.from]),this._from=Si([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t{const a=t[o];if(!n(a))return;const r={};for(const t of e)r[t]=a[t];(s(a.properties)&&a.properties||[o]).forEach((t=>{t!==o&&i.has(t)||i.set(t,r)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new Ps(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(bt.add(this._chart,i),!0):void 0}}function Cs(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function Os(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n0||!i&&e<0)return n.index}return null}function Rs(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;ti[t].axis===e)).shift()}function zs(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i]}}}const Fs=t=>"reset"===t||"none"===t,Vs=(t,e)=>e?t:Object.assign({},t);class Bs{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ts(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&zs(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=r(i.xAxisID,Is(t,"x")),o=e.yAxisID=r(i.yAxisID,Is(t,"y")),a=e.rAxisID=r(i.rAxisID,Is(t,"r")),l=e.indexAxis,h=e.iAxisID=s(l,n,o,a),c=e.vAxisID=s(l,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&at(this._data,this),t._stacked&&zs(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(n(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=o,i._sorted=!0,d=o;else{d=s(o[t])?this.parseArrayData(i,o,t,e):n(o[t])?this.parseObjectData(i,o,t,e):this.parsePrimitiveData(i,o,t,e);const a=()=>null===c[l]||f&&c[l]t&&!e.hidden&&e._stacked&&{keys:Os(i,!0),values:null})(e,i,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let u,f;function g(){f=s[u];const e=f[r.axis];return!o(f[t.axis])||c>e||d=0;--u)if(!g()){this.updateRangeFromParsed(h,t,f,l);break}return h}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,a;for(s=0,n=e.length;s=0&&tthis.getContext(i,s)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Vs(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new Ds(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Fs(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Fs(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Fs(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}function Ws(t,e){const s=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=Math.min(s.maxTicksLimit||n,n),a=s.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;io)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;nn)return e}return Math.max(n,1)}(a,e,o);if(r>0){let t,s;const n=r>1?Math.round((h-l)/(r-1)):null;for(Hs(e,c,d,i(n)?0:l-n,l),t=0,s=r-1;t"top"===e||"left"===e?t[e]+i:t[e]-i;function $s(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;oa+r)))return h}function Us(t){return t.drawTicks?t.tickLength:0}function Xs(t,e){if(!t.display)return 0;const i=ki(t.font,e),n=wi(t.padding);return(s(t.text)?t.text.length:1)*i.lineHeight+n.height}function qs(t,e,i){let s=dt(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class Ks extends Ns{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=a(t,Number.POSITIVE_INFINITY),e=a(e,Number.NEGATIVE_INFINITY),i=a(i,Number.POSITIVE_INFINITY),s=a(s,Number.NEGATIVE_INFINITY),{min:a(t,i),max:a(e,s),minDefined:o(t),maxDefined:o(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;as?s:i,s=n&&i>s?i:s,{min:a(i,a(s,i)),max:a(s,a(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){c(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Pi(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Z(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Us(t.grid)-e.padding-Xs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=$(Math.min(Math.asin(Z((h.highest.height+6)/o,-1,1)),Math.asin(Z(a/r,-1,1))-Math.asin(Z(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){c(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){c(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Xs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Us(n)+o):(t.height=this.maxHeight,t.width=Us(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=j(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){c(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,s;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,s=t.length;e{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n({width:a[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(M),highest:k(w),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return J(this._alignToPixels?Oe(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:r/s:r*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:a,border:l}=s,h=o.offset,c=this.isHorizontal(),d=this.ticks.length+(h?1:0),u=Us(o),f=[],g=l.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,b=function(t){return Oe(i,t,p)};let x,_,y,v,M,w,k,S,P,D,C,O;if("top"===a)x=b(this.bottom),w=this.bottom-u,S=x-m,D=b(t.top)+m,O=t.bottom;else if("bottom"===a)x=b(this.top),D=t.top,O=b(t.bottom)-m,w=x+m,S=this.top+u;else if("left"===a)x=b(this.right),M=this.right-u,k=x-m,P=b(t.left)+m,C=t.right;else if("right"===a)x=b(this.left),P=t.left,C=b(t.right)-m,M=x+m,k=this.left+u;else if("x"===e){if("center"===a)x=b((t.top+t.bottom)/2+.5);else if(n(a)){const t=Object.keys(a)[0],e=a[t];x=b(this.chart.scales[t].getPixelForValue(e))}D=t.top,O=t.bottom,w=x+m,S=w+u}else if("y"===e){if("center"===a)x=b((t.left+t.right)/2);else if(n(a)){const t=Object.keys(a)[0],e=a[t];x=b(this.chart.scales[t].getPixelForValue(e))}M=x-m,k=M-u,P=t.left,C=t.right}const A=r(s.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/A));for(_=0;_e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");ue.route(o,n,l,r)}))}(e,t.defaultRoutes);t.descriptors&&ue.describe(e,t.descriptors)}(t,o,i),this.override&&ue.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ue[s]&&(delete ue[s][i],this.override&&delete re[i])}}class Zs{constructor(){this.controllers=new Gs(Bs,"datasets",!0),this.elements=new Gs(Ns,"elements"),this.plugins=new Gs(Object,"plugins"),this.scales=new Gs(Ks,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):d(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=M(t);c(i["before"+s],[],i),e[t](i),c(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;et.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function tn(t,e){return e||!1!==t?!0===t?{}:t:null}function en(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(s,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function sn(t,e){const i=ue.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function nn(t,e){if("x"===t||"y"===t||"r"===t)return t;var i;if(t=e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&nn(t[0].toLowerCase(),e))return t;throw new Error(`Cannot determine type of '${name}' axis. Please provide 'axis' or 'position' option.`)}function on(t){const e=t.options||(t.options={});e.plugins=r(e.plugins,{}),e.scales=function(t,e){const i=re[t.type]||{scales:{}},s=e.scales||{},o=sn(t.type,e),a=Object.create(null);return Object.keys(s).forEach((t=>{const e=s[t];if(!n(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const r=nn(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(r,o),h=i.scales||{};a[t]=b(Object.create(null),[{axis:r},e,h[r],h[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||sn(n,e),r=(re[n]||{}).scales||{};Object.keys(r).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),b(a[n],[{axis:e},s[n],r[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];b(e,[ue.scales[e.type],ue.scale])})),a}(t,e)}function an(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const rn=new Map,ln=new Set;function hn(t,e){let i=rn.get(t);return i||(i=e(),rn.set(t,i),ln.add(i)),i}const cn=(t,e,i)=>{const s=v(e,i);void 0!==s&&t.add(s)};class dn{constructor(t){this._config=function(t){return(t=t||{}).data=an(t.data),on(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=an(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),on(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return hn(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return hn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return hn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return hn(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>cn(r,t,e)))),e.forEach((t=>cn(r,s,t))),e.forEach((t=>cn(r,re[n]||{},t))),e.forEach((t=>cn(r,ue,t))),e.forEach((t=>cn(r,le,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),ln.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,re[e]||{},ue.datasets[e]||{},{type:e},ue,le]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=un(this._resolverCache,t,n);let l=a;if(function(t,e){const{isScriptable:i,isIndexable:n}=$e(t);for(const o of e){const e=i(o),a=n(o),r=(a||e)&&t[o];if(e&&(k(r)||fn(r))||a&&s(r))return!0}return!1}(a,e)){o.$shared=!1;l=je(a,i=k(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=l[t];return o}createResolver(t,e,i=[""],s){const{resolver:o}=un(this._resolverCache,t,i);return n(e)?je(o,e,void 0,s):o}}function un(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);if(!o){o={resolver:He(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)}return o}const fn=t=>n(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||k(t[i])),!1);const gn=["top","bottom","left","right","chartArea"];function pn(t,e){return"top"===t||"bottom"===t||-1===gn.indexOf(t)&&"x"===e}function mn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function bn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),c(i&&i.onComplete,[t],e)}function xn(t){const e=t.chart,i=e.options.animation;c(i&&i.onProgress,[t],e)}function _n(t){return fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const yn={},vn=t=>{const e=_n(t);return Object.values(yn).filter((t=>t.canvas===e)).pop()};function Mn(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class wn{static defaults=ue;static instances=yn;static overrides=re;static registry=Js;static version="4.0.1";static getChart=vn;static register(...t){Js.add(...t),kn()}static unregister(...t){Js.remove(...t),kn()}constructor(t,i){const s=this.config=new dn(i),n=_n(t),o=vn(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ms(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,h=l&&l.height,c=l&&l.width;this.id=e(),this.ctx=r,this.canvas=l,this.width=c,this.height=h,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Qs,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ct((t=>this.update(t)),a.resizeDelay||0),this._dataChanges=[],yn[this.id]=this,r&&l?(bt.listen(this,"complete",bn),bt.listen(this,"progress",xn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return i(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Js}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():we(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ae(this.canvas,this.ctx),this}stop(){return bt.stop(this),this}resize(t,e){bt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,we(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),c(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){d(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=nn(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),d(n,(e=>{const n=e.options,o=n.id,a=nn(o,n),l=r(n.type,e.dtype);void 0!==n.position&&pn(n.position,a)===pn(e.dposition)||(n.position=e.dposition),s[o]=!0;let h=null;if(o in i&&i[o].type===l)h=i[o];else{h=new(Js.getScale(l))({id:o,type:l,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(n,t)})),d(s,((t,e)=>{t||delete i[e]})),d(i,(t=>{os.configure(this,t,t.options),os.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(mn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){d(this.scales,(t=>{os.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);S(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){Mn(t,s,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;tt.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;os.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],d(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,n=function(t){const{xScale:e,yScale:i}=t;if(e&&i)return{left:e.left,right:e.right,top:i.top,bottom:i.bottom}}(t)||this.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(s&&Re(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&Ie(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return Ee(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Ui.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Di(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);w(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),bt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};d(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){d(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},d(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!u(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=P(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,c(n.onHover,[t,a,this],this),r&&c(n.onClick,[t,a,this],this));const h=!u(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function kn(){return d(wn.instances,(t=>t._plugins.invalidate()))}var Sn=wn;function Pn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Dn{static override(t){Object.assign(Dn.prototype,t)}constructor(t){this.options=t||{}}init(){}formats(){return Pn()}parse(){return Pn()}format(){return Pn()}add(){return Pn()}diff(){return Pn()}startOf(){return Pn()}endOf(){return Pn()}}var Cn={_date:Dn};function On(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;et-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(w(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;sMath.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function Tn(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;ht.x,i="left",s="right"):(e=t.base"spacing"!==t,_indexable:t=>"spacing"!==t};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let o,a,r=t=>+i[t];if(n(i[t])){const{key:t="value"}=this._parsing;r=e=>+v(i[e],t)}for(o=t,a=t+e;oG(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>G(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(L,c,u),b=g(D,h,d),x=g(D+L,c,u);s=(p-b)/2,n=(m-x)/2,o=-(p+b)/2,a=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),b=(i.width-o)/f,x=(i.height-o)/g,_=Math.max(Math.min(b,x)/2,0),y=h(this.options.radius,_),v=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=m*y,s.total=this.calculateTotal(),this.outerRadius=y-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*c,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/C)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:g}=this._getSharedOptions(e,s);let p,m=this._getRotation();for(p=0;p0&&!isNaN(t)?C*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;st.controller.options.grouped)),o=s.options.stacked,a=[],r=t=>{const s=t.controller.getParsed(e),n=s&&s[t.vScale.axis];if(i(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!r(i))&&((!1===o||-1===a.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&a.push(i.stack),i.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n=i?1:-1)}(d,e,a)*o,u===a&&(m-=d/2);const t=e.getPixelForDecimal(0),i=e.getPixelForDecimal(1),s=Math.min(t,i),n=Math.max(t,i);m=Math.max(Math.min(m,n),s),c=m+d}if(m===e.getPixelForValue(a)){const t=z(d)*e.getLineWidthForValue(a)/2;m+=t,d-=t}return{size:d,base:m,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,a=r(n.maxBarThickness,1/0);let l,h;if(e.grouped){const s=o?this._getStackCount(t):e.stackCount,r="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:i[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),h=o.axis,c=a.axis;for(let d=e;d0&&this.getParsed(e-1);for(let s=0;s<_;++s){const g=t[s],_=b?g:{};if(s=x){_.skip=!0;continue}const v=this.getParsed(s),M=i(v[f]),w=_[u]=a.getPixelForValue(v[u],s),k=_[f]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,v,l):v[f],s);_.skip=isNaN(w)||isNaN(k)||M,_.stop=s>0&&Math.abs(v[u]-y[u])>m,p&&(_.parsed=v,_.raw=h.data[s]),d&&(_.options=c||this.resolveDataElementOptions(s,g.active?"active":n)),b||this.updateElement(g,s,_,n),y=v}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PolarAreaController:class extends Bs{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return ei.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,h=r.yCenter,c=r.getIndexAngle(0)-.5*D;let d,u=c;const f=360/this.countVisibleElements();for(d=0;d{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?j(this.resolveDataElementOptions(t,e).angle||i):0}},PieController:class extends Fn{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},RadarController:class extends Bs{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ei.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let a=e;a0&&this.getParsed(e-1);for(let c=e;c0&&Math.abs(s[f]-_[f])>b,m&&(p.parsed=s,p.raw=h.data[c]),u&&(p.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),x||this.updateElement(e,c,p,n),_=s}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}});function Bn(t,e,i,s){const n=yi(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return Z(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Z(n.innerStart,0,a),innerEnd:Z(n.innerEnd,0,a)}}function Nn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Wn(t,e,i,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),u=c>0?c+s+i+h:0;let f=0;const g=n-l;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;f=(g-(0!==t?g*t/(t+s):g))/2}const p=(g-Math.max(.001,g*d-i/D)/d)/2,m=l+p+f,b=n-p-f,{outerStart:x,outerEnd:_,innerStart:y,innerEnd:v}=Bn(e,u,d,b-m),M=d-x,w=d-_,k=m+x/M,S=b-_/w,P=u+y,C=u+v,O=m+y/P,A=b-v/C;if(t.beginPath(),o){const e=(k+S)/2;if(t.arc(a,r,d,k,e),t.arc(a,r,d,e,S),_>0){const e=Nn(w,S,a,r);t.arc(e.x,e.y,_,S,b+L)}const i=Nn(C,b,a,r);if(t.lineTo(i.x,i.y),v>0){const e=Nn(C,A,a,r);t.arc(e.x,e.y,v,b+L,A+Math.PI)}const s=(b-v/u+(m+y/u))/2;if(t.arc(a,r,u,b-v/u,s,!0),t.arc(a,r,u,s,m+y/u,!0),y>0){const e=Nn(P,O,a,r);t.arc(e.x,e.y,y,O+Math.PI,m-L)}const n=Nn(M,m,a,r);if(t.lineTo(n.x,n.y),x>0){const e=Nn(M,k,a,r);t.arc(e.x,e.y,x,m-L,k)}}else{t.moveTo(a,r);const e=Math.cos(k)*d+a,i=Math.sin(k)*d+r;t.lineTo(e,i);const s=Math.cos(S)*d+a,n=Math.sin(S)*d+r;t.lineTo(s,n)}t.closePath()}function Hn(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c}=l,d="inner"===l.borderAlign;if(!h)return;d?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let u=e.endAngle;if(o){Wn(t,e,i,s,u,n);for(let e=0;en?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+L,s-L),t.closePath(),t.clip()}(t,e,u),o||(Wn(t,e,i,s,u,n),t.stroke())}function jn(t,e,i=e){t.lineCap=r(i.borderCapStyle,e.borderCapStyle),t.setLineDash(r(i.borderDash,e.borderDash)),t.lineDashOffset=r(i.borderDashOffset,e.borderDashOffset),t.lineJoin=r(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=r(i.borderWidth,e.borderWidth),t.strokeStyle=r(i.borderColor,e.borderColor)}function $n(t,e,i){t.lineTo(i.x,i.y)}function Yn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),h=Math.min(o,r),c=nr&&o>r;return{count:s,start:l,loop:e.loop,ilen:h(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[x(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[x(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(ig&&(g=i),m=(b*m+e)/++b):(_(),t.lineTo(e,i),u=s,b=0,f=g=i),p=i}_()}function qn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?Xn:Un}const Kn="function"==typeof Path2D;function Gn(t,e,i,s){Kn&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),jn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=qn(e);for(const r of n)jn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class Zn extends Ns{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;li(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ii(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Ri(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?pi:t.tension||"monotone"===t.cubicInterpolationMode?mi:gi}(i);let l,h;for(l=0,h=o.length;l=C||G(n,a,l),g=Q(o,h+u,c+u);return f&&g}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>C?Math.floor(i/C):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const r=s*(1-Math.sin(Math.min(D,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){Wn(t,e,i,s,l,n);for(let e=0;et.replace("rgb(","rgba(").replace(")",", 0.5)")));function lo(t){return ao[t%ao.length]}function ho(t){return ro[t%ro.length]}function co(t){return"doughnut"===t||"pie"===t?function(){let t=0;return e=>{e.backgroundColor=e.data.map((()=>lo(t++)))}}():"polarArea"===t?function(){let t=0;return e=>{e.backgroundColor=e.data.map((()=>ho(t++)))}}():(t,e)=>{t.borderColor=lo(e),t.backgroundColor=ho(e)}}function uo(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var fo={id:"colors",defaults:{enabled:!0},beforeLayout(t,e,i){if(!i.enabled)return;const{type:s,options:{elements:n},data:{datasets:o}}=t.config;if(uo(o)||n&&uo(n))return;const a=co(s);o.forEach(a)}};function go(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e})}}function po(t){t.data.datasets.forEach((t=>{go(t)}))}var mo={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,s)=>{if(!s.enabled)return void po(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:a,indexAxis:r}=e,l=t.getDatasetMeta(o),h=a||e.data;if("y"===Si([r,t.options.indexAxis]))return;if(!l.controller.supportsDecimation)return;const c=t.scales[l.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:d,count:u}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=Z(et(e,o.axis,a).lo,0,i-1)),s=h?Z(et(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(l,h);if(u<=(s.threshold||4*n))return void go(e);let f;switch(i(a)&&(e._data=h,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),s.algorithm){case"lttb":f=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;cu&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(h,d,u,n,s);break;case"min-max":f=function(t,e,s,n){let o,a,r,l,h,c,d,u,f,g,p=0,m=0;const b=[],x=e+s-1,_=t[e].x,y=t[x].x-_;for(o=e;og&&(g=l,d=o),p=(m*p+a.x)/++m;else{const s=o-1;if(!i(c)&&!i(d)){const e=Math.min(c,d),i=Math.max(c,d);e!==u&&e!==s&&b.push({...t[e],x:p}),i!==u&&i!==s&&b.push({...t[i],x:p})}o>0&&s!==u&&b.push(t[s]),b.push(a),h=e,m=0,f=g=l,c=d=u=o}}return b}(h,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${s.algorithm}'`)}e._decimated=f}))},destroy(t){po(t)}};function bo(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=K(n),o=K(o)),{property:t,start:n,end:o}}function xo(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function _o(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function yo(t,e){let i=[],n=!1;return s(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=xo(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new Zn({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function vo(t){return t&&!1!==t.fill}function Mo(t,e,i){let s=t[e].fill;const n=[e];let a;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!o(s))return s;if(a=t[s],!a)return!1;if(a.visible)return s;n.push(s),s=a.fill}return!1}function wo(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=r(i&&i.target,i);void 0===s&&(s=!!e.backgroundColor);if(!1===s||null===s)return!1;if(!0===s)return"origin";return s}(t);if(n(s))return!isNaN(s.value)&&s;let a=parseFloat(s);return o(a)&&Math.floor(a)===a?function(t,e,i,s){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=s)return!1;return i}(s[0],e,a,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function ko(t,e,i){const s=[];for(let n=0;n=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&Co(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;vo(i)&&Co(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;vo(s)&&"beforeDatasetDraw"===i.drawTime&&Co(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Ro=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class Io extends Ns{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=c(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=ki(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=Ro(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,s,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,o)=>{const{itemWidth:p,itemHeight:m}=function(t,e,i,s,n){const o=function(t,e,i,s){let n=t.text;n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+s.measureText(n).width}(s,t,e,i),a=function(t,e,i){let s=t;"string"!=typeof e.text&&(s=zo(e,i));return s}(n,s,e.lineHeight);return{itemWidth:o,itemHeight:a}}(i,e,n,t,s);o>0&&u+m+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:m},d=Math.max(d,p),u+=m+a})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=Ci(n,this.left,this.width);if(this.isHorizontal()){let n=0,a=ut(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,a=ut(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=o.leftForLtr(o.x(a),r.width),a+=r.width+s}else{let n=0,a=ut(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,a=ut(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=a,r.left+=this.left+s,r.left=o.leftForLtr(o.x(r.left),r.width),a+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Re(t,this),this._draw(),Ie(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,a=ue.color,l=Ci(t.rtl,this.left,this.width),h=ki(o.font),{padding:c}=o,d=h.size,u=d/2;let f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=h.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=Ro(o,d),b=this.isHorizontal(),x=this._computeTitleHeight();f=b?{x:ut(n,this.left+c,this.right-i[0]),y:this.top+c+x,line:0}:{x:this.left+c,y:ut(n,this.top+x+c,this.bottom-e[0].height),line:0},Oi(this.ctx,t.textDirection);const _=m+c;this.legendItems.forEach(((y,v)=>{s.strokeStyle=y.fontColor,s.fillStyle=y.fontColor;const M=s.measureText(y.text).width,w=l.textAlign(y.textAlign||(y.textAlign=o.textAlign)),k=g+u+M;let S=f.x,P=f.y;l.setWidth(this.width),b?v>0&&S+k+c>this.right&&(P=f.y+=_,f.line++,S=f.x=ut(n,this.left+c,this.right-i[f.line])):v>0&&P+_>this.bottom&&(S=f.x=S+e[f.line].width+c,f.line++,P=f.y=ut(n,this.top+x+c,this.bottom-e[f.line].height));if(function(t,e,i){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const n=r(i.lineWidth,1);if(s.fillStyle=r(i.fillStyle,a),s.lineCap=r(i.lineCap,"butt"),s.lineDashOffset=r(i.lineDashOffset,0),s.lineJoin=r(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=r(i.strokeStyle,a),s.setLineDash(r(i.lineDash,[])),o.usePointStyle){const a={radius:p*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},r=l.xPlus(t,g/2);Le(s,a,r,e+u,o.pointStyleWidth&&g)}else{const o=e+Math.max((d-p)/2,0),a=l.leftForLtr(t,g),r=Mi(i.borderRadius);s.beginPath(),Object.values(r).some((t=>0!==t))?We(s,{x:a,y:o,w:g,h:p,radius:r}):s.rect(a,o,g,p),s.fill(),0!==n&&s.stroke()}s.restore()}(l.x(S),P,y),S=ft(w,S+g+u,b?S+k:this.right,t.rtl),function(t,e,i){Ve(s,i.text,t,e+m/2,h,{strikethrough:i.hidden,textAlign:l.textAlign(i.textAlign)})}(l.x(S),P,y),b)f.x+=k+c;else if("string"!=typeof y.text){const t=h.lineHeight;f.y+=zo(y,t)}else f.y+=_})),Ai(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=ki(e.font),s=wi(e.padding);if(!e.display)return;const n=Ci(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=ut(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);h=l+ut(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=ut(a,c,c+d);o.textAlign=n.textAlign(dt(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Ve(o,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=ki(t.font),i=wi(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(Q(t,this.left,this.right)&&Q(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),h=wi(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:a&&(r||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Vo extends Ns{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=s(i.text)?i.text.length:1;this._padding=wi(i.padding);const o=n*ki(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,a=o.align;let r,l,h,c=0;return this.isHorizontal()?(l=ut(a,i,n),h=e+t,r=n-i):("left"===o.position?(l=i+t,h=ut(a,s,e),c=-.5*D):(l=n-t,h=ut(a,e,s),c=.5*D),r=s-e),{titleX:l,titleY:h,maxWidth:r,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=ki(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(s);Ve(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:r,textAlign:dt(e.align),textBaseline:"middle",translation:[n,o]})}}var Bo={id:"title",_element:Vo,start(t,e,i){!function(t,e){const i=new Vo({ctx:t.ctx,options:e,chart:t});os.configure(t,i,e),os.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;os.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;os.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const No=new WeakMap;var Wo={id:"subtitle",start(t,e,i){const s=new Vo({ctx:t.ctx,options:i,chart:t});os.configure(t,s,i),os.addBox(t,s),No.set(t,s)},stop(t){os.removeBox(t,No.get(t)),No.delete(t)},beforeUpdate(t,e,i){const s=No.get(t);os.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ho={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e-1?t.split("\n"):t}function Yo(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Uo(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=ki(e.bodyFont),h=ki(e.titleFont),c=ki(e.footerFont),u=o.length,f=n.length,g=s.length,p=wi(e.padding);let m=p.height,b=0,x=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(x+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*h.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),x){m+=g*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(x-g)*l.lineHeight+(x-1)*e.bodySpacing}f&&(m+=e.footerMarginTop+f*c.lineHeight+(f-1)*e.footerSpacing);let _=0;const y=function(t){b=Math.max(b,i.measureText(t).width+_)};return i.save(),i.font=h.string,d(t.title,y),i.font=l.string,d(t.beforeBody.concat(t.afterBody),y),_=e.displayColors?a+2+e.boxPadding:0,d(s,(t=>{d(t.before,y),d(t.lines,y),d(t.after,y)})),_=0,i.font=c.string,d(t.footer,y),i.restore(),b+=p.width,{width:b,height:m}}function Xo(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function qo(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||Xo(t,e,i,s),yAlign:s}}function Ko(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=Mi(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Z(g,0,s.width-e.width),y:Z(p,0,s.height-e.height)}}function Go(t,e,i){const s=wi(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Zo(t){return jo([],$o(t))}function Jo(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const Qo={beforeTitle:t,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex{const e={before:[],lines:[],after:[]},n=Jo(i,t);jo(e.before,$o(ta(n,"beforeLabel",this,t))),jo(e.lines,ta(n,"label",this,t)),jo(e.after,$o(ta(n,"afterLabel",this,t))),s.push(e)})),s}getAfterBody(t,e){return Zo(ta(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=ta(i,"beforeFooter",this,t),n=ta(i,"footer",this,t),o=ta(i,"afterFooter",this,t);let a=[];return a=jo(a,$o(s)),a=jo(a,$o(n)),a=jo(a,$o(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;at.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),d(l,(e=>{const i=Jo(t.callbacks,e);s.push(ta(i,"labelColor",this,e)),n.push(ta(i,"labelPointStyle",this,e)),o.push(ta(i,"labelTextColor",this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Ho[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Uo(this,i),a=Object.assign({},t,e),r=qo(this.chart,i,a),l=Ko(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=Mi(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,b,x,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,x=_+o,y=_-o):(p=d+f,m=p+o,x=_-o,y=_+o),b=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(x=u,_=x-o,p=m-o,b=m+o):(x=u+g,_=x+o,p=m+o,b=m-o),y=x),{x1:p,x2:m,x3:b,y1:x,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=Ci(i.rtl,this.x,this.width);for(t.x=Go(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=ki(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,We(t,{x:e,y:p,w:h,h:l,radius:r}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),We(t,{x:i,y:p+1,w:h-2,h:l-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,h,l),t.strokeRect(e,p,h,l),t.fillStyle=a.backgroundColor,t.fillRect(i,p+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=ki(i.bodyFont);let u=c.lineHeight,f=0;const g=Ci(i.rtl,this.x,this.width),p=function(i){e.fillText(i,g.x(t.x+f),t.y+u/2),t.y+=u+n},m=g.textAlign(o);let b,x,_,y,v,M,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Go(this,m,i),e.fillStyle=i.bodyColor,d(this.beforeBody,p),f=a&&"right"!==m?"center"===o?l/2+h:l+2+h:0,y=0,M=s.length;y0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Ho[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Uo(this,t),a=Object.assign({},i,this._size),r=qo(e,t,a),l=Ko(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=wi(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Oi(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Ai(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!u(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!u(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Ho[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}var ia={id:"tooltip",_element:ea,positioners:Ho,afterInit(t,e,i){i&&(t.tooltip=new ea({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Qo},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},sa=Object.freeze({__proto__:null,Colors:fo,Decimation:mo,Filler:Eo,Legend:Fo,SubTitle:Wo,Title:Bo,Tooltip:ia});function na(t,e,i,s){const n=t.indexOf(e);if(-1===n)return((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return n!==t.lastIndexOf(e)?i:n}function oa(t){const e=this.getLabels();return t>=0&&ts=e?s:t,a=t=>n=i?n:t;if(t){const t=z(s),e=z(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n=function(t,e){const s=[],{bounds:n,step:o,min:a,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=t,f=o||1,g=c-1,{min:p,max:m}=e,b=!i(a),x=!i(r),_=!i(h),y=(m-p)/(d+1);let v,M,w,k,S=V((m-p)/g/f)*f;if(S<1e-14&&!b&&!x)return[{value:p},{value:m}];k=Math.ceil(m/S)-Math.floor(p/S),k>g&&(S=V(k*S/g/f)*f),i(l)||(v=Math.pow(10,l),S=Math.ceil(S*v)/v),"ticks"===n?(M=Math.floor(p/S)*S,w=Math.ceil(m/S)*S):(M=p,w=m),b&&x&&o&&W((r-a)/o,S/1e3)?(k=Math.round(Math.min((r-a)/S,c)),S=(r-a)/k,M=a,w=r):_?(M=b?a:M,w=x?r:w,k=h-1,S=(w-M)/k):(k=(w-M)/S,k=F(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const P=Math.max(Y(S),Y(M));v=Math.pow(10,i(l)?P:l),M=Math.round(M*v)/v,w=Math.round(w*v)/v;let D=0;for(b&&(u&&M!==a?(s.push({value:a}),MMath.floor(I(t)),ca=(t,e)=>Math.pow(10,ha(t)+e);function da(t){return 1===t/Math.pow(10,ha(t))}function ua(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}function fa(t,{min:e,max:i}){e=a(t.min,e);const s=[],n=ha(e);let o=function(t,e){let i=ha(e-t);for(;ua(t,e,i)>10;)i++;for(;ua(t,e,i)<10;)i--;return Math.min(i,ha(t))}(e,i),r=o<0?Math.pow(10,Math.abs(o)):1;const l=Math.pow(10,o),h=n>o?Math.pow(10,n):0,c=Math.round((e-h)*r)/r,d=Math.floor((e-h)/l/10)*l*10;let u=Math.floor((c-d)/Math.pow(10,o)),f=a(t.min,Math.round((h+d+u*Math.pow(10,o))*r)/r);for(;f=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,r=o>=0?1:r),f=Math.round((h+d+u*Math.pow(10,o))*r)/r;const g=a(t.max,f);return s.push({value:g,major:da(g),significand:u}),s}class ga extends Ks{static id="logarithmic";static defaults={ticks:{callback:ae.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=ra.prototype.parse.apply(this,[t,e]);if(0!==i)return o(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=o(t)?Math.max(0,t):null,this.max=o(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!o(this._userMin)&&(this.min=t===ca(this.min,0)?ca(this.min,-1):ca(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t;i===s&&(i<=0?(n(1),o(10)):(n(ca(i,-1)),o(ca(s,1)))),i<=0&&n(ca(s,-1)),s<=0&&o(ca(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=fa({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&H(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":ne(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=I(t),this._valueRange=I(this.max)-I(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(I(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function pa(t){const e=t.ticks;if(e.display&&t.display){const t=wi(e.backdropPadding);return r(e.font&&e.font.size,ue.font.size)+t.height}return 0}function ma(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:tn?{start:e-i,end:e}:{start:e,end:e+i}}function ba(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],a=t._pointLabels.length,r=t.options.pointLabels,l=r.centerPointLabels?D/a:0;for(let u=0;ue.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.starte.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function _a(t){return 0===t||180===t?"center":t<180?"left":"right"}function ya(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function va(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function Ma(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,C);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;ot,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=wi(pa(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=o(t)&&!isNaN(t)?t:0,this.max=o(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/pa(this.options))}generateTickLabels(t){ra.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=c(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?ba(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return K(t*(C/(this._pointLabels.length||1))+j(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(i(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(i(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t=0;o--){const e=n.setContext(t.getPointLabelContext(o)),a=ki(e.font),{x:r,y:l,textAlign:h,left:c,top:d,right:u,bottom:f}=t._pointLabelItems[o],{backdropColor:g}=e;if(!i(g)){const t=Mi(e.borderRadius),i=wi(e.backdropPadding);s.fillStyle=g;const n=c-i.left,o=d-i.top,a=u-c+i.width,r=f-d+i.height;Object.values(t).some((t=>0!==t))?(s.beginPath(),We(s,{x:n,y:o,w:a,h:r,radius:t}),s.fill()):s.fillRect(n,o,a,r)}Ve(s,t._pointLabels[o],r,l+a.lineHeight/2,a,{color:e.color,textAlign:h,textBaseline:"middle"})}}(this,a),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e){l=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),s=n.setContext(i),r=o.setContext(i);!function(t,e,i,s,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!s||!r||!l||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash),o.lineDashOffset=n.dashOffset,o.beginPath(),Ma(t,i,a,s),o.closePath(),o.stroke(),o.restore())}(this,s,l,a,r)}})),s.display){for(t.save(),r=a-1;r>=0;r--){const i=s.setContext(this.getPointLabelContext(r)),{color:n,lineWidth:o}=i;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(i.borderDash),t.lineDashOffset=i.borderDashOffset,l=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),h=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(h.x,h.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=ki(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=wi(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}Ve(t,s.label,0,-n,l,{color:r.color})})),t.restore()}drawTitle(){}}const ka={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Sa=Object.keys(ka);function Pa(t,e){return t-e}function Da(t,e){if(i(e))return null;const s=t._adapter,{parser:n,round:a,isoWeekday:r}=t._parseOpts;let l=e;return"function"==typeof n&&(l=n(l)),o(l)||(l="string"==typeof n?s.parse(l,n):s.parse(l)),null===l?null:(a&&(l="week"!==a||!N(r)&&!0!==r?s.startOf(l,a):s.startOf(l,"isoWeek",r)),+l)}function Ca(t,e,i,s){const n=Sa.length;for(let o=Sa.indexOf(t);o=e?i[s]:i[n]]=!0}}else t[e]=!0}function Aa(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a=0&&(e[l].major=!0);return e}(t,s,n,i):s}class Ta extends Ks{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new Cn._date(t.adapters.date);s.init(e),b(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Da(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:a,maxDefined:r}=this.getUserBounds();function l(t){a||isNaN(t.min)||(s=Math.min(s,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}a&&r||(l(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||l(this.getMinMax(!1))),s=o(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=o(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=st(s,n,this.max);return this._unit=e.unit||(i.autoSkip?Ca(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=Sa.length-1;o>=Sa.indexOf(i);o--){const i=Sa[o];if(ka[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return Sa[i?Sa.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=Sa.indexOf(t)+1,i=Sa.length;e+t.value)))}initOffsets(t=[]){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=Z(s,0,o),n=Z(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||Ca(n.minUnit,e,i,this._getLabelCapacity(e)),a=r(s.ticks.stepSize,1),l="week"===o&&n.isoWeekday,h=N(l)||!0===l,c={};let d,u,f=e;if(h&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,h?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g="data"===s.ticks.source&&this.getDataTimestamps();for(d=f,u=0;dt-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.ticks.callback;if(o)return c(o,[t,e,i],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,h=r&&a[r],d=l&&a[l],u=i[e],f=l&&d&&u&&u.major;return this._adapter.format(t,s||(f?d:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=et(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=et(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}var Ea=class extends Ta{static id="timeseries";static defaults=Ta.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=La(e,this.min),this._tableRange=La(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;onull===t?null:Z(Math.round(t),0,e))(e=isFinite(e)&&s[e]===t?e:na(s,t,r(e,t),this._addedLabels),s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return oa.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:la,LogarithmicScale:ga,RadialLinearScale:wa,TimeScale:Ta,TimeSeriesScale:Ea});return Sn.register(Vn,Ra,oo,sa),Sn.helpers={...Bi},Sn._adapters=Cn,Sn.Animation=Ps,Sn.Animations=Ds,Sn.animator=bt,Sn.controllers=Js.controllers.items,Sn.DatasetController=Bs,Sn.Element=Ns,Sn.elements=oo,Sn.Interaction=Ui,Sn.layouts=os,Sn.platforms=ws,Sn.Scale=Ks,Sn.Ticks=ae,Object.assign(Sn,Vn,Ra,oo,sa,ws),Sn.Chart=Sn,"undefined"!=typeof window&&(window.Chart=Sn),Sn})); //# sourceMappingURL=chart.umd.js.map PK! @^@^jquery-3.6.1.min.jsnu[/*! jQuery v3.6.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,y=n.hasOwnProperty,a=y.toString,l=a.call(Object),v={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&v(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!y||!y.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ve(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ye(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ve(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],y=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||y.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),y=y.length&&new RegExp(y.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),v=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&v(p,e)?-1:t==C||t.ownerDocument==p&&v(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!y||!y.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),v.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",v.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",v.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),v.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(v.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return B(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=_e(v.pixelPosition,function(e,t){if(t)return t=Be(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return B(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0-1)?'documentElement':'body']};SuperNote.prototype.getWinW=function(){return this.docBody().clientWidth||window.innerWidth||0};SuperNote.prototype.getWinH=function(){return this.docBody().clientHeight||window.innerHeight||0;};SuperNote.prototype.getScrX=function(){return this.docBody().scrollLeft||window.scrollX||0};SuperNote.prototype.getScrY=function(){return this.docBody().scrollTop||window.scrollY||0};SuperNote.prototype.checkWinX=function(newX,note){with(this){return Math.max(getScrX(),Math.min(newX,getScrX()+getWinW()-note.ref.offsetWidth-8));}};SuperNote.prototype.checkWinY=function(newY,note){with(this){return Math.max(getScrY(),Math.min(newY,getScrY()+getWinH()-note.ref.offsetHeight-8));}};SuperNote.prototype.mouseTrack=function(evt){with(this){mouseX=evt.pageX||evt.clientX+getScrX()||0;mouseY=evt.pageY||evt.clientY+getScrY()||0;}};SuperNote.prototype.mouseHandler=function(evt,show){with(this){if(!document.documentElement)return true;var srcElm=evt.target||evt.srcElement,trigRE=new RegExp(myName+'-(hover|click)-([a-z0-9]+)','i'),targRE=new RegExp(myName+'-(note)-([a-z0-9]+)','i'),trigFind=1,foundNotes={};if(srcElm.nodeType!=1)srcElm=srcElm.parentNode;var elm=srcElm;while(elm&&elm!=rootElm){if(targRE.test(elm.id)||(trigFind&&trigRE.test(elm.className))){if(!allowNesting)trigFind=0;var click=RegExp.$1=='click'?1:0,noteID=RegExp.$2,ref=document.getElementById(myName+'-note-'+noteID),trigRef=trigRE.test(elm.className)?elm:null;if(ref){if(!notes[noteID]){notes[noteID]={click:click,ref:ref,trigRef:null,visible:0,animating:0,timer:null};ref._sn_obj=this;ref._sn_id=noteID}var note=notes[noteID];if(!note.click||(trigRef!=srcElm))foundNotes[noteID]=true;if(!note.click||(show==2)){if(trigRef)notes[noteID].trigRef=notes[noteID].ref._sn_trig=elm;display(noteID,show);if(note.click&&(srcElm==trigRef))cancelEvent(evt);}}}if(elm._sn_trig){trigFind=1;elm=elm._sn_trig}else{elm=elm.parentNode;}}if(show==2)for(var n in notes){if(notes[n].click&¬es[n].visible&&!foundNotes[n])display(n,0)}}};SuperNote.prototype.display=function(noteID,show){with(this){with(notes[noteID]){clearTimeout(timer);if(!animating||(show?!visible:visible)){var tmt=animating?1:(show?showDelay||1:hideDelay||1);timer=setTimeout('SuperNote.instances['+instance+'].setVis("'+noteID+'",'+show+',false)',tmt)}}}};SuperNote.prototype.checkType=function(noteID,nextVis,nextAnim){with(this){var note=notes[noteID],bType,pType;if((/snp-([a-z]+)/).test(note.ref.className))pType=RegExp.$1;if((/snb-([a-z]+)/).test(note.ref.className))bType=RegExp.$1;if(nextAnim&&bType&&bTypes[bType]&&(bTypes[bType](this,noteID,nextVis)==false))return false;if(pType&&pTypes[pType])pTypes[pType](this,noteID,nextVis,nextAnim);return true;}};SuperNote.prototype.setVis=function(noteID,show,now){with(this){var note=notes[noteID];if(note&&checkType(noteID,show,1)||now){note.visible=show;note.animating=1;animate(noteID,show,now);}}};SuperNote.prototype.animate=function(noteID,show,now){with(this){var note=notes[noteID];if(!note.animTimer)note.animTimer=0;if(!note.animC)note.animC=0;with(note){clearTimeout(animTimer);var speed=(animations.length&&!now)?(show?animInSpeed:animOutSpeed):1;if(show&&!animC){if(onshow)this.onshow(noteID);IEFrameFix(noteID,1);ref.style[cssProp]=cssVis}animC=Math.max(0,Math.min(1,animC+speed*(show?1:-1)));if(document.getElementById&&speed<1)for(var a=0;a3-S-Schart.umd.js.mapnu[{"version":3,"file":"chart.umd.js","sources":["../src/helpers/helpers.core.ts","../src/helpers/helpers.math.ts","../src/helpers/helpers.collection.ts","../src/helpers/helpers.extras.ts","../src/core/core.animator.js","../node_modules/.pnpm/@kurkle+color@0.2.1/node_modules/@kurkle/color/dist/color.esm.js","../src/helpers/helpers.color.ts","../src/core/core.animations.defaults.js","../src/helpers/helpers.intl.ts","../src/core/core.ticks.js","../src/core/core.defaults.js","../src/core/core.layouts.defaults.js","../src/core/core.scale.defaults.js","../src/helpers/helpers.dom.ts","../src/helpers/helpers.canvas.js","../src/helpers/helpers.config.js","../src/helpers/helpers.curve.ts","../src/helpers/helpers.easing.ts","../src/helpers/helpers.interpolation.ts","../src/helpers/helpers.options.ts","../src/helpers/helpers.rtl.ts","../src/helpers/helpers.segment.js","../src/core/core.interaction.js","../src/core/core.layouts.js","../src/platform/platform.base.js","../src/platform/platform.basic.js","../src/platform/platform.dom.js","../src/platform/index.js","../src/core/core.animation.js","../src/core/core.animations.js","../src/core/core.datasetController.js","../src/core/core.element.ts","../src/core/core.scale.autoskip.js","../src/core/core.scale.js","../src/core/core.typedRegistry.js","../src/core/core.registry.js","../src/core/core.plugins.js","../src/core/core.config.js","../src/core/core.controller.js","../src/core/core.adapters.ts","../src/controllers/controller.bar.js","../src/controllers/controller.doughnut.js","../src/controllers/controller.bubble.js","../src/controllers/controller.line.js","../src/controllers/controller.polarArea.js","../src/controllers/controller.pie.js","../src/controllers/controller.radar.js","../src/controllers/controller.scatter.js","../src/elements/element.arc.ts","../src/elements/element.line.js","../src/elements/element.point.ts","../src/elements/element.bar.js","../src/plugins/plugin.colors.ts","../src/plugins/plugin.decimation.js","../src/plugins/plugin.filler/filler.segment.js","../src/plugins/plugin.filler/filler.helper.js","../src/plugins/plugin.filler/filler.options.js","../src/plugins/plugin.filler/filler.target.stack.js","../src/plugins/plugin.filler/simpleArc.js","../src/plugins/plugin.filler/filler.target.js","../src/plugins/plugin.filler/filler.drawing.js","../src/plugins/plugin.filler/index.js","../src/plugins/plugin.legend.js","../src/plugins/plugin.title.js","../src/plugins/plugin.subtitle.js","../src/plugins/plugin.tooltip.js","../src/scales/scale.category.js","../src/scales/scale.linearbase.js","../src/scales/scale.linear.js","../src/scales/scale.logarithmic.js","../src/scales/scale.radialLinear.js","../src/scales/scale.time.js","../src/scales/scale.timeseries.js","../src/index.umd.ts"],"sourcesContent":["/**\n * @namespace Chart.helpers\n */\n\nimport type {AnyObject} from '../../types/basic';\nimport type {ActiveDataPoint, ChartEvent} from '../../types';\n\n/**\n * An empty function that can be used, for example, for optional callback.\n */\nexport function noop() {\n /* noop */\n}\n\n/**\n * Returns a unique id, sequentially generated from a global variable.\n */\nexport const uid = (() => {\n let id = 0;\n return () => id++;\n})();\n\n/**\n * Returns true if `value` is neither null nor undefined, else returns false.\n * @param value - The value to test.\n * @since 2.7.0\n */\nexport function isNullOrUndef(value: unknown): value is null | undefined {\n return value === null || typeof value === 'undefined';\n}\n\n/**\n * Returns true if `value` is an array (including typed arrays), else returns false.\n * @param value - The value to test.\n * @function\n */\nexport function isArray(value: unknown): value is T[] {\n if (Array.isArray && Array.isArray(value)) {\n return true;\n }\n const type = Object.prototype.toString.call(value);\n if (type.slice(0, 7) === '[object' && type.slice(-6) === 'Array]') {\n return true;\n }\n return false;\n}\n\n/**\n * Returns true if `value` is an object (excluding null), else returns false.\n * @param value - The value to test.\n * @since 2.7.0\n */\nexport function isObject(value: unknown): value is AnyObject {\n return value !== null && Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * Returns true if `value` is a finite number, else returns false\n * @param value - The value to test.\n */\nfunction isNumberFinite(value: unknown): value is number {\n return (typeof value === 'number' || value instanceof Number) && isFinite(+value);\n}\nexport {\n isNumberFinite as isFinite,\n};\n\n/**\n * Returns `value` if finite, else returns `defaultValue`.\n * @param value - The value to return if defined.\n * @param defaultValue - The value to return if `value` is not finite.\n */\nexport function finiteOrDefault(value: unknown, defaultValue: number) {\n return isNumberFinite(value) ? value : defaultValue;\n}\n\n/**\n * Returns `value` if defined, else returns `defaultValue`.\n * @param value - The value to return if defined.\n * @param defaultValue - The value to return if `value` is undefined.\n */\nexport function valueOrDefault(value: T | undefined, defaultValue: T) {\n return typeof value === 'undefined' ? defaultValue : value;\n}\n\nexport const toPercentage = (value: number | string, dimension: number) =>\n typeof value === 'string' && value.endsWith('%') ?\n parseFloat(value) / 100\n : +value / dimension;\n\nexport const toDimension = (value: number | string, dimension: number) =>\n typeof value === 'string' && value.endsWith('%') ?\n parseFloat(value) / 100 * dimension\n : +value;\n\n/**\n * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the\n * value returned by `fn`. If `fn` is not a function, this method returns undefined.\n * @param fn - The function to call.\n * @param args - The arguments with which `fn` should be called.\n * @param [thisArg] - The value of `this` provided for the call to `fn`.\n */\nexport function callback R, TA, R>(\n fn: T | undefined,\n args: unknown[],\n thisArg?: TA\n): R | undefined {\n if (fn && typeof fn.call === 'function') {\n return fn.apply(thisArg, args);\n }\n}\n\n/**\n * Note(SB) for performance sake, this method should only be used when loopable type\n * is unknown or in none intensive code (not called often and small loopable). Else\n * it's preferable to use a regular for() loop and save extra function calls.\n * @param loopable - The object or array to be iterated.\n * @param fn - The function to call for each item.\n * @param [thisArg] - The value of `this` provided for the call to `fn`.\n * @param [reverse] - If true, iterates backward on the loopable.\n */\nexport function each(\n loopable: Record,\n fn: (this: TA, v: T, i: string) => void,\n thisArg?: TA,\n reverse?: boolean\n): void;\nexport function each(\n loopable: T[],\n fn: (this: TA, v: T, i: number) => void,\n thisArg?: TA,\n reverse?: boolean\n): void;\nexport function each(\n loopable: T[] | Record,\n fn: (this: TA, v: T, i: any) => void,\n thisArg?: TA,\n reverse?: boolean\n) {\n let i: number, len: number, keys: string[];\n if (isArray(loopable)) {\n len = loopable.length;\n if (reverse) {\n for (i = len - 1; i >= 0; i--) {\n fn.call(thisArg, loopable[i], i);\n }\n } else {\n for (i = 0; i < len; i++) {\n fn.call(thisArg, loopable[i], i);\n }\n }\n } else if (isObject(loopable)) {\n keys = Object.keys(loopable);\n len = keys.length;\n for (i = 0; i < len; i++) {\n fn.call(thisArg, loopable[keys[i]], keys[i]);\n }\n }\n}\n\n/**\n * Returns true if the `a0` and `a1` arrays have the same content, else returns false.\n * @param a0 - The array to compare\n * @param a1 - The array to compare\n * @private\n */\nexport function _elementsEqual(a0: ActiveDataPoint[], a1: ActiveDataPoint[]) {\n let i: number, ilen: number, v0: ActiveDataPoint, v1: ActiveDataPoint;\n\n if (!a0 || !a1 || a0.length !== a1.length) {\n return false;\n }\n\n for (i = 0, ilen = a0.length; i < ilen; ++i) {\n v0 = a0[i];\n v1 = a1[i];\n\n if (v0.datasetIndex !== v1.datasetIndex || v0.index !== v1.index) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Returns a deep copy of `source` without keeping references on objects and arrays.\n * @param source - The value to clone.\n */\nexport function clone(source: T): T {\n if (isArray(source)) {\n return source.map(clone) as unknown as T;\n }\n\n if (isObject(source)) {\n const target = Object.create(null);\n const keys = Object.keys(source);\n const klen = keys.length;\n let k = 0;\n\n for (; k < klen; ++k) {\n target[keys[k]] = clone(source[keys[k]]);\n }\n\n return target;\n }\n\n return source;\n}\n\nfunction isValidKey(key: string) {\n return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;\n}\n\n/**\n * The default merger when Chart.helpers.merge is called without merger option.\n * Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.\n * @private\n */\nexport function _merger(key: string, target: AnyObject, source: AnyObject, options: AnyObject) {\n if (!isValidKey(key)) {\n return;\n }\n\n const tval = target[key];\n const sval = source[key];\n\n if (isObject(tval) && isObject(sval)) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n merge(tval, sval, options);\n } else {\n target[key] = clone(sval);\n }\n}\n\nexport interface MergeOptions {\n merger?: (key: string, target: AnyObject, source: AnyObject, options?: AnyObject) => void;\n}\n\n/**\n * Recursively deep copies `source` properties into `target` with the given `options`.\n * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\n * @param target - The target object in which all sources are merged into.\n * @param source - Object(s) to merge into `target`.\n * @param [options] - Merging options:\n * @param [options.merger] - The merge method (key, target, source, options)\n * @returns The `target` object.\n */\nexport function merge(target: T, source: [], options?: MergeOptions): T;\nexport function merge(target: T, source: S1, options?: MergeOptions): T & S1;\nexport function merge(target: T, source: [S1], options?: MergeOptions): T & S1;\nexport function merge(target: T, source: [S1, S2], options?: MergeOptions): T & S1 & S2;\nexport function merge(target: T, source: [S1, S2, S3], options?: MergeOptions): T & S1 & S2 & S3;\nexport function merge(\n target: T,\n source: [S1, S2, S3, S4],\n options?: MergeOptions\n): T & S1 & S2 & S3 & S4;\nexport function merge(target: T, source: AnyObject[], options?: MergeOptions): AnyObject;\nexport function merge(target: T, source: AnyObject[], options?: MergeOptions): AnyObject {\n const sources = isArray(source) ? source : [source];\n const ilen = sources.length;\n\n if (!isObject(target)) {\n return target as AnyObject;\n }\n\n options = options || {};\n const merger = options.merger || _merger;\n let current: AnyObject;\n\n for (let i = 0; i < ilen; ++i) {\n current = sources[i];\n if (!isObject(current)) {\n continue;\n }\n\n const keys = Object.keys(current);\n for (let k = 0, klen = keys.length; k < klen; ++k) {\n merger(keys[k], target, current, options as AnyObject);\n }\n }\n\n return target;\n}\n\n/**\n * Recursively deep copies `source` properties into `target` *only* if not defined in target.\n * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\n * @param target - The target object in which all sources are merged into.\n * @param source - Object(s) to merge into `target`.\n * @returns The `target` object.\n */\nexport function mergeIf(target: T, source: []): T;\nexport function mergeIf(target: T, source: S1): T & S1;\nexport function mergeIf(target: T, source: [S1]): T & S1;\nexport function mergeIf(target: T, source: [S1, S2]): T & S1 & S2;\nexport function mergeIf(target: T, source: [S1, S2, S3]): T & S1 & S2 & S3;\nexport function mergeIf(target: T, source: [S1, S2, S3, S4]): T & S1 & S2 & S3 & S4;\nexport function mergeIf(target: T, source: AnyObject[]): AnyObject;\nexport function mergeIf(target: T, source: AnyObject[]): AnyObject {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return merge(target, source, {merger: _mergerIf});\n}\n\n/**\n * Merges source[key] in target[key] only if target[key] is undefined.\n * @private\n */\nexport function _mergerIf(key: string, target: AnyObject, source: AnyObject) {\n if (!isValidKey(key)) {\n return;\n }\n\n const tval = target[key];\n const sval = source[key];\n\n if (isObject(tval) && isObject(sval)) {\n mergeIf(tval, sval);\n } else if (!Object.prototype.hasOwnProperty.call(target, key)) {\n target[key] = clone(sval);\n }\n}\n\n/**\n * @private\n */\nexport function _deprecated(scope: string, value: unknown, previous: string, current: string) {\n if (value !== undefined) {\n console.warn(scope + ': \"' + previous +\n '\" is deprecated. Please use \"' + current + '\" instead');\n }\n}\n\n// resolveObjectKey resolver cache\nconst keyResolvers = {\n // Chart.helpers.core resolveObjectKey should resolve empty key to root object\n '': v => v,\n // default resolvers\n x: o => o.x,\n y: o => o.y\n};\n\n/**\n * @private\n */\nexport function _splitKey(key: string) {\n const parts = key.split('.');\n const keys: string[] = [];\n let tmp = '';\n for (const part of parts) {\n tmp += part;\n if (tmp.endsWith('\\\\')) {\n tmp = tmp.slice(0, -1) + '.';\n } else {\n keys.push(tmp);\n tmp = '';\n }\n }\n return keys;\n}\n\nfunction _getKeyResolver(key: string) {\n const keys = _splitKey(key);\n return obj => {\n for (const k of keys) {\n if (k === '') {\n // For backward compatibility:\n // Chart.helpers.core resolveObjectKey should break at empty key\n break;\n }\n obj = obj && obj[k];\n }\n return obj;\n };\n}\n\nexport function resolveObjectKey(obj: AnyObject, key: string): AnyObject {\n const resolver = keyResolvers[key] || (keyResolvers[key] = _getKeyResolver(key));\n return resolver(obj);\n}\n\n/**\n * @private\n */\nexport function _capitalize(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\n\nexport const defined = (value: unknown) => typeof value !== 'undefined';\n\nexport const isFunction = (value: unknown): value is (...args: any[]) => any => typeof value === 'function';\n\n// Adapted from https://stackoverflow.com/questions/31128855/comparing-ecma6-sets-for-equality#31129384\nexport const setsEqual = (a: Set, b: Set) => {\n if (a.size !== b.size) {\n return false;\n }\n\n for (const item of a) {\n if (!b.has(item)) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * @param e - The event\n * @private\n */\nexport function _isClickEvent(e: ChartEvent) {\n return e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu';\n}\n","import type {Point} from '../../types/geometric';\nimport {isFinite as isFiniteNumber} from './helpers.core';\n\n/**\n * @alias Chart.helpers.math\n * @namespace\n */\n\nexport const PI = Math.PI;\nexport const TAU = 2 * PI;\nexport const PITAU = TAU + PI;\nexport const INFINITY = Number.POSITIVE_INFINITY;\nexport const RAD_PER_DEG = PI / 180;\nexport const HALF_PI = PI / 2;\nexport const QUARTER_PI = PI / 4;\nexport const TWO_THIRDS_PI = PI * 2 / 3;\n\nexport const log10 = Math.log10;\nexport const sign = Math.sign;\n\nexport function almostEquals(x: number, y: number, epsilon: number) {\n return Math.abs(x - y) < epsilon;\n}\n\n/**\n * Implementation of the nice number algorithm used in determining where axis labels will go\n */\nexport function niceNum(range: number) {\n const roundedRange = Math.round(range);\n range = almostEquals(range, roundedRange, range / 1000) ? roundedRange : range;\n const niceRange = Math.pow(10, Math.floor(log10(range)));\n const fraction = range / niceRange;\n const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10;\n return niceFraction * niceRange;\n}\n\n/**\n * Returns an array of factors sorted from 1 to sqrt(value)\n * @private\n */\nexport function _factorize(value: number) {\n const result: number[] = [];\n const sqrt = Math.sqrt(value);\n let i: number;\n\n for (i = 1; i < sqrt; i++) {\n if (value % i === 0) {\n result.push(i);\n result.push(value / i);\n }\n }\n if (sqrt === (sqrt | 0)) { // if value is a square number\n result.push(sqrt);\n }\n\n result.sort((a, b) => a - b).pop();\n return result;\n}\n\nexport function isNumber(n: unknown): n is number {\n return !isNaN(parseFloat(n as string)) && isFinite(n as number);\n}\n\nexport function almostWhole(x: number, epsilon: number) {\n const rounded = Math.round(x);\n return ((rounded - epsilon) <= x) && ((rounded + epsilon) >= x);\n}\n\n/**\n * @private\n */\nexport function _setMinAndMaxByKey(\n array: Record[],\n target: { min: number, max: number },\n property: string\n) {\n let i: number, ilen: number, value: number;\n\n for (i = 0, ilen = array.length; i < ilen; i++) {\n value = array[i][property];\n if (!isNaN(value)) {\n target.min = Math.min(target.min, value);\n target.max = Math.max(target.max, value);\n }\n }\n}\n\nexport function toRadians(degrees: number) {\n return degrees * (PI / 180);\n}\n\nexport function toDegrees(radians: number) {\n return radians * (180 / PI);\n}\n\n/**\n * Returns the number of decimal places\n * i.e. the number of digits after the decimal point, of the value of this Number.\n * @param x - A number.\n * @returns The number of decimal places.\n * @private\n */\nexport function _decimalPlaces(x: number) {\n if (!isFiniteNumber(x)) {\n return;\n }\n let e = 1;\n let p = 0;\n while (Math.round(x * e) / e !== x) {\n e *= 10;\n p++;\n }\n return p;\n}\n\n// Gets the angle from vertical upright to the point about a centre.\nexport function getAngleFromPoint(\n centrePoint: Point,\n anglePoint: Point\n) {\n const distanceFromXCenter = anglePoint.x - centrePoint.x;\n const distanceFromYCenter = anglePoint.y - centrePoint.y;\n const radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);\n\n let angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);\n\n if (angle < (-0.5 * PI)) {\n angle += TAU; // make sure the returned angle is in the range of (-PI/2, 3PI/2]\n }\n\n return {\n angle,\n distance: radialDistanceFromCenter\n };\n}\n\nexport function distanceBetweenPoints(pt1: Point, pt2: Point) {\n return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));\n}\n\n/**\n * Shortest distance between angles, in either direction.\n * @private\n */\nexport function _angleDiff(a: number, b: number) {\n return (a - b + PITAU) % TAU - PI;\n}\n\n/**\n * Normalize angle to be between 0 and 2*PI\n * @private\n */\nexport function _normalizeAngle(a: number) {\n return (a % TAU + TAU) % TAU;\n}\n\n/**\n * @private\n */\nexport function _angleBetween(angle: number, start: number, end: number, sameAngleIsFullCircle?: boolean) {\n const a = _normalizeAngle(angle);\n const s = _normalizeAngle(start);\n const e = _normalizeAngle(end);\n const angleToStart = _normalizeAngle(s - a);\n const angleToEnd = _normalizeAngle(e - a);\n const startToAngle = _normalizeAngle(a - s);\n const endToAngle = _normalizeAngle(a - e);\n return a === s || a === e || (sameAngleIsFullCircle && s === e)\n || (angleToStart > angleToEnd && startToAngle < endToAngle);\n}\n\n/**\n * Limit `value` between `min` and `max`\n * @param value\n * @param min\n * @param max\n * @private\n */\nexport function _limitValue(value: number, min: number, max: number) {\n return Math.max(min, Math.min(max, value));\n}\n\n/**\n * @param {number} value\n * @private\n */\nexport function _int16Range(value: number) {\n return _limitValue(value, -32768, 32767);\n}\n\n/**\n * @param value\n * @param start\n * @param end\n * @param [epsilon]\n * @private\n */\nexport function _isBetween(value: number, start: number, end: number, epsilon = 1e-6) {\n return value >= Math.min(start, end) - epsilon && value <= Math.max(start, end) + epsilon;\n}\n","import {_capitalize} from './helpers.core';\n\n/**\n * Binary search\n * @param table - the table search. must be sorted!\n * @param value - value to find\n * @param cmp\n * @private\n */\nexport function _lookup(\n table: number[],\n value: number,\n cmp?: (value: number) => boolean\n): {lo: number, hi: number};\nexport function _lookup(\n table: T[],\n value: number,\n cmp: (value: number) => boolean\n): {lo: number, hi: number};\nexport function _lookup(\n table: unknown[],\n value: number,\n cmp?: (value: number) => boolean\n) {\n cmp = cmp || ((index) => table[index] < value);\n let hi = table.length - 1;\n let lo = 0;\n let mid: number;\n\n while (hi - lo > 1) {\n mid = (lo + hi) >> 1;\n if (cmp(mid)) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n\n return {lo, hi};\n}\n\n/**\n * Binary search\n * @param table - the table search. must be sorted!\n * @param key - property name for the value in each entry\n * @param value - value to find\n * @param last - lookup last index\n * @private\n */\nexport const _lookupByKey = (\n table: Record[],\n key: string,\n value: number,\n last?: boolean\n) =>\n _lookup(table, value, last\n ? index => {\n const ti = table[index][key];\n return ti < value || ti === value && table[index + 1][key] === value;\n }\n : index => table[index][key] < value);\n\n/**\n * Reverse binary search\n * @param table - the table search. must be sorted!\n * @param key - property name for the value in each entry\n * @param value - value to find\n * @private\n */\nexport const _rlookupByKey = (\n table: Record[],\n key: string,\n value: number\n) =>\n _lookup(table, value, index => table[index][key] >= value);\n\n/**\n * Return subset of `values` between `min` and `max` inclusive.\n * Values are assumed to be in sorted order.\n * @param values - sorted array of values\n * @param min - min value\n * @param max - max value\n */\nexport function _filterBetween(values: number[], min: number, max: number) {\n let start = 0;\n let end = values.length;\n\n while (start < end && values[start] < min) {\n start++;\n }\n while (end > start && values[end - 1] > max) {\n end--;\n }\n\n return start > 0 || end < values.length\n ? values.slice(start, end)\n : values;\n}\n\nconst arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'] as const;\n\nexport interface ArrayListener {\n _onDataPush?(...item: T[]): void;\n _onDataPop?(): void;\n _onDataShift?(): void;\n _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;\n _onDataUnshift?(...item: T[]): void;\n}\n\n/**\n * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',\n * 'unshift') and notify the listener AFTER the array has been altered. Listeners are\n * called on the '_onData*' callbacks (e.g. _onDataPush, etc.) with same arguments.\n */\nexport function listenArrayEvents(array: T[], listener: ArrayListener): void;\nexport function listenArrayEvents(array, listener) {\n if (array._chartjs) {\n array._chartjs.listeners.push(listener);\n return;\n }\n\n Object.defineProperty(array, '_chartjs', {\n configurable: true,\n enumerable: false,\n value: {\n listeners: [listener]\n }\n });\n\n arrayEvents.forEach((key) => {\n const method = '_onData' + _capitalize(key);\n const base = array[key];\n\n Object.defineProperty(array, key, {\n configurable: true,\n enumerable: false,\n value(...args) {\n const res = base.apply(this, args);\n\n array._chartjs.listeners.forEach((object) => {\n if (typeof object[method] === 'function') {\n object[method](...args);\n }\n });\n\n return res;\n }\n });\n });\n}\n\n\n/**\n * Removes the given array event listener and cleanup extra attached properties (such as\n * the _chartjs stub and overridden methods) if array doesn't have any more listeners.\n */\nexport function unlistenArrayEvents(array: T[], listener: ArrayListener): void;\nexport function unlistenArrayEvents(array, listener) {\n const stub = array._chartjs;\n if (!stub) {\n return;\n }\n\n const listeners = stub.listeners;\n const index = listeners.indexOf(listener);\n if (index !== -1) {\n listeners.splice(index, 1);\n }\n\n if (listeners.length > 0) {\n return;\n }\n\n arrayEvents.forEach((key) => {\n delete array[key];\n });\n\n delete array._chartjs;\n}\n\n/**\n * @param items\n */\nexport function _arrayUnique(items: T[]) {\n const set = new Set();\n let i: number, ilen: number;\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n set.add(items[i]);\n }\n\n if (set.size === ilen) {\n return items;\n }\n\n return Array.from(set);\n}\n","import {type ChartMeta, type PointElement} from '../../types';\n\nimport {_limitValue} from './helpers.math';\nimport {_lookupByKey} from './helpers.collection';\n\nexport function fontString(pixelSize: number, fontStyle: string, fontFamily: string) {\n return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;\n}\n\n/**\n* Request animation polyfill\n*/\nexport const requestAnimFrame = (function() {\n if (typeof window === 'undefined') {\n return function(callback) {\n return callback();\n };\n }\n return window.requestAnimationFrame;\n}());\n\n/**\n * Throttles calling `fn` once per animation frame\n * Latest arguments are used on the actual call\n */\nexport function throttled>(\n fn: (...args: TArgs) => void,\n thisArg: any,\n) {\n let ticking = false;\n\n return function(...args: TArgs) {\n if (!ticking) {\n ticking = true;\n requestAnimFrame.call(window, () => {\n ticking = false;\n fn.apply(thisArg, args);\n });\n }\n };\n}\n\n/**\n * Debounces calling `fn` for `delay` ms\n */\nexport function debounce>(fn: (...args: TArgs) => void, delay: number) {\n let timeout;\n return function(...args: TArgs) {\n if (delay) {\n clearTimeout(timeout);\n timeout = setTimeout(fn, delay, args);\n } else {\n fn.apply(this, args);\n }\n return delay;\n };\n}\n\n/**\n * Converts 'start' to 'left', 'end' to 'right' and others to 'center'\n * @private\n */\nexport const _toLeftRightCenter = (align: 'start' | 'end' | 'center') => align === 'start' ? 'left' : align === 'end' ? 'right' : 'center';\n\n/**\n * Returns `start`, `end` or `(start + end) / 2` depending on `align`. Defaults to `center`\n * @private\n */\nexport const _alignStartEnd = (align: 'start' | 'end' | 'center', start: number, end: number) => align === 'start' ? start : align === 'end' ? end : (start + end) / 2;\n\n/**\n * Returns `left`, `right` or `(left + right) / 2` depending on `align`. Defaults to `left`\n * @private\n */\nexport const _textX = (align: 'left' | 'right' | 'center', left: number, right: number, rtl: boolean) => {\n const check = rtl ? 'left' : 'right';\n return align === check ? right : align === 'center' ? (left + right) / 2 : left;\n};\n\n/**\n * Return start and count of visible points.\n * @private\n */\nexport function _getStartAndCountOfVisiblePoints(meta: ChartMeta<'line' | 'scatter'>, points: PointElement[], animationsDisabled: boolean) {\n const pointCount = points.length;\n\n let start = 0;\n let count = pointCount;\n\n if (meta._sorted) {\n const {iScale, _parsed} = meta;\n const axis = iScale.axis;\n const {min, max, minDefined, maxDefined} = iScale.getUserBounds();\n\n if (minDefined) {\n start = _limitValue(Math.min(\n // @ts-expect-error Need to type _parsed\n _lookupByKey(_parsed, iScale.axis, min).lo,\n // @ts-expect-error Need to fix types on _lookupByKey\n animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo),\n 0, pointCount - 1);\n }\n if (maxDefined) {\n count = _limitValue(Math.max(\n // @ts-expect-error Need to type _parsed\n _lookupByKey(_parsed, iScale.axis, max, true).hi + 1,\n // @ts-expect-error Need to fix types on _lookupByKey\n animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1),\n start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n }\n\n return {start, count};\n}\n\n/**\n * Checks if the scale ranges have changed.\n * @param {object} meta - dataset meta.\n * @returns {boolean}\n * @private\n */\nexport function _scaleRangesChanged(meta) {\n const {xScale, yScale, _scaleRanges} = meta;\n const newRanges = {\n xmin: xScale.min,\n xmax: xScale.max,\n ymin: yScale.min,\n ymax: yScale.max\n };\n if (!_scaleRanges) {\n meta._scaleRanges = newRanges;\n return true;\n }\n const changed = _scaleRanges.xmin !== xScale.min\n\t\t|| _scaleRanges.xmax !== xScale.max\n\t\t|| _scaleRanges.ymin !== yScale.min\n\t\t|| _scaleRanges.ymax !== yScale.max;\n\n Object.assign(_scaleRanges, newRanges);\n return changed;\n}\n","import {requestAnimFrame} from '../helpers/helpers.extras';\n\n/**\n * @typedef { import(\"./core.animation\").default } Animation\n * @typedef { import(\"./core.controller\").default } Chart\n */\n\n/**\n * Please use the module's default export which provides a singleton instance\n * Note: class is export for typedoc\n */\nexport class Animator {\n constructor() {\n this._request = null;\n this._charts = new Map();\n this._running = false;\n this._lastDate = undefined;\n }\n\n /**\n\t * @private\n\t */\n _notify(chart, anims, date, type) {\n const callbacks = anims.listeners[type];\n const numSteps = anims.duration;\n\n callbacks.forEach(fn => fn({\n chart,\n initial: anims.initial,\n numSteps,\n currentStep: Math.min(date - anims.start, numSteps)\n }));\n }\n\n /**\n\t * @private\n\t */\n _refresh() {\n if (this._request) {\n return;\n }\n this._running = true;\n\n this._request = requestAnimFrame.call(window, () => {\n this._update();\n this._request = null;\n\n if (this._running) {\n this._refresh();\n }\n });\n }\n\n /**\n\t * @private\n\t */\n _update(date = Date.now()) {\n let remaining = 0;\n\n this._charts.forEach((anims, chart) => {\n if (!anims.running || !anims.items.length) {\n return;\n }\n const items = anims.items;\n let i = items.length - 1;\n let draw = false;\n let item;\n\n for (; i >= 0; --i) {\n item = items[i];\n\n if (item._active) {\n if (item._total > anims.duration) {\n // if the animation has been updated and its duration prolonged,\n // update to total duration of current animations run (for progress event)\n anims.duration = item._total;\n }\n item.tick(date);\n draw = true;\n } else {\n // Remove the item by replacing it with last item and removing the last\n // A lot faster than splice.\n items[i] = items[items.length - 1];\n items.pop();\n }\n }\n\n if (draw) {\n chart.draw();\n this._notify(chart, anims, date, 'progress');\n }\n\n if (!items.length) {\n anims.running = false;\n this._notify(chart, anims, date, 'complete');\n anims.initial = false;\n }\n\n remaining += items.length;\n });\n\n this._lastDate = date;\n\n if (remaining === 0) {\n this._running = false;\n }\n }\n\n /**\n\t * @private\n\t */\n _getAnims(chart) {\n const charts = this._charts;\n let anims = charts.get(chart);\n if (!anims) {\n anims = {\n running: false,\n initial: true,\n items: [],\n listeners: {\n complete: [],\n progress: []\n }\n };\n charts.set(chart, anims);\n }\n return anims;\n }\n\n /**\n\t * @param {Chart} chart\n\t * @param {string} event - event name\n\t * @param {Function} cb - callback\n\t */\n listen(chart, event, cb) {\n this._getAnims(chart).listeners[event].push(cb);\n }\n\n /**\n\t * Add animations\n\t * @param {Chart} chart\n\t * @param {Animation[]} items - animations\n\t */\n add(chart, items) {\n if (!items || !items.length) {\n return;\n }\n this._getAnims(chart).items.push(...items);\n }\n\n /**\n\t * Counts number of active animations for the chart\n\t * @param {Chart} chart\n\t */\n has(chart) {\n return this._getAnims(chart).items.length > 0;\n }\n\n /**\n\t * Start animating (all charts)\n\t * @param {Chart} chart\n\t */\n start(chart) {\n const anims = this._charts.get(chart);\n if (!anims) {\n return;\n }\n anims.running = true;\n anims.start = Date.now();\n anims.duration = anims.items.reduce((acc, cur) => Math.max(acc, cur._duration), 0);\n this._refresh();\n }\n\n running(chart) {\n if (!this._running) {\n return false;\n }\n const anims = this._charts.get(chart);\n if (!anims || !anims.running || !anims.items.length) {\n return false;\n }\n return true;\n }\n\n /**\n\t * Stop all animations for the chart\n\t * @param {Chart} chart\n\t */\n stop(chart) {\n const anims = this._charts.get(chart);\n if (!anims || !anims.items.length) {\n return;\n }\n const items = anims.items;\n let i = items.length - 1;\n\n for (; i >= 0; --i) {\n items[i].cancel();\n }\n anims.items = [];\n this._notify(chart, anims, Date.now(), 'complete');\n }\n\n /**\n\t * Remove chart from Animator\n\t * @param {Chart} chart\n\t */\n remove(chart) {\n return this._charts.delete(chart);\n }\n}\n\n// singleton instance\nexport default /* #__PURE__ */ new Animator();\n","/*!\n * @kurkle/color v0.2.1\n * https://github.com/kurkle/color#readme\n * (c) 2022 Jukka Kurkela\n * Released under the MIT License\n */\nfunction round(v) {\n return v + 0.5 | 0;\n}\nconst lim = (v, l, h) => Math.max(Math.min(v, h), l);\nfunction p2b(v) {\n return lim(round(v * 2.55), 0, 255);\n}\nfunction b2p(v) {\n return lim(round(v / 2.55), 0, 100);\n}\nfunction n2b(v) {\n return lim(round(v * 255), 0, 255);\n}\nfunction b2n(v) {\n return lim(round(v / 2.55) / 100, 0, 1);\n}\nfunction n2p(v) {\n return lim(round(v * 100), 0, 100);\n}\n\nconst map$1 = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, A: 10, B: 11, C: 12, D: 13, E: 14, F: 15, a: 10, b: 11, c: 12, d: 13, e: 14, f: 15};\nconst hex = [...'0123456789ABCDEF'];\nconst h1 = b => hex[b & 0xF];\nconst h2 = b => hex[(b & 0xF0) >> 4] + hex[b & 0xF];\nconst eq = b => ((b & 0xF0) >> 4) === (b & 0xF);\nconst isShort = v => eq(v.r) && eq(v.g) && eq(v.b) && eq(v.a);\nfunction hexParse(str) {\n var len = str.length;\n var ret;\n if (str[0] === '#') {\n if (len === 4 || len === 5) {\n ret = {\n r: 255 & map$1[str[1]] * 17,\n g: 255 & map$1[str[2]] * 17,\n b: 255 & map$1[str[3]] * 17,\n a: len === 5 ? map$1[str[4]] * 17 : 255\n };\n } else if (len === 7 || len === 9) {\n ret = {\n r: map$1[str[1]] << 4 | map$1[str[2]],\n g: map$1[str[3]] << 4 | map$1[str[4]],\n b: map$1[str[5]] << 4 | map$1[str[6]],\n a: len === 9 ? (map$1[str[7]] << 4 | map$1[str[8]]) : 255\n };\n }\n }\n return ret;\n}\nconst alpha = (a, f) => a < 255 ? f(a) : '';\nfunction hexString(v) {\n var f = isShort(v) ? h1 : h2;\n return v\n ? '#' + f(v.r) + f(v.g) + f(v.b) + alpha(v.a, f)\n : undefined;\n}\n\nconst HUE_RE = /^(hsla?|hwb|hsv)\\(\\s*([-+.e\\d]+)(?:deg)?[\\s,]+([-+.e\\d]+)%[\\s,]+([-+.e\\d]+)%(?:[\\s,]+([-+.e\\d]+)(%)?)?\\s*\\)$/;\nfunction hsl2rgbn(h, s, l) {\n const a = s * Math.min(l, 1 - l);\n const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return [f(0), f(8), f(4)];\n}\nfunction hsv2rgbn(h, s, v) {\n const f = (n, k = (n + h / 60) % 6) => v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);\n return [f(5), f(3), f(1)];\n}\nfunction hwb2rgbn(h, w, b) {\n const rgb = hsl2rgbn(h, 1, 0.5);\n let i;\n if (w + b > 1) {\n i = 1 / (w + b);\n w *= i;\n b *= i;\n }\n for (i = 0; i < 3; i++) {\n rgb[i] *= 1 - w - b;\n rgb[i] += w;\n }\n return rgb;\n}\nfunction hueValue(r, g, b, d, max) {\n if (r === max) {\n return ((g - b) / d) + (g < b ? 6 : 0);\n }\n if (g === max) {\n return (b - r) / d + 2;\n }\n return (r - g) / d + 4;\n}\nfunction rgb2hsl(v) {\n const range = 255;\n const r = v.r / range;\n const g = v.g / range;\n const b = v.b / range;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n let h, s, d;\n if (max !== min) {\n d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n h = hueValue(r, g, b, d, max);\n h = h * 60 + 0.5;\n }\n return [h | 0, s || 0, l];\n}\nfunction calln(f, a, b, c) {\n return (\n Array.isArray(a)\n ? f(a[0], a[1], a[2])\n : f(a, b, c)\n ).map(n2b);\n}\nfunction hsl2rgb(h, s, l) {\n return calln(hsl2rgbn, h, s, l);\n}\nfunction hwb2rgb(h, w, b) {\n return calln(hwb2rgbn, h, w, b);\n}\nfunction hsv2rgb(h, s, v) {\n return calln(hsv2rgbn, h, s, v);\n}\nfunction hue(h) {\n return (h % 360 + 360) % 360;\n}\nfunction hueParse(str) {\n const m = HUE_RE.exec(str);\n let a = 255;\n let v;\n if (!m) {\n return;\n }\n if (m[5] !== v) {\n a = m[6] ? p2b(+m[5]) : n2b(+m[5]);\n }\n const h = hue(+m[2]);\n const p1 = +m[3] / 100;\n const p2 = +m[4] / 100;\n if (m[1] === 'hwb') {\n v = hwb2rgb(h, p1, p2);\n } else if (m[1] === 'hsv') {\n v = hsv2rgb(h, p1, p2);\n } else {\n v = hsl2rgb(h, p1, p2);\n }\n return {\n r: v[0],\n g: v[1],\n b: v[2],\n a: a\n };\n}\nfunction rotate(v, deg) {\n var h = rgb2hsl(v);\n h[0] = hue(h[0] + deg);\n h = hsl2rgb(h);\n v.r = h[0];\n v.g = h[1];\n v.b = h[2];\n}\nfunction hslString(v) {\n if (!v) {\n return;\n }\n const a = rgb2hsl(v);\n const h = a[0];\n const s = n2p(a[1]);\n const l = n2p(a[2]);\n return v.a < 255\n ? `hsla(${h}, ${s}%, ${l}%, ${b2n(v.a)})`\n : `hsl(${h}, ${s}%, ${l}%)`;\n}\n\nconst map = {\n x: 'dark',\n Z: 'light',\n Y: 're',\n X: 'blu',\n W: 'gr',\n V: 'medium',\n U: 'slate',\n A: 'ee',\n T: 'ol',\n S: 'or',\n B: 'ra',\n C: 'lateg',\n D: 'ights',\n R: 'in',\n Q: 'turquois',\n E: 'hi',\n P: 'ro',\n O: 'al',\n N: 'le',\n M: 'de',\n L: 'yello',\n F: 'en',\n K: 'ch',\n G: 'arks',\n H: 'ea',\n I: 'ightg',\n J: 'wh'\n};\nconst names$1 = {\n OiceXe: 'f0f8ff',\n antiquewEte: 'faebd7',\n aqua: 'ffff',\n aquamarRe: '7fffd4',\n azuY: 'f0ffff',\n beige: 'f5f5dc',\n bisque: 'ffe4c4',\n black: '0',\n blanKedOmond: 'ffebcd',\n Xe: 'ff',\n XeviTet: '8a2be2',\n bPwn: 'a52a2a',\n burlywood: 'deb887',\n caMtXe: '5f9ea0',\n KartYuse: '7fff00',\n KocTate: 'd2691e',\n cSO: 'ff7f50',\n cSnflowerXe: '6495ed',\n cSnsilk: 'fff8dc',\n crimson: 'dc143c',\n cyan: 'ffff',\n xXe: '8b',\n xcyan: '8b8b',\n xgTMnPd: 'b8860b',\n xWay: 'a9a9a9',\n xgYF: '6400',\n xgYy: 'a9a9a9',\n xkhaki: 'bdb76b',\n xmagFta: '8b008b',\n xTivegYF: '556b2f',\n xSange: 'ff8c00',\n xScEd: '9932cc',\n xYd: '8b0000',\n xsOmon: 'e9967a',\n xsHgYF: '8fbc8f',\n xUXe: '483d8b',\n xUWay: '2f4f4f',\n xUgYy: '2f4f4f',\n xQe: 'ced1',\n xviTet: '9400d3',\n dAppRk: 'ff1493',\n dApskyXe: 'bfff',\n dimWay: '696969',\n dimgYy: '696969',\n dodgerXe: '1e90ff',\n fiYbrick: 'b22222',\n flSOwEte: 'fffaf0',\n foYstWAn: '228b22',\n fuKsia: 'ff00ff',\n gaRsbSo: 'dcdcdc',\n ghostwEte: 'f8f8ff',\n gTd: 'ffd700',\n gTMnPd: 'daa520',\n Way: '808080',\n gYF: '8000',\n gYFLw: 'adff2f',\n gYy: '808080',\n honeyMw: 'f0fff0',\n hotpRk: 'ff69b4',\n RdianYd: 'cd5c5c',\n Rdigo: '4b0082',\n ivSy: 'fffff0',\n khaki: 'f0e68c',\n lavFMr: 'e6e6fa',\n lavFMrXsh: 'fff0f5',\n lawngYF: '7cfc00',\n NmoncEffon: 'fffacd',\n ZXe: 'add8e6',\n ZcSO: 'f08080',\n Zcyan: 'e0ffff',\n ZgTMnPdLw: 'fafad2',\n ZWay: 'd3d3d3',\n ZgYF: '90ee90',\n ZgYy: 'd3d3d3',\n ZpRk: 'ffb6c1',\n ZsOmon: 'ffa07a',\n ZsHgYF: '20b2aa',\n ZskyXe: '87cefa',\n ZUWay: '778899',\n ZUgYy: '778899',\n ZstAlXe: 'b0c4de',\n ZLw: 'ffffe0',\n lime: 'ff00',\n limegYF: '32cd32',\n lRF: 'faf0e6',\n magFta: 'ff00ff',\n maPon: '800000',\n VaquamarRe: '66cdaa',\n VXe: 'cd',\n VScEd: 'ba55d3',\n VpurpN: '9370db',\n VsHgYF: '3cb371',\n VUXe: '7b68ee',\n VsprRggYF: 'fa9a',\n VQe: '48d1cc',\n VviTetYd: 'c71585',\n midnightXe: '191970',\n mRtcYam: 'f5fffa',\n mistyPse: 'ffe4e1',\n moccasR: 'ffe4b5',\n navajowEte: 'ffdead',\n navy: '80',\n Tdlace: 'fdf5e6',\n Tive: '808000',\n TivedBb: '6b8e23',\n Sange: 'ffa500',\n SangeYd: 'ff4500',\n ScEd: 'da70d6',\n pOegTMnPd: 'eee8aa',\n pOegYF: '98fb98',\n pOeQe: 'afeeee',\n pOeviTetYd: 'db7093',\n papayawEp: 'ffefd5',\n pHKpuff: 'ffdab9',\n peru: 'cd853f',\n pRk: 'ffc0cb',\n plum: 'dda0dd',\n powMrXe: 'b0e0e6',\n purpN: '800080',\n YbeccapurpN: '663399',\n Yd: 'ff0000',\n Psybrown: 'bc8f8f',\n PyOXe: '4169e1',\n saddNbPwn: '8b4513',\n sOmon: 'fa8072',\n sandybPwn: 'f4a460',\n sHgYF: '2e8b57',\n sHshell: 'fff5ee',\n siFna: 'a0522d',\n silver: 'c0c0c0',\n skyXe: '87ceeb',\n UXe: '6a5acd',\n UWay: '708090',\n UgYy: '708090',\n snow: 'fffafa',\n sprRggYF: 'ff7f',\n stAlXe: '4682b4',\n tan: 'd2b48c',\n teO: '8080',\n tEstN: 'd8bfd8',\n tomato: 'ff6347',\n Qe: '40e0d0',\n viTet: 'ee82ee',\n JHt: 'f5deb3',\n wEte: 'ffffff',\n wEtesmoke: 'f5f5f5',\n Lw: 'ffff00',\n LwgYF: '9acd32'\n};\nfunction unpack() {\n const unpacked = {};\n const keys = Object.keys(names$1);\n const tkeys = Object.keys(map);\n let i, j, k, ok, nk;\n for (i = 0; i < keys.length; i++) {\n ok = nk = keys[i];\n for (j = 0; j < tkeys.length; j++) {\n k = tkeys[j];\n nk = nk.replace(k, map[k]);\n }\n k = parseInt(names$1[ok], 16);\n unpacked[nk] = [k >> 16 & 0xFF, k >> 8 & 0xFF, k & 0xFF];\n }\n return unpacked;\n}\n\nlet names;\nfunction nameParse(str) {\n if (!names) {\n names = unpack();\n names.transparent = [0, 0, 0, 0];\n }\n const a = names[str.toLowerCase()];\n return a && {\n r: a[0],\n g: a[1],\n b: a[2],\n a: a.length === 4 ? a[3] : 255\n };\n}\n\nconst RGB_RE = /^rgba?\\(\\s*([-+.\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?[\\s,]+([-+.e\\d]+)(%)?(?:[\\s,/]+([-+.e\\d]+)(%)?)?\\s*\\)$/;\nfunction rgbParse(str) {\n const m = RGB_RE.exec(str);\n let a = 255;\n let r, g, b;\n if (!m) {\n return;\n }\n if (m[7] !== r) {\n const v = +m[7];\n a = m[8] ? p2b(v) : lim(v * 255, 0, 255);\n }\n r = +m[1];\n g = +m[3];\n b = +m[5];\n r = 255 & (m[2] ? p2b(r) : lim(r, 0, 255));\n g = 255 & (m[4] ? p2b(g) : lim(g, 0, 255));\n b = 255 & (m[6] ? p2b(b) : lim(b, 0, 255));\n return {\n r: r,\n g: g,\n b: b,\n a: a\n };\n}\nfunction rgbString(v) {\n return v && (\n v.a < 255\n ? `rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`\n : `rgb(${v.r}, ${v.g}, ${v.b})`\n );\n}\n\nconst to = v => v <= 0.0031308 ? v * 12.92 : Math.pow(v, 1.0 / 2.4) * 1.055 - 0.055;\nconst from = v => v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\nfunction interpolate(rgb1, rgb2, t) {\n const r = from(b2n(rgb1.r));\n const g = from(b2n(rgb1.g));\n const b = from(b2n(rgb1.b));\n return {\n r: n2b(to(r + t * (from(b2n(rgb2.r)) - r))),\n g: n2b(to(g + t * (from(b2n(rgb2.g)) - g))),\n b: n2b(to(b + t * (from(b2n(rgb2.b)) - b))),\n a: rgb1.a + t * (rgb2.a - rgb1.a)\n };\n}\n\nfunction modHSL(v, i, ratio) {\n if (v) {\n let tmp = rgb2hsl(v);\n tmp[i] = Math.max(0, Math.min(tmp[i] + tmp[i] * ratio, i === 0 ? 360 : 1));\n tmp = hsl2rgb(tmp);\n v.r = tmp[0];\n v.g = tmp[1];\n v.b = tmp[2];\n }\n}\nfunction clone(v, proto) {\n return v ? Object.assign(proto || {}, v) : v;\n}\nfunction fromObject(input) {\n var v = {r: 0, g: 0, b: 0, a: 255};\n if (Array.isArray(input)) {\n if (input.length >= 3) {\n v = {r: input[0], g: input[1], b: input[2], a: 255};\n if (input.length > 3) {\n v.a = n2b(input[3]);\n }\n }\n } else {\n v = clone(input, {r: 0, g: 0, b: 0, a: 1});\n v.a = n2b(v.a);\n }\n return v;\n}\nfunction functionParse(str) {\n if (str.charAt(0) === 'r') {\n return rgbParse(str);\n }\n return hueParse(str);\n}\nclass Color {\n constructor(input) {\n if (input instanceof Color) {\n return input;\n }\n const type = typeof input;\n let v;\n if (type === 'object') {\n v = fromObject(input);\n } else if (type === 'string') {\n v = hexParse(input) || nameParse(input) || functionParse(input);\n }\n this._rgb = v;\n this._valid = !!v;\n }\n get valid() {\n return this._valid;\n }\n get rgb() {\n var v = clone(this._rgb);\n if (v) {\n v.a = b2n(v.a);\n }\n return v;\n }\n set rgb(obj) {\n this._rgb = fromObject(obj);\n }\n rgbString() {\n return this._valid ? rgbString(this._rgb) : undefined;\n }\n hexString() {\n return this._valid ? hexString(this._rgb) : undefined;\n }\n hslString() {\n return this._valid ? hslString(this._rgb) : undefined;\n }\n mix(color, weight) {\n if (color) {\n const c1 = this.rgb;\n const c2 = color.rgb;\n let w2;\n const p = weight === w2 ? 0.5 : weight;\n const w = 2 * p - 1;\n const a = c1.a - c2.a;\n const w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n w2 = 1 - w1;\n c1.r = 0xFF & w1 * c1.r + w2 * c2.r + 0.5;\n c1.g = 0xFF & w1 * c1.g + w2 * c2.g + 0.5;\n c1.b = 0xFF & w1 * c1.b + w2 * c2.b + 0.5;\n c1.a = p * c1.a + (1 - p) * c2.a;\n this.rgb = c1;\n }\n return this;\n }\n interpolate(color, t) {\n if (color) {\n this._rgb = interpolate(this._rgb, color._rgb, t);\n }\n return this;\n }\n clone() {\n return new Color(this.rgb);\n }\n alpha(a) {\n this._rgb.a = n2b(a);\n return this;\n }\n clearer(ratio) {\n const rgb = this._rgb;\n rgb.a *= 1 - ratio;\n return this;\n }\n greyscale() {\n const rgb = this._rgb;\n const val = round(rgb.r * 0.3 + rgb.g * 0.59 + rgb.b * 0.11);\n rgb.r = rgb.g = rgb.b = val;\n return this;\n }\n opaquer(ratio) {\n const rgb = this._rgb;\n rgb.a *= 1 + ratio;\n return this;\n }\n negate() {\n const v = this._rgb;\n v.r = 255 - v.r;\n v.g = 255 - v.g;\n v.b = 255 - v.b;\n return this;\n }\n lighten(ratio) {\n modHSL(this._rgb, 2, ratio);\n return this;\n }\n darken(ratio) {\n modHSL(this._rgb, 2, -ratio);\n return this;\n }\n saturate(ratio) {\n modHSL(this._rgb, 1, ratio);\n return this;\n }\n desaturate(ratio) {\n modHSL(this._rgb, 1, -ratio);\n return this;\n }\n rotate(deg) {\n rotate(this._rgb, deg);\n return this;\n }\n}\n\nfunction index_esm(input) {\n return new Color(input);\n}\n\nexport { Color, b2n, b2p, index_esm as default, hexParse, hexString, hsl2rgb, hslString, hsv2rgb, hueParse, hwb2rgb, lim, n2b, n2p, nameParse, p2b, rgb2hsl, rgbParse, rgbString, rotate, round };\n","import colorLib, {Color} from '@kurkle/color';\n\nexport function isPatternOrGradient(value: unknown): value is CanvasPattern | CanvasGradient {\n if (value && typeof value === 'object') {\n const type = value.toString();\n return type === '[object CanvasPattern]' || type === '[object CanvasGradient]';\n }\n\n return false;\n}\n\nexport function color(value: CanvasGradient): CanvasGradient;\nexport function color(value: CanvasPattern): CanvasPattern;\nexport function color(\n value:\n | string\n | { r: number; g: number; b: number; a: number }\n | [number, number, number]\n | [number, number, number, number]\n): Color;\nexport function color(value) {\n return isPatternOrGradient(value) ? value : colorLib(value);\n}\n\nexport function getHoverColor(value: CanvasGradient): CanvasGradient;\nexport function getHoverColor(value: CanvasPattern): CanvasPattern;\nexport function getHoverColor(value: string): string;\nexport function getHoverColor(value) {\n return isPatternOrGradient(value)\n ? value\n : colorLib(value).saturate(0.5).darken(0.1).hexString();\n}\n","const numbers = ['x', 'y', 'borderWidth', 'radius', 'tension'];\nconst colors = ['color', 'borderColor', 'backgroundColor'];\n\nexport function applyAnimationsDefaults(defaults) {\n defaults.set('animation', {\n delay: undefined,\n duration: 1000,\n easing: 'easeOutQuart',\n fn: undefined,\n from: undefined,\n loop: undefined,\n to: undefined,\n type: undefined,\n });\n\n defaults.describe('animation', {\n _fallback: false,\n _indexable: false,\n _scriptable: (name) => name !== 'onProgress' && name !== 'onComplete' && name !== 'fn',\n });\n\n defaults.set('animations', {\n colors: {\n type: 'color',\n properties: colors\n },\n numbers: {\n type: 'number',\n properties: numbers\n },\n });\n\n defaults.describe('animations', {\n _fallback: 'animation',\n });\n\n defaults.set('transitions', {\n active: {\n animation: {\n duration: 400\n }\n },\n resize: {\n animation: {\n duration: 0\n }\n },\n show: {\n animations: {\n colors: {\n from: 'transparent'\n },\n visible: {\n type: 'boolean',\n duration: 0 // show immediately\n },\n }\n },\n hide: {\n animations: {\n colors: {\n to: 'transparent'\n },\n visible: {\n type: 'boolean',\n easing: 'linear',\n fn: v => v | 0 // for keeping the dataset visible all the way through the animation\n },\n }\n }\n });\n}\n","\nconst intlCache = new Map();\n\nfunction getNumberFormat(locale: string, options?: Intl.NumberFormatOptions) {\n options = options || {};\n const cacheKey = locale + JSON.stringify(options);\n let formatter = intlCache.get(cacheKey);\n if (!formatter) {\n formatter = new Intl.NumberFormat(locale, options);\n intlCache.set(cacheKey, formatter);\n }\n return formatter;\n}\n\nexport function formatNumber(num: number, locale: string, options?: Intl.NumberFormatOptions) {\n return getNumberFormat(locale, options).format(num);\n}\n","import {isArray} from '../helpers/helpers.core';\nimport {formatNumber} from '../helpers/helpers.intl';\nimport {log10} from '../helpers/helpers.math';\n\n/**\n * Namespace to hold formatters for different types of ticks\n * @namespace Chart.Ticks.formatters\n */\nconst formatters = {\n /**\n * Formatter for value labels\n * @method Chart.Ticks.formatters.values\n * @param value the value to display\n * @return {string|string[]} the label to display\n */\n values(value) {\n return isArray(value) ? /** @type {string[]} */ (value) : '' + value;\n },\n\n /**\n * Formatter for numeric ticks\n * @method Chart.Ticks.formatters.numeric\n * @param tickValue {number} the value to be formatted\n * @param index {number} the position of the tickValue parameter in the ticks array\n * @param ticks {object[]} the list of ticks being converted\n * @return {string} string representation of the tickValue parameter\n */\n numeric(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0'; // never show decimal places for 0\n }\n\n const locale = this.chart.options.locale;\n let notation;\n let delta = tickValue; // This is used when there are less than 2 ticks as the tick interval.\n\n if (ticks.length > 1) {\n // all ticks are small or there huge numbers; use scientific notation\n const maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));\n if (maxTick < 1e-4 || maxTick > 1e+15) {\n notation = 'scientific';\n }\n\n delta = calculateDelta(tickValue, ticks);\n }\n\n const logDelta = log10(Math.abs(delta));\n const numDecimal = Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0); // toFixed has a max of 20 decimal places\n\n const options = {notation, minimumFractionDigits: numDecimal, maximumFractionDigits: numDecimal};\n Object.assign(options, this.options.ticks.format);\n\n return formatNumber(tickValue, locale, options);\n },\n\n\n /**\n * Formatter for logarithmic ticks\n * @method Chart.Ticks.formatters.logarithmic\n * @param tickValue {number} the value to be formatted\n * @param index {number} the position of the tickValue parameter in the ticks array\n * @param ticks {object[]} the list of ticks being converted\n * @return {string} string representation of the tickValue parameter\n */\n logarithmic(tickValue, index, ticks) {\n if (tickValue === 0) {\n return '0';\n }\n const remain = ticks[index].significand || (tickValue / (Math.pow(10, Math.floor(log10(tickValue)))));\n if ([1, 2, 3, 5, 10, 15].includes(remain) || index > 0.8 * ticks.length) {\n return formatters.numeric.call(this, tickValue, index, ticks);\n }\n return '';\n }\n\n};\n\n\nfunction calculateDelta(tickValue, ticks) {\n // Figure out how many digits to show\n // The space between the first two ticks might be smaller than normal spacing\n let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;\n\n // If we have a number like 2.5 as the delta, figure out how many decimal places we need\n if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {\n // not an integer\n delta = tickValue - Math.floor(tickValue);\n }\n return delta;\n}\n\n/**\n * Namespace to hold static tick generation functions\n * @namespace Chart.Ticks\n */\nexport default {formatters};\n","import {getHoverColor} from '../helpers/helpers.color';\nimport {isObject, merge, valueOrDefault} from '../helpers/helpers.core';\nimport {applyAnimationsDefaults} from './core.animations.defaults';\nimport {applyLayoutsDefaults} from './core.layouts.defaults';\nimport {applyScaleDefaults} from './core.scale.defaults';\n\nexport const overrides = Object.create(null);\nexport const descriptors = Object.create(null);\n\n/**\n * @param {object} node\n * @param {string} key\n * @return {object}\n */\nfunction getScope(node, key) {\n if (!key) {\n return node;\n }\n const keys = key.split('.');\n for (let i = 0, n = keys.length; i < n; ++i) {\n const k = keys[i];\n node = node[k] || (node[k] = Object.create(null));\n }\n return node;\n}\n\nfunction set(root, scope, values) {\n if (typeof scope === 'string') {\n return merge(getScope(root, scope), values);\n }\n return merge(getScope(root, ''), scope);\n}\n\n/**\n * Please use the module's default export which provides a singleton instance\n * Note: class is exported for typedoc\n */\nexport class Defaults {\n constructor(_descriptors, _appliers) {\n this.animation = undefined;\n this.backgroundColor = 'rgba(0,0,0,0.1)';\n this.borderColor = 'rgba(0,0,0,0.1)';\n this.color = '#666';\n this.datasets = {};\n this.devicePixelRatio = (context) => context.chart.platform.getDevicePixelRatio();\n this.elements = {};\n this.events = [\n 'mousemove',\n 'mouseout',\n 'click',\n 'touchstart',\n 'touchmove'\n ];\n this.font = {\n family: \"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif\",\n size: 12,\n style: 'normal',\n lineHeight: 1.2,\n weight: null\n };\n this.hover = {};\n this.hoverBackgroundColor = (ctx, options) => getHoverColor(options.backgroundColor);\n this.hoverBorderColor = (ctx, options) => getHoverColor(options.borderColor);\n this.hoverColor = (ctx, options) => getHoverColor(options.color);\n this.indexAxis = 'x';\n this.interaction = {\n mode: 'nearest',\n intersect: true,\n includeInvisible: false\n };\n this.maintainAspectRatio = true;\n this.onHover = null;\n this.onClick = null;\n this.parsing = true;\n this.plugins = {};\n this.responsive = true;\n this.scale = undefined;\n this.scales = {};\n this.showLine = true;\n this.drawActiveElementsOnTop = true;\n\n this.describe(_descriptors);\n this.apply(_appliers);\n }\n\n /**\n\t * @param {string|object} scope\n\t * @param {object} [values]\n\t */\n set(scope, values) {\n return set(this, scope, values);\n }\n\n /**\n\t * @param {string} scope\n\t */\n get(scope) {\n return getScope(this, scope);\n }\n\n /**\n\t * @param {string|object} scope\n\t * @param {object} [values]\n\t */\n describe(scope, values) {\n return set(descriptors, scope, values);\n }\n\n override(scope, values) {\n return set(overrides, scope, values);\n }\n\n /**\n\t * Routes the named defaults to fallback to another scope/name.\n\t * This routing is useful when those target values, like defaults.color, are changed runtime.\n\t * If the values would be copied, the runtime change would not take effect. By routing, the\n\t * fallback is evaluated at each access, so its always up to date.\n\t *\n\t * Example:\n\t *\n\t * \tdefaults.route('elements.arc', 'backgroundColor', '', 'color')\n\t * - reads the backgroundColor from defaults.color when undefined locally\n\t *\n\t * @param {string} scope Scope this route applies to.\n\t * @param {string} name Property name that should be routed to different namespace when not defined here.\n\t * @param {string} targetScope The namespace where those properties should be routed to.\n\t * Empty string ('') is the root of defaults.\n\t * @param {string} targetName The target name in the target scope the property should be routed to.\n\t */\n route(scope, name, targetScope, targetName) {\n const scopeObject = getScope(this, scope);\n const targetScopeObject = getScope(this, targetScope);\n const privateName = '_' + name;\n\n Object.defineProperties(scopeObject, {\n // A private property is defined to hold the actual value, when this property is set in its scope (set in the setter)\n [privateName]: {\n value: scopeObject[name],\n writable: true\n },\n // The actual property is defined as getter/setter so we can do the routing when value is not locally set.\n [name]: {\n enumerable: true,\n get() {\n const local = this[privateName];\n const target = targetScopeObject[targetName];\n if (isObject(local)) {\n return Object.assign({}, target, local);\n }\n return valueOrDefault(local, target);\n },\n set(value) {\n this[privateName] = value;\n }\n }\n });\n }\n\n apply(appliers) {\n appliers.forEach((apply) => apply(this));\n }\n}\n\n// singleton instance\nexport default /* #__PURE__ */ new Defaults({\n _scriptable: (name) => !name.startsWith('on'),\n _indexable: (name) => name !== 'events',\n hover: {\n _fallback: 'interaction'\n },\n interaction: {\n _scriptable: false,\n _indexable: false,\n }\n}, [applyAnimationsDefaults, applyLayoutsDefaults, applyScaleDefaults]);\n","export function applyLayoutsDefaults(defaults) {\n defaults.set('layout', {\n autoPadding: true,\n padding: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n }\n });\n}\n","import Ticks from './core.ticks';\n\nexport function applyScaleDefaults(defaults) {\n defaults.set('scale', {\n display: true,\n offset: false,\n reverse: false,\n beginAtZero: false,\n\n /**\n * Scale boundary strategy (bypassed by min/max time options)\n * - `data`: make sure data are fully visible, ticks outside are removed\n * - `ticks`: make sure ticks are fully visible, data outside are truncated\n * @see https://github.com/chartjs/Chart.js/pull/4556\n * @since 3.0.0\n */\n bounds: 'ticks',\n\n /**\n * Addition grace added to max and reduced from min data value.\n * @since 3.0.0\n */\n grace: 0,\n\n // grid line settings\n grid: {\n display: true,\n lineWidth: 1,\n drawOnChartArea: true,\n drawTicks: true,\n tickLength: 8,\n tickWidth: (_ctx, options) => options.lineWidth,\n tickColor: (_ctx, options) => options.color,\n offset: false,\n },\n\n border: {\n display: true,\n dash: [],\n dashOffset: 0.0,\n width: 1\n },\n\n // scale title\n title: {\n // display property\n display: false,\n\n // actual label\n text: '',\n\n // top/bottom padding\n padding: {\n top: 4,\n bottom: 4\n }\n },\n\n // label settings\n ticks: {\n minRotation: 0,\n maxRotation: 50,\n mirror: false,\n textStrokeWidth: 0,\n textStrokeColor: '',\n padding: 3,\n display: true,\n autoSkip: true,\n autoSkipPadding: 3,\n labelOffset: 0,\n // We pass through arrays to be rendered as multiline labels, we convert Others to strings here.\n callback: Ticks.formatters.values,\n minor: {},\n major: {},\n align: 'center',\n crossAlign: 'near',\n\n showLabelBackdrop: false,\n backdropColor: 'rgba(255, 255, 255, 0.75)',\n backdropPadding: 2,\n }\n });\n\n defaults.route('scale.ticks', 'color', '', 'color');\n defaults.route('scale.grid', 'color', '', 'borderColor');\n defaults.route('scale.border', 'color', '', 'borderColor');\n defaults.route('scale.title', 'color', '', 'color');\n\n defaults.describe('scale', {\n _fallback: false,\n _scriptable: (name) => !name.startsWith('before') && !name.startsWith('after') && name !== 'callback' && name !== 'parser',\n _indexable: (name) => name !== 'borderDash' && name !== 'tickBorderDash' && name !== 'dash',\n });\n\n defaults.describe('scales', {\n _fallback: 'scale',\n });\n\n defaults.describe('scale.ticks', {\n _scriptable: (name) => name !== 'backdropPadding' && name !== 'callback',\n _indexable: (name) => name !== 'backdropPadding',\n });\n}\n","import {ChartArea, Scale} from '../../types';\nimport Chart from '../core/core.controller';\nimport {ChartEvent} from '../types';\nimport {INFINITY} from './helpers.math';\n\n/**\n * Note: typedefs are auto-exported, so use a made-up `dom` namespace where\n * necessary to avoid duplicates with `export * from './helpers`; see\n * https://github.com/microsoft/TypeScript/issues/46011\n * @typedef { import(\"../core/core.controller\").default } dom.Chart\n * @typedef { import('../../types').ChartEvent } ChartEvent\n */\n\n/**\n * @private\n */\nexport function _isDomSupported(): boolean {\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}\n\n/**\n * @private\n */\nexport function _getParentNode(domNode: HTMLCanvasElement): HTMLCanvasElement {\n let parent = domNode.parentNode;\n if (parent && parent.toString() === '[object ShadowRoot]') {\n parent = (parent as ShadowRoot).host;\n }\n return parent as HTMLCanvasElement;\n}\n\n/**\n * convert max-width/max-height values that may be percentages into a number\n * @private\n */\n\nfunction parseMaxStyle(styleValue: string | number, node: HTMLElement, parentProperty: string) {\n let valueInPixels: number;\n if (typeof styleValue === 'string') {\n valueInPixels = parseInt(styleValue, 10);\n\n if (styleValue.indexOf('%') !== -1) {\n // percentage * size in dimension\n valueInPixels = (valueInPixels / 100) * node.parentNode[parentProperty];\n }\n } else {\n valueInPixels = styleValue;\n }\n\n return valueInPixels;\n}\n\nconst getComputedStyle = (element: HTMLElement): CSSStyleDeclaration =>\n element.ownerDocument.defaultView.getComputedStyle(element, null);\n\nexport function getStyle(el: HTMLElement, property: string): string {\n return getComputedStyle(el).getPropertyValue(property);\n}\n\nconst positions = ['top', 'right', 'bottom', 'left'];\nfunction getPositionedStyle(styles: CSSStyleDeclaration, style: string, suffix?: string): ChartArea {\n const result = {} as ChartArea;\n suffix = suffix ? '-' + suffix : '';\n for (let i = 0; i < 4; i++) {\n const pos = positions[i];\n result[pos] = parseFloat(styles[style + '-' + pos + suffix]) || 0;\n }\n result.width = result.left + result.right;\n result.height = result.top + result.bottom;\n return result;\n}\n\nconst useOffsetPos = (x: number, y: number, target: HTMLElement | EventTarget) =>\n (x > 0 || y > 0) && (!target || !(target as HTMLElement).shadowRoot);\n\n/**\n * @param e\n * @param canvas\n * @returns Canvas position\n */\nfunction getCanvasPosition(\n e: Event | TouchEvent | MouseEvent,\n canvas: HTMLCanvasElement\n): {\n x: number;\n y: number;\n box: boolean;\n } {\n const touches = (e as TouchEvent).touches;\n const source = (touches && touches.length ? touches[0] : e) as MouseEvent;\n const {offsetX, offsetY} = source as MouseEvent;\n let box = false;\n let x, y;\n if (useOffsetPos(offsetX, offsetY, e.target)) {\n x = offsetX;\n y = offsetY;\n } else {\n const rect = canvas.getBoundingClientRect();\n x = source.clientX - rect.left;\n y = source.clientY - rect.top;\n box = true;\n }\n return {x, y, box};\n}\n\n/**\n * Gets an event's x, y coordinates, relative to the chart area\n * @param event\n * @param chart\n * @returns x and y coordinates of the event\n */\n\nexport function getRelativePosition(\n event: Event | ChartEvent | TouchEvent | MouseEvent,\n chart: Chart\n): { x: number; y: number } {\n if ('native' in event) {\n return event;\n }\n\n const {canvas, currentDevicePixelRatio} = chart;\n const style = getComputedStyle(canvas);\n const borderBox = style.boxSizing === 'border-box';\n const paddings = getPositionedStyle(style, 'padding');\n const borders = getPositionedStyle(style, 'border', 'width');\n const {x, y, box} = getCanvasPosition(event, canvas);\n const xOffset = paddings.left + (box && borders.left);\n const yOffset = paddings.top + (box && borders.top);\n\n let {width, height} = chart;\n if (borderBox) {\n width -= paddings.width + borders.width;\n height -= paddings.height + borders.height;\n }\n return {\n x: Math.round((x - xOffset) / width * canvas.width / currentDevicePixelRatio),\n y: Math.round((y - yOffset) / height * canvas.height / currentDevicePixelRatio)\n };\n}\n\nfunction getContainerSize(canvas: HTMLCanvasElement, width: number, height: number): Partial {\n let maxWidth: number, maxHeight: number;\n\n if (width === undefined || height === undefined) {\n const container = _getParentNode(canvas);\n if (!container) {\n width = canvas.clientWidth;\n height = canvas.clientHeight;\n } else {\n const rect = container.getBoundingClientRect(); // this is the border box of the container\n const containerStyle = getComputedStyle(container);\n const containerBorder = getPositionedStyle(containerStyle, 'border', 'width');\n const containerPadding = getPositionedStyle(containerStyle, 'padding');\n width = rect.width - containerPadding.width - containerBorder.width;\n height = rect.height - containerPadding.height - containerBorder.height;\n maxWidth = parseMaxStyle(containerStyle.maxWidth, container, 'clientWidth');\n maxHeight = parseMaxStyle(containerStyle.maxHeight, container, 'clientHeight');\n }\n }\n return {\n width,\n height,\n maxWidth: maxWidth || INFINITY,\n maxHeight: maxHeight || INFINITY\n };\n}\n\nconst round1 = (v: number) => Math.round(v * 10) / 10;\n\n// eslint-disable-next-line complexity\nexport function getMaximumSize(\n canvas: HTMLCanvasElement,\n bbWidth?: number,\n bbHeight?: number,\n aspectRatio?: number\n): { width: number; height: number } {\n const style = getComputedStyle(canvas);\n const margins = getPositionedStyle(style, 'margin');\n const maxWidth = parseMaxStyle(style.maxWidth, canvas, 'clientWidth') || INFINITY;\n const maxHeight = parseMaxStyle(style.maxHeight, canvas, 'clientHeight') || INFINITY;\n const containerSize = getContainerSize(canvas, bbWidth, bbHeight);\n let {width, height} = containerSize;\n\n if (style.boxSizing === 'content-box') {\n const borders = getPositionedStyle(style, 'border', 'width');\n const paddings = getPositionedStyle(style, 'padding');\n width -= paddings.width + borders.width;\n height -= paddings.height + borders.height;\n }\n width = Math.max(0, width - margins.width);\n height = Math.max(0, aspectRatio ? Math.floor(width / aspectRatio) : height - margins.height);\n width = round1(Math.min(width, maxWidth, containerSize.maxWidth));\n height = round1(Math.min(height, maxHeight, containerSize.maxHeight));\n if (width && !height) {\n // https://github.com/chartjs/Chart.js/issues/4659\n // If the canvas has width, but no height, default to aspectRatio of 2 (canvas default)\n height = round1(width / 2);\n }\n\n const maintainHeight = bbWidth !== undefined || bbHeight !== undefined;\n\n if (maintainHeight && aspectRatio && containerSize.height && height > containerSize.height) {\n height = containerSize.height;\n width = round1(Math.floor(height * aspectRatio));\n }\n\n return {width, height};\n}\n\n/**\n * @param chart\n * @param forceRatio\n * @param forceStyle\n * @returns True if the canvas context size or transformation has changed.\n */\nexport function retinaScale(\n chart: Chart,\n forceRatio: number,\n forceStyle?: boolean\n): boolean | void {\n const pixelRatio = forceRatio || 1;\n const deviceHeight = Math.floor(chart.height * pixelRatio);\n const deviceWidth = Math.floor(chart.width * pixelRatio);\n\n chart.height = deviceHeight / pixelRatio;\n chart.width = deviceWidth / pixelRatio;\n\n const canvas = chart.canvas;\n\n // If no style has been set on the canvas, the render size is used as display size,\n // making the chart visually bigger, so let's enforce it to the \"correct\" values.\n // See https://github.com/chartjs/Chart.js/issues/3575\n if (canvas.style && (forceStyle || (!canvas.style.height && !canvas.style.width))) {\n canvas.style.height = `${chart.height}px`;\n canvas.style.width = `${chart.width}px`;\n }\n\n if (chart.currentDevicePixelRatio !== pixelRatio\n || canvas.height !== deviceHeight\n || canvas.width !== deviceWidth) {\n chart.currentDevicePixelRatio = pixelRatio;\n canvas.height = deviceHeight;\n canvas.width = deviceWidth;\n chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n return true;\n }\n return false;\n}\n\n/**\n * Detects support for options object argument in addEventListener.\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support\n * @private\n */\nexport const supportsEventListenerOptions = (function() {\n let passiveSupported = false;\n try {\n const options = {\n get passive() { // This function will be called when the browser attempts to access the passive property.\n passiveSupported = true;\n return false;\n }\n } as EventListenerOptions;\n\n window.addEventListener('test', null, options);\n window.removeEventListener('test', null, options);\n } catch (e) {\n // continue regardless of error\n }\n return passiveSupported;\n}());\n\n/**\n * The \"used\" size is the final value of a dimension property after all calculations have\n * been performed. This method uses the computed style of `element` but returns undefined\n * if the computed style is not expressed in pixels. That can happen in some cases where\n * `element` has a size relative to its parent and this last one is not yet displayed,\n * for example because of `display: none` on a parent node.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value\n * @returns Size in pixels or undefined if unknown.\n */\n\nexport function readUsedSize(\n element: HTMLElement,\n property: 'width' | 'height'\n): number | undefined {\n const value = getStyle(element, property);\n const matches = value && value.match(/^(\\d+)(\\.\\d+)?px$/);\n return matches ? +matches[1] : undefined;\n}\n","import {isArray, isNullOrUndef} from './helpers.core';\nimport {PI, TAU, HALF_PI, QUARTER_PI, TWO_THIRDS_PI, RAD_PER_DEG} from './helpers.math';\n\n/**\n * Note: typedefs are auto-exported, so use a made-up `canvas` namespace where\n * necessary to avoid duplicates with `export * from './helpers`; see\n * https://github.com/microsoft/TypeScript/issues/46011\n * @typedef { import(\"../core/core.controller\").default } canvas.Chart\n * @typedef { import(\"../../types\").Point } Point\n */\n\n/**\n * @namespace Chart.helpers.canvas\n */\n\n/**\n * Converts the given font object into a CSS font string.\n * @param {object} font - A font object.\n * @return {string|null} The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font\n * @private\n */\nexport function toFontString(font) {\n if (!font || isNullOrUndef(font.size) || isNullOrUndef(font.family)) {\n return null;\n }\n\n return (font.style ? font.style + ' ' : '')\n\t\t+ (font.weight ? font.weight + ' ' : '')\n\t\t+ font.size + 'px '\n\t\t+ font.family;\n}\n\n/**\n * @private\n */\nexport function _measureText(ctx, data, gc, longest, string) {\n let textWidth = data[string];\n if (!textWidth) {\n textWidth = data[string] = ctx.measureText(string).width;\n gc.push(string);\n }\n if (textWidth > longest) {\n longest = textWidth;\n }\n return longest;\n}\n\n/**\n * @private\n */\nexport function _longestText(ctx, font, arrayOfThings, cache) {\n cache = cache || {};\n let data = cache.data = cache.data || {};\n let gc = cache.garbageCollect = cache.garbageCollect || [];\n\n if (cache.font !== font) {\n data = cache.data = {};\n gc = cache.garbageCollect = [];\n cache.font = font;\n }\n\n ctx.save();\n\n ctx.font = font;\n let longest = 0;\n const ilen = arrayOfThings.length;\n let i, j, jlen, thing, nestedThing;\n for (i = 0; i < ilen; i++) {\n thing = arrayOfThings[i];\n\n // Undefined strings and arrays should not be measured\n if (thing !== undefined && thing !== null && isArray(thing) !== true) {\n longest = _measureText(ctx, data, gc, longest, thing);\n } else if (isArray(thing)) {\n // if it is an array lets measure each element\n // to do maybe simplify this function a bit so we can do this more recursively?\n for (j = 0, jlen = thing.length; j < jlen; j++) {\n nestedThing = thing[j];\n // Undefined strings and arrays should not be measured\n if (nestedThing !== undefined && nestedThing !== null && !isArray(nestedThing)) {\n longest = _measureText(ctx, data, gc, longest, nestedThing);\n }\n }\n }\n }\n\n ctx.restore();\n\n const gcLen = gc.length / 2;\n if (gcLen > arrayOfThings.length) {\n for (i = 0; i < gcLen; i++) {\n delete data[gc[i]];\n }\n gc.splice(0, gcLen);\n }\n return longest;\n}\n\n/**\n * Returns the aligned pixel value to avoid anti-aliasing blur\n * @param {canvas.Chart} chart - The chart instance.\n * @param {number} pixel - A pixel value.\n * @param {number} width - The width of the element.\n * @returns {number} The aligned pixel value.\n * @private\n */\nexport function _alignPixel(chart, pixel, width) {\n const devicePixelRatio = chart.currentDevicePixelRatio;\n const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;\n return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;\n}\n\n/**\n * Clears the entire canvas.\n * @param {HTMLCanvasElement} canvas\n * @param {CanvasRenderingContext2D} [ctx]\n */\nexport function clearCanvas(canvas, ctx) {\n ctx = ctx || canvas.getContext('2d');\n\n ctx.save();\n // canvas.width and canvas.height do not consider the canvas transform,\n // while clearRect does\n ctx.resetTransform();\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.restore();\n}\n\nexport function drawPoint(ctx, options, x, y) {\n drawPointLegend(ctx, options, x, y, null);\n}\n\nexport function drawPointLegend(ctx, options, x, y, w) {\n let type, xOffset, yOffset, size, cornerRadius, width, xOffsetW, yOffsetW;\n const style = options.pointStyle;\n const rotation = options.rotation;\n const radius = options.radius;\n let rad = (rotation || 0) * RAD_PER_DEG;\n\n if (style && typeof style === 'object') {\n type = style.toString();\n if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {\n ctx.save();\n ctx.translate(x, y);\n ctx.rotate(rad);\n ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);\n ctx.restore();\n return;\n }\n }\n\n if (isNaN(radius) || radius <= 0) {\n return;\n }\n\n ctx.beginPath();\n\n switch (style) {\n // Default includes circle\n default:\n if (w) {\n ctx.ellipse(x, y, w / 2, radius, 0, 0, TAU);\n } else {\n ctx.arc(x, y, radius, 0, TAU);\n }\n ctx.closePath();\n break;\n case 'triangle':\n width = w ? w / 2 : radius;\n ctx.moveTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);\n rad += TWO_THIRDS_PI;\n ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);\n rad += TWO_THIRDS_PI;\n ctx.lineTo(x + Math.sin(rad) * width, y - Math.cos(rad) * radius);\n ctx.closePath();\n break;\n case 'rectRounded':\n // NOTE: the rounded rect implementation changed to use `arc` instead of\n // `quadraticCurveTo` since it generates better results when rect is\n // almost a circle. 0.516 (instead of 0.5) produces results with visually\n // closer proportion to the previous impl and it is inscribed in the\n // circle with `radius`. For more details, see the following PRs:\n // https://github.com/chartjs/Chart.js/issues/5597\n // https://github.com/chartjs/Chart.js/issues/5858\n cornerRadius = radius * 0.516;\n size = radius - cornerRadius;\n xOffset = Math.cos(rad + QUARTER_PI) * size;\n xOffsetW = Math.cos(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);\n yOffset = Math.sin(rad + QUARTER_PI) * size;\n yOffsetW = Math.sin(rad + QUARTER_PI) * (w ? w / 2 - cornerRadius : size);\n ctx.arc(x - xOffsetW, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);\n ctx.arc(x + yOffsetW, y - xOffset, cornerRadius, rad - HALF_PI, rad);\n ctx.arc(x + xOffsetW, y + yOffset, cornerRadius, rad, rad + HALF_PI);\n ctx.arc(x - yOffsetW, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);\n ctx.closePath();\n break;\n case 'rect':\n if (!rotation) {\n size = Math.SQRT1_2 * radius;\n width = w ? w / 2 : size;\n ctx.rect(x - width, y - size, 2 * width, 2 * size);\n break;\n }\n rad += QUARTER_PI;\n /* falls through */\n case 'rectRot':\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n ctx.closePath();\n break;\n case 'crossRot':\n rad += QUARTER_PI;\n /* falls through */\n case 'cross':\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.moveTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n break;\n case 'star':\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.moveTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n rad += QUARTER_PI;\n xOffsetW = Math.cos(rad) * (w ? w / 2 : radius);\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n yOffsetW = Math.sin(rad) * (w ? w / 2 : radius);\n ctx.moveTo(x - xOffsetW, y - yOffset);\n ctx.lineTo(x + xOffsetW, y + yOffset);\n ctx.moveTo(x + yOffsetW, y - xOffset);\n ctx.lineTo(x - yOffsetW, y + xOffset);\n break;\n case 'line':\n xOffset = w ? w / 2 : Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n ctx.moveTo(x - xOffset, y - yOffset);\n ctx.lineTo(x + xOffset, y + yOffset);\n break;\n case 'dash':\n ctx.moveTo(x, y);\n ctx.lineTo(x + Math.cos(rad) * (w ? w / 2 : radius), y + Math.sin(rad) * radius);\n break;\n }\n\n ctx.fill();\n if (options.borderWidth > 0) {\n ctx.stroke();\n }\n}\n\n/**\n * Returns true if the point is inside the rectangle\n * @param {Point} point - The point to test\n * @param {object} area - The rectangle\n * @param {number} [margin] - allowed margin\n * @returns {boolean}\n * @private\n */\nexport function _isPointInArea(point, area, margin) {\n margin = margin || 0.5; // margin - default is to match rounded decimals\n\n return !area || (point && point.x > area.left - margin && point.x < area.right + margin &&\n\t\tpoint.y > area.top - margin && point.y < area.bottom + margin);\n}\n\nexport function clipArea(ctx, area) {\n ctx.save();\n ctx.beginPath();\n ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);\n ctx.clip();\n}\n\nexport function unclipArea(ctx) {\n ctx.restore();\n}\n\n/**\n * @private\n */\nexport function _steppedLineTo(ctx, previous, target, flip, mode) {\n if (!previous) {\n return ctx.lineTo(target.x, target.y);\n }\n if (mode === 'middle') {\n const midpoint = (previous.x + target.x) / 2.0;\n ctx.lineTo(midpoint, previous.y);\n ctx.lineTo(midpoint, target.y);\n } else if (mode === 'after' !== !!flip) {\n ctx.lineTo(previous.x, target.y);\n } else {\n ctx.lineTo(target.x, previous.y);\n }\n ctx.lineTo(target.x, target.y);\n}\n\n/**\n * @private\n */\nexport function _bezierCurveTo(ctx, previous, target, flip) {\n if (!previous) {\n return ctx.lineTo(target.x, target.y);\n }\n ctx.bezierCurveTo(\n flip ? previous.cp1x : previous.cp2x,\n flip ? previous.cp1y : previous.cp2y,\n flip ? target.cp2x : target.cp1x,\n flip ? target.cp2y : target.cp1y,\n target.x,\n target.y);\n}\n\n/**\n * Render text onto the canvas\n */\nexport function renderText(ctx, text, x, y, font, opts = {}) {\n const lines = isArray(text) ? text : [text];\n const stroke = opts.strokeWidth > 0 && opts.strokeColor !== '';\n let i, line;\n\n ctx.save();\n ctx.font = font.string;\n setRenderOpts(ctx, opts);\n\n for (i = 0; i < lines.length; ++i) {\n line = lines[i];\n\n if (opts.backdrop) {\n drawBackdrop(ctx, opts.backdrop);\n }\n\n if (stroke) {\n if (opts.strokeColor) {\n ctx.strokeStyle = opts.strokeColor;\n }\n\n if (!isNullOrUndef(opts.strokeWidth)) {\n ctx.lineWidth = opts.strokeWidth;\n }\n\n ctx.strokeText(line, x, y, opts.maxWidth);\n }\n\n ctx.fillText(line, x, y, opts.maxWidth);\n decorateText(ctx, x, y, line, opts);\n\n y += font.lineHeight;\n }\n\n ctx.restore();\n}\n\nfunction setRenderOpts(ctx, opts) {\n if (opts.translation) {\n ctx.translate(opts.translation[0], opts.translation[1]);\n }\n\n if (!isNullOrUndef(opts.rotation)) {\n ctx.rotate(opts.rotation);\n }\n\n if (opts.color) {\n ctx.fillStyle = opts.color;\n }\n\n if (opts.textAlign) {\n ctx.textAlign = opts.textAlign;\n }\n\n if (opts.textBaseline) {\n ctx.textBaseline = opts.textBaseline;\n }\n}\n\nfunction decorateText(ctx, x, y, line, opts) {\n if (opts.strikethrough || opts.underline) {\n /**\n * Now that IE11 support has been dropped, we can use more\n * of the TextMetrics object. The actual bounding boxes\n * are unflagged in Chrome, Firefox, Edge, and Safari so they\n * can be safely used.\n * See https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics#Browser_compatibility\n */\n const metrics = ctx.measureText(line);\n const left = x - metrics.actualBoundingBoxLeft;\n const right = x + metrics.actualBoundingBoxRight;\n const top = y - metrics.actualBoundingBoxAscent;\n const bottom = y + metrics.actualBoundingBoxDescent;\n const yDecoration = opts.strikethrough ? (top + bottom) / 2 : bottom;\n\n ctx.strokeStyle = ctx.fillStyle;\n ctx.beginPath();\n ctx.lineWidth = opts.decorationWidth || 2;\n ctx.moveTo(left, yDecoration);\n ctx.lineTo(right, yDecoration);\n ctx.stroke();\n }\n}\n\nfunction drawBackdrop(ctx, opts) {\n const oldColor = ctx.fillStyle;\n\n ctx.fillStyle = opts.color;\n ctx.fillRect(opts.left, opts.top, opts.width, opts.height);\n ctx.fillStyle = oldColor;\n}\n\n/**\n * Add a path of a rectangle with rounded corners to the current sub-path\n * @param {CanvasRenderingContext2D} ctx Context\n * @param {*} rect Bounding rect\n */\nexport function addRoundedRectPath(ctx, rect) {\n const {x, y, w, h, radius} = rect;\n\n // top left arc\n ctx.arc(x + radius.topLeft, y + radius.topLeft, radius.topLeft, -HALF_PI, PI, true);\n\n // line from top left to bottom left\n ctx.lineTo(x, y + h - radius.bottomLeft);\n\n // bottom left arc\n ctx.arc(x + radius.bottomLeft, y + h - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);\n\n // line from bottom left to bottom right\n ctx.lineTo(x + w - radius.bottomRight, y + h);\n\n // bottom right arc\n ctx.arc(x + w - radius.bottomRight, y + h - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);\n\n // line from bottom right to top right\n ctx.lineTo(x + w, y + radius.topRight);\n\n // top right arc\n ctx.arc(x + w - radius.topRight, y + radius.topRight, radius.topRight, 0, -HALF_PI, true);\n\n // line from top right to top left\n ctx.lineTo(x + radius.topLeft, y);\n}\n","import {defined, isArray, isFunction, isObject, resolveObjectKey, _capitalize} from './helpers.core';\n\n/**\n * Creates a Proxy for resolving raw values for options.\n * @param {object[]} scopes - The option scopes to look for values, in resolution order\n * @param {string[]} [prefixes] - The prefixes for values, in resolution order.\n * @param {object[]} [rootScopes] - The root option scopes\n * @param {string|boolean} [fallback] - Parent scopes fallback\n * @param {function} [getTarget] - callback for getting the target for changed values\n * @returns Proxy\n * @private\n */\nexport function _createResolver(scopes, prefixes = [''], rootScopes = scopes, fallback, getTarget = () => scopes[0]) {\n if (!defined(fallback)) {\n fallback = _resolve('_fallback', scopes);\n }\n const cache = {\n [Symbol.toStringTag]: 'Object',\n _cacheable: true,\n _scopes: scopes,\n _rootScopes: rootScopes,\n _fallback: fallback,\n _getTarget: getTarget,\n override: (scope) => _createResolver([scope, ...scopes], prefixes, rootScopes, fallback),\n };\n return new Proxy(cache, {\n /**\n * A trap for the delete operator.\n */\n deleteProperty(target, prop) {\n delete target[prop]; // remove from cache\n delete target._keys; // remove cached keys\n delete scopes[0][prop]; // remove from top level scope\n return true;\n },\n\n /**\n * A trap for getting property values.\n */\n get(target, prop) {\n return _cached(target, prop,\n () => _resolveWithPrefixes(prop, prefixes, scopes, target));\n },\n\n /**\n * A trap for Object.getOwnPropertyDescriptor.\n * Also used by Object.hasOwnProperty.\n */\n getOwnPropertyDescriptor(target, prop) {\n return Reflect.getOwnPropertyDescriptor(target._scopes[0], prop);\n },\n\n /**\n * A trap for Object.getPrototypeOf.\n */\n getPrototypeOf() {\n return Reflect.getPrototypeOf(scopes[0]);\n },\n\n /**\n * A trap for the in operator.\n */\n has(target, prop) {\n return getKeysFromAllScopes(target).includes(prop);\n },\n\n /**\n * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.\n */\n ownKeys(target) {\n return getKeysFromAllScopes(target);\n },\n\n /**\n * A trap for setting property values.\n */\n set(target, prop, value) {\n const storage = target._storage || (target._storage = getTarget());\n target[prop] = storage[prop] = value; // set to top level scope + cache\n delete target._keys; // remove cached keys\n return true;\n }\n });\n}\n\n/**\n * Returns an Proxy for resolving option values with context.\n * @param {object} proxy - The Proxy returned by `_createResolver`\n * @param {object} context - Context object for scriptable/indexable options\n * @param {object} [subProxy] - The proxy provided for scriptable options\n * @param {{scriptable: boolean, indexable: boolean, allKeys?: boolean}} [descriptorDefaults] - Defaults for descriptors\n * @private\n */\nexport function _attachContext(proxy, context, subProxy, descriptorDefaults) {\n const cache = {\n _cacheable: false,\n _proxy: proxy,\n _context: context,\n _subProxy: subProxy,\n _stack: new Set(),\n _descriptors: _descriptors(proxy, descriptorDefaults),\n setContext: (ctx) => _attachContext(proxy, ctx, subProxy, descriptorDefaults),\n override: (scope) => _attachContext(proxy.override(scope), context, subProxy, descriptorDefaults)\n };\n return new Proxy(cache, {\n /**\n * A trap for the delete operator.\n */\n deleteProperty(target, prop) {\n delete target[prop]; // remove from cache\n delete proxy[prop]; // remove from proxy\n return true;\n },\n\n /**\n * A trap for getting property values.\n */\n get(target, prop, receiver) {\n return _cached(target, prop,\n () => _resolveWithContext(target, prop, receiver));\n },\n\n /**\n * A trap for Object.getOwnPropertyDescriptor.\n * Also used by Object.hasOwnProperty.\n */\n getOwnPropertyDescriptor(target, prop) {\n return target._descriptors.allKeys\n ? Reflect.has(proxy, prop) ? {enumerable: true, configurable: true} : undefined\n : Reflect.getOwnPropertyDescriptor(proxy, prop);\n },\n\n /**\n * A trap for Object.getPrototypeOf.\n */\n getPrototypeOf() {\n return Reflect.getPrototypeOf(proxy);\n },\n\n /**\n * A trap for the in operator.\n */\n has(target, prop) {\n return Reflect.has(proxy, prop);\n },\n\n /**\n * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.\n */\n ownKeys() {\n return Reflect.ownKeys(proxy);\n },\n\n /**\n * A trap for setting property values.\n */\n set(target, prop, value) {\n proxy[prop] = value; // set to proxy\n delete target[prop]; // remove from cache\n return true;\n }\n });\n}\n\n/**\n * @private\n */\nexport function _descriptors(proxy, defaults = {scriptable: true, indexable: true}) {\n const {_scriptable = defaults.scriptable, _indexable = defaults.indexable, _allKeys = defaults.allKeys} = proxy;\n return {\n allKeys: _allKeys,\n scriptable: _scriptable,\n indexable: _indexable,\n isScriptable: isFunction(_scriptable) ? _scriptable : () => _scriptable,\n isIndexable: isFunction(_indexable) ? _indexable : () => _indexable\n };\n}\n\nconst readKey = (prefix, name) => prefix ? prefix + _capitalize(name) : name;\nconst needsSubResolver = (prop, value) => isObject(value) && prop !== 'adapters' &&\n (Object.getPrototypeOf(value) === null || value.constructor === Object);\n\nfunction _cached(target, prop, resolve) {\n if (Object.prototype.hasOwnProperty.call(target, prop)) {\n return target[prop];\n }\n\n const value = resolve();\n // cache the resolved value\n target[prop] = value;\n return value;\n}\n\nfunction _resolveWithContext(target, prop, receiver) {\n const {_proxy, _context, _subProxy, _descriptors: descriptors} = target;\n let value = _proxy[prop]; // resolve from proxy\n\n // resolve with context\n if (isFunction(value) && descriptors.isScriptable(prop)) {\n value = _resolveScriptable(prop, value, target, receiver);\n }\n if (isArray(value) && value.length) {\n value = _resolveArray(prop, value, target, descriptors.isIndexable);\n }\n if (needsSubResolver(prop, value)) {\n // if the resolved value is an object, create a sub resolver for it\n value = _attachContext(value, _context, _subProxy && _subProxy[prop], descriptors);\n }\n return value;\n}\n\nfunction _resolveScriptable(prop, value, target, receiver) {\n const {_proxy, _context, _subProxy, _stack} = target;\n if (_stack.has(prop)) {\n // @ts-ignore\n throw new Error('Recursion detected: ' + Array.from(_stack).join('->') + '->' + prop);\n }\n _stack.add(prop);\n value = value(_context, _subProxy || receiver);\n _stack.delete(prop);\n if (needsSubResolver(prop, value)) {\n // When scriptable option returns an object, create a resolver on that.\n value = createSubResolver(_proxy._scopes, _proxy, prop, value);\n }\n return value;\n}\n\nfunction _resolveArray(prop, value, target, isIndexable) {\n const {_proxy, _context, _subProxy, _descriptors: descriptors} = target;\n\n if (defined(_context.index) && isIndexable(prop)) {\n value = value[_context.index % value.length];\n } else if (isObject(value[0])) {\n // Array of objects, return array or resolvers\n const arr = value;\n const scopes = _proxy._scopes.filter(s => s !== arr);\n value = [];\n for (const item of arr) {\n const resolver = createSubResolver(scopes, _proxy, prop, item);\n value.push(_attachContext(resolver, _context, _subProxy && _subProxy[prop], descriptors));\n }\n }\n return value;\n}\n\nfunction resolveFallback(fallback, prop, value) {\n return isFunction(fallback) ? fallback(prop, value) : fallback;\n}\n\nconst getScope = (key, parent) => key === true ? parent\n : typeof key === 'string' ? resolveObjectKey(parent, key) : undefined;\n\nfunction addScopes(set, parentScopes, key, parentFallback, value) {\n for (const parent of parentScopes) {\n const scope = getScope(key, parent);\n if (scope) {\n set.add(scope);\n const fallback = resolveFallback(scope._fallback, key, value);\n if (defined(fallback) && fallback !== key && fallback !== parentFallback) {\n // When we reach the descriptor that defines a new _fallback, return that.\n // The fallback will resume to that new scope.\n return fallback;\n }\n } else if (scope === false && defined(parentFallback) && key !== parentFallback) {\n // Fallback to `false` results to `false`, when falling back to different key.\n // For example `interaction` from `hover` or `plugins.tooltip` and `animation` from `animations`\n return null;\n }\n }\n return false;\n}\n\nfunction createSubResolver(parentScopes, resolver, prop, value) {\n const rootScopes = resolver._rootScopes;\n const fallback = resolveFallback(resolver._fallback, prop, value);\n const allScopes = [...parentScopes, ...rootScopes];\n const set = new Set();\n set.add(value);\n let key = addScopesFromKey(set, allScopes, prop, fallback || prop, value);\n if (key === null) {\n return false;\n }\n if (defined(fallback) && fallback !== prop) {\n key = addScopesFromKey(set, allScopes, fallback, key, value);\n if (key === null) {\n return false;\n }\n }\n return _createResolver(Array.from(set), [''], rootScopes, fallback,\n () => subGetTarget(resolver, prop, value));\n}\n\nfunction addScopesFromKey(set, allScopes, key, fallback, item) {\n while (key) {\n key = addScopes(set, allScopes, key, fallback, item);\n }\n return key;\n}\n\nfunction subGetTarget(resolver, prop, value) {\n const parent = resolver._getTarget();\n if (!(prop in parent)) {\n parent[prop] = {};\n }\n const target = parent[prop];\n if (isArray(target) && isObject(value)) {\n // For array of objects, the object is used to store updated values\n return value;\n }\n return target || {};\n}\n\nfunction _resolveWithPrefixes(prop, prefixes, scopes, proxy) {\n let value;\n for (const prefix of prefixes) {\n value = _resolve(readKey(prefix, prop), scopes);\n if (defined(value)) {\n return needsSubResolver(prop, value)\n ? createSubResolver(scopes, proxy, prop, value)\n : value;\n }\n }\n}\n\nfunction _resolve(key, scopes) {\n for (const scope of scopes) {\n if (!scope) {\n continue;\n }\n const value = scope[key];\n if (defined(value)) {\n return value;\n }\n }\n}\n\nfunction getKeysFromAllScopes(target) {\n let keys = target._keys;\n if (!keys) {\n keys = target._keys = resolveKeysFromAllScopes(target._scopes);\n }\n return keys;\n}\n\nfunction resolveKeysFromAllScopes(scopes) {\n const set = new Set();\n for (const scope of scopes) {\n for (const key of Object.keys(scope).filter(k => !k.startsWith('_'))) {\n set.add(key);\n }\n }\n return Array.from(set);\n}\n\nexport function _parseObjectDataRadialScale(meta, data, start, count) {\n const {iScale} = meta;\n const {key = 'r'} = this._parsing;\n const parsed = new Array(count);\n let i, ilen, index, item;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n r: iScale.parse(resolveObjectKey(item, key), index)\n };\n }\n return parsed;\n}\n","import {almostEquals, distanceBetweenPoints, sign} from './helpers.math';\nimport {_isPointInArea} from './helpers.canvas';\nimport {ChartArea} from '../../types';\n\nexport interface SplinePoint {\n x: number;\n y: number;\n skip?: boolean;\n\n // Both Bezier and monotone interpolations have these fields\n // but they are added in different spots\n cp1x?: number;\n cp1y?: number;\n cp2x?: number;\n cp2y?: number;\n}\n\nconst EPSILON = Number.EPSILON || 1e-14;\n\ntype OptionalSplinePoint = SplinePoint | false\nconst getPoint = (points: SplinePoint[], i: number): OptionalSplinePoint => i < points.length && !points[i].skip && points[i];\nconst getValueAxis = (indexAxis: 'x' | 'y') => indexAxis === 'x' ? 'y' : 'x';\n\nexport function splineCurve(\n firstPoint: SplinePoint,\n middlePoint: SplinePoint,\n afterPoint: SplinePoint,\n t: number\n): {\n previous: SplinePoint\n next: SplinePoint\n } {\n // Props to Rob Spencer at scaled innovation for his post on splining between points\n // http://scaledinnovation.com/analytics/splines/aboutSplines.html\n\n // This function must also respect \"skipped\" points\n\n const previous = firstPoint.skip ? middlePoint : firstPoint;\n const current = middlePoint;\n const next = afterPoint.skip ? middlePoint : afterPoint;\n const d01 = distanceBetweenPoints(current, previous);\n const d12 = distanceBetweenPoints(next, current);\n\n let s01 = d01 / (d01 + d12);\n let s12 = d12 / (d01 + d12);\n\n // If all points are the same, s01 & s02 will be inf\n s01 = isNaN(s01) ? 0 : s01;\n s12 = isNaN(s12) ? 0 : s12;\n\n const fa = t * s01; // scaling factor for triangle Ta\n const fb = t * s12;\n\n return {\n previous: {\n x: current.x - fa * (next.x - previous.x),\n y: current.y - fa * (next.y - previous.y)\n },\n next: {\n x: current.x + fb * (next.x - previous.x),\n y: current.y + fb * (next.y - previous.y)\n }\n };\n}\n\n/**\n * Adjust tangents to ensure monotonic properties\n */\nfunction monotoneAdjust(points: SplinePoint[], deltaK: number[], mK: number[]) {\n const pointsLen = points.length;\n\n let alphaK: number, betaK: number, tauK: number, squaredMagnitude: number, pointCurrent: OptionalSplinePoint;\n let pointAfter = getPoint(points, 0);\n for (let i = 0; i < pointsLen - 1; ++i) {\n pointCurrent = pointAfter;\n pointAfter = getPoint(points, i + 1);\n if (!pointCurrent || !pointAfter) {\n continue;\n }\n\n if (almostEquals(deltaK[i], 0, EPSILON)) {\n mK[i] = mK[i + 1] = 0;\n continue;\n }\n\n alphaK = mK[i] / deltaK[i];\n betaK = mK[i + 1] / deltaK[i];\n squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);\n if (squaredMagnitude <= 9) {\n continue;\n }\n\n tauK = 3 / Math.sqrt(squaredMagnitude);\n mK[i] = alphaK * tauK * deltaK[i];\n mK[i + 1] = betaK * tauK * deltaK[i];\n }\n}\n\nfunction monotoneCompute(points: SplinePoint[], mK: number[], indexAxis: 'x' | 'y' = 'x') {\n const valueAxis = getValueAxis(indexAxis);\n const pointsLen = points.length;\n let delta: number, pointBefore: OptionalSplinePoint, pointCurrent: OptionalSplinePoint;\n let pointAfter = getPoint(points, 0);\n\n for (let i = 0; i < pointsLen; ++i) {\n pointBefore = pointCurrent;\n pointCurrent = pointAfter;\n pointAfter = getPoint(points, i + 1);\n if (!pointCurrent) {\n continue;\n }\n\n const iPixel = pointCurrent[indexAxis];\n const vPixel = pointCurrent[valueAxis];\n if (pointBefore) {\n delta = (iPixel - pointBefore[indexAxis]) / 3;\n pointCurrent[`cp1${indexAxis}`] = iPixel - delta;\n pointCurrent[`cp1${valueAxis}`] = vPixel - delta * mK[i];\n }\n if (pointAfter) {\n delta = (pointAfter[indexAxis] - iPixel) / 3;\n pointCurrent[`cp2${indexAxis}`] = iPixel + delta;\n pointCurrent[`cp2${valueAxis}`] = vPixel + delta * mK[i];\n }\n }\n}\n\n/**\n * This function calculates Bézier control points in a similar way than |splineCurve|,\n * but preserves monotonicity of the provided data and ensures no local extremums are added\n * between the dataset discrete points due to the interpolation.\n * See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation\n */\nexport function splineCurveMonotone(points: SplinePoint[], indexAxis: 'x' | 'y' = 'x') {\n const valueAxis = getValueAxis(indexAxis);\n const pointsLen = points.length;\n const deltaK: number[] = Array(pointsLen).fill(0);\n const mK: number[] = Array(pointsLen);\n\n // Calculate slopes (deltaK) and initialize tangents (mK)\n let i, pointBefore: OptionalSplinePoint, pointCurrent: OptionalSplinePoint;\n let pointAfter = getPoint(points, 0);\n\n for (i = 0; i < pointsLen; ++i) {\n pointBefore = pointCurrent;\n pointCurrent = pointAfter;\n pointAfter = getPoint(points, i + 1);\n if (!pointCurrent) {\n continue;\n }\n\n if (pointAfter) {\n const slopeDelta = pointAfter[indexAxis] - pointCurrent[indexAxis];\n\n // In the case of two points that appear at the same x pixel, slopeDeltaX is 0\n deltaK[i] = slopeDelta !== 0 ? (pointAfter[valueAxis] - pointCurrent[valueAxis]) / slopeDelta : 0;\n }\n mK[i] = !pointBefore ? deltaK[i]\n : !pointAfter ? deltaK[i - 1]\n : (sign(deltaK[i - 1]) !== sign(deltaK[i])) ? 0\n : (deltaK[i - 1] + deltaK[i]) / 2;\n }\n\n monotoneAdjust(points, deltaK, mK);\n\n monotoneCompute(points, mK, indexAxis);\n}\n\nfunction capControlPoint(pt: number, min: number, max: number) {\n return Math.max(Math.min(pt, max), min);\n}\n\nfunction capBezierPoints(points: SplinePoint[], area: ChartArea) {\n let i, ilen, point, inArea, inAreaPrev;\n let inAreaNext = _isPointInArea(points[0], area);\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n inAreaPrev = inArea;\n inArea = inAreaNext;\n inAreaNext = i < ilen - 1 && _isPointInArea(points[i + 1], area);\n if (!inArea) {\n continue;\n }\n point = points[i];\n if (inAreaPrev) {\n point.cp1x = capControlPoint(point.cp1x, area.left, area.right);\n point.cp1y = capControlPoint(point.cp1y, area.top, area.bottom);\n }\n if (inAreaNext) {\n point.cp2x = capControlPoint(point.cp2x, area.left, area.right);\n point.cp2y = capControlPoint(point.cp2y, area.top, area.bottom);\n }\n }\n}\n\n/**\n * @private\n */\nexport function _updateBezierControlPoints(\n points: SplinePoint[],\n options,\n area: ChartArea,\n loop: boolean,\n indexAxis: 'x' | 'y'\n) {\n let i: number, ilen: number, point: SplinePoint, controlPoints: ReturnType;\n\n // Only consider points that are drawn in case the spanGaps option is used\n if (options.spanGaps) {\n points = points.filter((pt) => !pt.skip);\n }\n\n if (options.cubicInterpolationMode === 'monotone') {\n splineCurveMonotone(points, indexAxis);\n } else {\n let prev = loop ? points[points.length - 1] : points[0];\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n point = points[i];\n controlPoints = splineCurve(\n prev,\n point,\n points[Math.min(i + 1, ilen - (loop ? 0 : 1)) % ilen],\n options.tension\n );\n point.cp1x = controlPoints.previous.x;\n point.cp1y = controlPoints.previous.y;\n point.cp2x = controlPoints.next.x;\n point.cp2y = controlPoints.next.y;\n prev = point;\n }\n }\n\n if (options.capBezierPoints) {\n capBezierPoints(points, area);\n }\n}\n","import {PI, TAU, HALF_PI} from './helpers.math';\n\nconst atEdge = (t: number) => t === 0 || t === 1;\nconst elasticIn = (t: number, s: number, p: number) => -(Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * TAU / p));\nconst elasticOut = (t: number, s: number, p: number) => Math.pow(2, -10 * t) * Math.sin((t - s) * TAU / p) + 1;\n\n/**\n * Easing functions adapted from Robert Penner's easing equations.\n * @namespace Chart.helpers.easing.effects\n * @see http://www.robertpenner.com/easing/\n */\nconst effects = {\n linear: (t: number) => t,\n\n easeInQuad: (t: number) => t * t,\n\n easeOutQuad: (t: number) => -t * (t - 2),\n\n easeInOutQuad: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t\n : -0.5 * ((--t) * (t - 2) - 1),\n\n easeInCubic: (t: number) => t * t * t,\n\n easeOutCubic: (t: number) => (t -= 1) * t * t + 1,\n\n easeInOutCubic: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t * t\n : 0.5 * ((t -= 2) * t * t + 2),\n\n easeInQuart: (t: number) => t * t * t * t,\n\n easeOutQuart: (t: number) => -((t -= 1) * t * t * t - 1),\n\n easeInOutQuart: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t * t * t\n : -0.5 * ((t -= 2) * t * t * t - 2),\n\n easeInQuint: (t: number) => t * t * t * t * t,\n\n easeOutQuint: (t: number) => (t -= 1) * t * t * t * t + 1,\n\n easeInOutQuint: (t: number) => ((t /= 0.5) < 1)\n ? 0.5 * t * t * t * t * t\n : 0.5 * ((t -= 2) * t * t * t * t + 2),\n\n easeInSine: (t: number) => -Math.cos(t * HALF_PI) + 1,\n\n easeOutSine: (t: number) => Math.sin(t * HALF_PI),\n\n easeInOutSine: (t: number) => -0.5 * (Math.cos(PI * t) - 1),\n\n easeInExpo: (t: number) => (t === 0) ? 0 : Math.pow(2, 10 * (t - 1)),\n\n easeOutExpo: (t: number) => (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1,\n\n easeInOutExpo: (t: number) => atEdge(t) ? t : t < 0.5\n ? 0.5 * Math.pow(2, 10 * (t * 2 - 1))\n : 0.5 * (-Math.pow(2, -10 * (t * 2 - 1)) + 2),\n\n easeInCirc: (t: number) => (t >= 1) ? t : -(Math.sqrt(1 - t * t) - 1),\n\n easeOutCirc: (t: number) => Math.sqrt(1 - (t -= 1) * t),\n\n easeInOutCirc: (t: number) => ((t /= 0.5) < 1)\n ? -0.5 * (Math.sqrt(1 - t * t) - 1)\n : 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1),\n\n easeInElastic: (t: number) => atEdge(t) ? t : elasticIn(t, 0.075, 0.3),\n\n easeOutElastic: (t: number) => atEdge(t) ? t : elasticOut(t, 0.075, 0.3),\n\n easeInOutElastic(t: number) {\n const s = 0.1125;\n const p = 0.45;\n return atEdge(t) ? t :\n t < 0.5\n ? 0.5 * elasticIn(t * 2, s, p)\n : 0.5 + 0.5 * elasticOut(t * 2 - 1, s, p);\n },\n\n easeInBack(t: number) {\n const s = 1.70158;\n return t * t * ((s + 1) * t - s);\n },\n\n easeOutBack(t: number) {\n const s = 1.70158;\n return (t -= 1) * t * ((s + 1) * t + s) + 1;\n },\n\n easeInOutBack(t: number) {\n let s = 1.70158;\n if ((t /= 0.5) < 1) {\n return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s));\n }\n return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);\n },\n\n easeInBounce: (t: number) => 1 - effects.easeOutBounce(1 - t),\n\n easeOutBounce(t: number) {\n const m = 7.5625;\n const d = 2.75;\n if (t < (1 / d)) {\n return m * t * t;\n }\n if (t < (2 / d)) {\n return m * (t -= (1.5 / d)) * t + 0.75;\n }\n if (t < (2.5 / d)) {\n return m * (t -= (2.25 / d)) * t + 0.9375;\n }\n return m * (t -= (2.625 / d)) * t + 0.984375;\n },\n\n easeInOutBounce: (t: number) => (t < 0.5)\n ? effects.easeInBounce(t * 2) * 0.5\n : effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5,\n} as const;\n\nexport type EasingFunction = keyof typeof effects\n\nexport default effects;\n","import type {Point} from '../../types/geometric';\nimport type {SplinePoint} from './helpers.curve';\n\n/**\n * @private\n */\nexport function _pointInLine(p1: Point, p2: Point, t: number, mode?) { // eslint-disable-line @typescript-eslint/no-unused-vars\n return {\n x: p1.x + t * (p2.x - p1.x),\n y: p1.y + t * (p2.y - p1.y)\n };\n}\n\n/**\n * @private\n */\nexport function _steppedInterpolation(\n p1: Point,\n p2: Point,\n t: number, mode: 'middle' | 'after' | unknown\n) {\n return {\n x: p1.x + t * (p2.x - p1.x),\n y: mode === 'middle' ? t < 0.5 ? p1.y : p2.y\n : mode === 'after' ? t < 1 ? p1.y : p2.y\n : t > 0 ? p2.y : p1.y\n };\n}\n\n/**\n * @private\n */\nexport function _bezierInterpolation(p1: SplinePoint, p2: SplinePoint, t: number, mode?) { // eslint-disable-line @typescript-eslint/no-unused-vars\n const cp1 = {x: p1.cp2x, y: p1.cp2y};\n const cp2 = {x: p2.cp1x, y: p2.cp1y};\n const a = _pointInLine(p1, cp1, t);\n const b = _pointInLine(cp1, cp2, t);\n const c = _pointInLine(cp2, p2, t);\n const d = _pointInLine(a, b, t);\n const e = _pointInLine(b, c, t);\n return _pointInLine(d, e, t);\n}\n","import defaults from '../core/core.defaults';\nimport {isArray, isObject, toDimension, valueOrDefault} from './helpers.core';\nimport {Point, toFontString} from './helpers.canvas';\nimport type {ChartArea, FontSpec} from '../../types';\nimport type {TRBL, TRBLCorners} from '../../types/geometric';\n\nconst LINE_HEIGHT = /^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/;\nconst FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;\n\n/**\n * @alias Chart.helpers.options\n * @namespace\n */\n/**\n * Converts the given line height `value` in pixels for a specific font `size`.\n * @param value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').\n * @param size - The font size (in pixels) used to resolve relative `value`.\n * @returns The effective line height in pixels (size * 1.2 if value is invalid).\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height\n * @since 2.7.0\n */\nexport function toLineHeight(value: number | string, size: number): number {\n const matches = ('' + value).match(LINE_HEIGHT);\n if (!matches || matches[1] === 'normal') {\n return size * 1.2;\n }\n\n value = +matches[2];\n\n switch (matches[3]) {\n case 'px':\n return value;\n case '%':\n value /= 100;\n break;\n default:\n break;\n }\n\n return size * value;\n}\n\nconst numberOrZero = (v: unknown) => +v || 0;\n\n/**\n * @param value\n * @param props\n */\nexport function _readValueToProps(value: number | Record, props: K[]): Record;\nexport function _readValueToProps(value: number | Record, props: Record): Record;\nexport function _readValueToProps(value: number | Record, props: string[] | Record) {\n const ret = {};\n const objProps = isObject(props);\n const keys = objProps ? Object.keys(props) : props;\n const read = isObject(value)\n ? objProps\n ? prop => valueOrDefault(value[prop], value[props[prop]])\n : prop => value[prop]\n : () => value;\n\n for (const prop of keys) {\n ret[prop] = numberOrZero(read(prop));\n }\n return ret;\n}\n\n/**\n * Converts the given value into a TRBL object.\n * @param value - If a number, set the value to all TRBL component,\n * else, if an object, use defined properties and sets undefined ones to 0.\n * x / y are shorthands for same value for left/right and top/bottom.\n * @returns The padding values (top, right, bottom, left)\n * @since 3.0.0\n */\nexport function toTRBL(value: number | TRBL | Point) {\n return _readValueToProps(value, {top: 'y', right: 'x', bottom: 'y', left: 'x'});\n}\n\n/**\n * Converts the given value into a TRBL corners object (similar with css border-radius).\n * @param value - If a number, set the value to all TRBL corner components,\n * else, if an object, use defined properties and sets undefined ones to 0.\n * @returns The TRBL corner values (topLeft, topRight, bottomLeft, bottomRight)\n * @since 3.0.0\n */\nexport function toTRBLCorners(value: number | TRBLCorners) {\n return _readValueToProps(value, ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']);\n}\n\n/**\n * Converts the given value into a padding object with pre-computed width/height.\n * @param value - If a number, set the value to all TRBL component,\n * else, if an object, use defined properties and sets undefined ones to 0.\n * x / y are shorthands for same value for left/right and top/bottom.\n * @returns The padding values (top, right, bottom, left, width, height)\n * @since 2.7.0\n */\nexport function toPadding(value?: number | TRBL): ChartArea {\n const obj = toTRBL(value) as ChartArea;\n\n obj.width = obj.left + obj.right;\n obj.height = obj.top + obj.bottom;\n\n return obj;\n}\n\nexport interface CanvasFontSpec extends FontSpec {\n string: string;\n}\n\n/**\n * Parses font options and returns the font object.\n * @param options - A object that contains font options to be parsed.\n * @param fallback - A object that contains fallback font options.\n * @return The font object.\n * @private\n */\n\nexport function toFont(options: Partial, fallback?: Partial) {\n options = options || {};\n fallback = fallback || defaults.font as FontSpec;\n\n let size = valueOrDefault(options.size, fallback.size);\n\n if (typeof size === 'string') {\n size = parseInt(size, 10);\n }\n let style = valueOrDefault(options.style, fallback.style);\n if (style && !('' + style).match(FONT_STYLE)) {\n console.warn('Invalid font style specified: \"' + style + '\"');\n style = undefined;\n }\n\n const font = {\n family: valueOrDefault(options.family, fallback.family),\n lineHeight: toLineHeight(valueOrDefault(options.lineHeight, fallback.lineHeight), size),\n size,\n style,\n weight: valueOrDefault(options.weight, fallback.weight),\n string: ''\n };\n\n font.string = toFontString(font);\n return font;\n}\n\n/**\n * Evaluates the given `inputs` sequentially and returns the first defined value.\n * @param inputs - An array of values, falling back to the last value.\n * @param context - If defined and the current value is a function, the value\n * is called with `context` as first argument and the result becomes the new input.\n * @param index - If defined and the current value is an array, the value\n * at `index` become the new input.\n * @param info - object to return information about resolution in\n * @param info.cacheable - Will be set to `false` if option is not cacheable.\n * @since 2.7.0\n */\nexport function resolve(inputs: Array, context?: object, index?: number, info?: { cacheable: boolean }) {\n let cacheable = true;\n let i: number, ilen: number, value: unknown;\n\n for (i = 0, ilen = inputs.length; i < ilen; ++i) {\n value = inputs[i];\n if (value === undefined) {\n continue;\n }\n if (context !== undefined && typeof value === 'function') {\n value = value(context);\n cacheable = false;\n }\n if (index !== undefined && isArray(value)) {\n value = value[index % value.length];\n cacheable = false;\n }\n if (value !== undefined) {\n if (info && !cacheable) {\n info.cacheable = false;\n }\n return value;\n }\n }\n}\n\n/**\n * @param minmax\n * @param grace\n * @param beginAtZero\n * @private\n */\nexport function _addGrace(minmax: { min: number; max: number; }, grace: number | string, beginAtZero: boolean) {\n const {min, max} = minmax;\n const change = toDimension(grace, (max - min) / 2);\n const keepZero = (value: number, add: number) => beginAtZero && value === 0 ? 0 : value + add;\n return {\n min: keepZero(min, -Math.abs(change)),\n max: keepZero(max, change)\n };\n}\n\n/**\n * Create a context inheriting parentContext\n * @param parentContext\n * @param context\n * @returns\n */\nexport function createContext

(parentContext: P, context: T): P extends null ? T : P & T {\n return Object.assign(Object.create(parentContext), context);\n}\n","export interface RTLAdapter {\n x(x: number): number;\n setWidth(w: number): void;\n textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';\n xPlus(x: number, value: number): number;\n leftForLtr(x: number, itemWidth: number): number;\n}\n\nconst getRightToLeftAdapter = function(rectX: number, width: number): RTLAdapter {\n return {\n x(x) {\n return rectX + rectX + width - x;\n },\n setWidth(w) {\n width = w;\n },\n textAlign(align) {\n if (align === 'center') {\n return align;\n }\n return align === 'right' ? 'left' : 'right';\n },\n xPlus(x, value) {\n return x - value;\n },\n leftForLtr(x, itemWidth) {\n return x - itemWidth;\n },\n };\n};\n\nconst getLeftToRightAdapter = function(): RTLAdapter {\n return {\n x(x) {\n return x;\n },\n setWidth(w) { // eslint-disable-line no-unused-vars\n },\n textAlign(align) {\n return align;\n },\n xPlus(x, value) {\n return x + value;\n },\n leftForLtr(x, _itemWidth) { // eslint-disable-line @typescript-eslint/no-unused-vars\n return x;\n },\n };\n};\n\nexport function getRtlAdapter(rtl: boolean, rectX: number, width: number) {\n return rtl ? getRightToLeftAdapter(rectX, width) : getLeftToRightAdapter();\n}\n\nexport function overrideTextDirection(ctx: CanvasRenderingContext2D, direction: 'ltr' | 'rtl') {\n let style: CSSStyleDeclaration, original: [string, string];\n if (direction === 'ltr' || direction === 'rtl') {\n style = ctx.canvas.style;\n original = [\n style.getPropertyValue('direction'),\n style.getPropertyPriority('direction'),\n ];\n\n style.setProperty('direction', direction, 'important');\n (ctx as { prevTextDirection?: [string, string] }).prevTextDirection = original;\n }\n}\n\nexport function restoreTextDirection(ctx: CanvasRenderingContext2D, original?: [string, string]) {\n if (original !== undefined) {\n delete (ctx as { prevTextDirection?: [string, string] }).prevTextDirection;\n ctx.canvas.style.setProperty('direction', original[0], original[1]);\n }\n}\n","import {_angleBetween, _angleDiff, _isBetween, _normalizeAngle} from './helpers.math';\nimport {createContext} from './helpers.options';\n\n/**\n * @typedef { import(\"../elements/element.line\").default } LineElement\n * @typedef { import(\"../elements/element.point\").default } PointElement\n * @typedef {{start: number, end: number, loop: boolean, style?: any}} Segment\n */\n\nfunction propertyFn(property) {\n if (property === 'angle') {\n return {\n between: _angleBetween,\n compare: _angleDiff,\n normalize: _normalizeAngle,\n };\n }\n return {\n between: _isBetween,\n compare: (a, b) => a - b,\n normalize: x => x\n };\n}\n\nfunction normalizeSegment({start, end, count, loop, style}) {\n return {\n start: start % count,\n end: end % count,\n loop: loop && (end - start + 1) % count === 0,\n style\n };\n}\n\nfunction getSegment(segment, points, bounds) {\n const {property, start: startBound, end: endBound} = bounds;\n const {between, normalize} = propertyFn(property);\n const count = points.length;\n // eslint-disable-next-line prefer-const\n let {start, end, loop} = segment;\n let i, ilen;\n\n if (loop) {\n start += count;\n end += count;\n for (i = 0, ilen = count; i < ilen; ++i) {\n if (!between(normalize(points[start % count][property]), startBound, endBound)) {\n break;\n }\n start--;\n end--;\n }\n start %= count;\n end %= count;\n }\n\n if (end < start) {\n end += count;\n }\n return {start, end, loop, style: segment.style};\n}\n\n/**\n * Returns the sub-segment(s) of a line segment that fall in the given bounds\n * @param {object} segment\n * @param {number} segment.start - start index of the segment, referring the points array\n * @param {number} segment.end - end index of the segment, referring the points array\n * @param {boolean} segment.loop - indicates that the segment is a loop\n * @param {object} [segment.style] - segment style\n * @param {PointElement[]} points - the points that this segment refers to\n * @param {object} [bounds]\n * @param {string} bounds.property - the property of a `PointElement` we are bounding. `x`, `y` or `angle`.\n * @param {number} bounds.start - start value of the property\n * @param {number} bounds.end - end value of the property\n * @private\n **/\nexport function _boundSegment(segment, points, bounds) {\n if (!bounds) {\n return [segment];\n }\n\n const {property, start: startBound, end: endBound} = bounds;\n const count = points.length;\n const {compare, between, normalize} = propertyFn(property);\n const {start, end, loop, style} = getSegment(segment, points, bounds);\n\n const result = [];\n let inside = false;\n let subStart = null;\n let value, point, prevValue;\n\n const startIsBefore = () => between(startBound, prevValue, value) && compare(startBound, prevValue) !== 0;\n const endIsBefore = () => compare(endBound, value) === 0 || between(endBound, prevValue, value);\n const shouldStart = () => inside || startIsBefore();\n const shouldStop = () => !inside || endIsBefore();\n\n for (let i = start, prev = start; i <= end; ++i) {\n point = points[i % count];\n\n if (point.skip) {\n continue;\n }\n\n value = normalize(point[property]);\n\n if (value === prevValue) {\n continue;\n }\n\n inside = between(value, startBound, endBound);\n\n if (subStart === null && shouldStart()) {\n subStart = compare(value, startBound) === 0 ? i : prev;\n }\n\n if (subStart !== null && shouldStop()) {\n result.push(normalizeSegment({start: subStart, end: i, loop, count, style}));\n subStart = null;\n }\n prev = i;\n prevValue = value;\n }\n\n if (subStart !== null) {\n result.push(normalizeSegment({start: subStart, end, loop, count, style}));\n }\n\n return result;\n}\n\n\n/**\n * Returns the segments of the line that are inside given bounds\n * @param {LineElement} line\n * @param {object} [bounds]\n * @param {string} bounds.property - the property we are bounding with. `x`, `y` or `angle`.\n * @param {number} bounds.start - start value of the `property`\n * @param {number} bounds.end - end value of the `property`\n * @private\n */\nexport function _boundSegments(line, bounds) {\n const result = [];\n const segments = line.segments;\n\n for (let i = 0; i < segments.length; i++) {\n const sub = _boundSegment(segments[i], line.points, bounds);\n if (sub.length) {\n result.push(...sub);\n }\n }\n return result;\n}\n\n/**\n * Find start and end index of a line.\n */\nfunction findStartAndEnd(points, count, loop, spanGaps) {\n let start = 0;\n let end = count - 1;\n\n if (loop && !spanGaps) {\n // loop and not spanning gaps, first find a gap to start from\n while (start < count && !points[start].skip) {\n start++;\n }\n }\n\n // find first non skipped point (after the first gap possibly)\n while (start < count && points[start].skip) {\n start++;\n }\n\n // if we looped to count, start needs to be 0\n start %= count;\n\n if (loop) {\n // loop will go past count, if start > 0\n end += start;\n }\n\n while (end > start && points[end % count].skip) {\n end--;\n }\n\n // end could be more than count, normalize\n end %= count;\n\n return {start, end};\n}\n\n/**\n * Compute solid segments from Points, when spanGaps === false\n * @param {PointElement[]} points - the points\n * @param {number} start - start index\n * @param {number} max - max index (can go past count on a loop)\n * @param {boolean} loop - boolean indicating that this would be a loop if no gaps are found\n */\nfunction solidSegments(points, start, max, loop) {\n const count = points.length;\n const result = [];\n let last = start;\n let prev = points[start];\n let end;\n\n for (end = start + 1; end <= max; ++end) {\n const cur = points[end % count];\n if (cur.skip || cur.stop) {\n if (!prev.skip) {\n loop = false;\n result.push({start: start % count, end: (end - 1) % count, loop});\n // @ts-ignore\n start = last = cur.stop ? end : null;\n }\n } else {\n last = end;\n if (prev.skip) {\n start = end;\n }\n }\n prev = cur;\n }\n\n if (last !== null) {\n result.push({start: start % count, end: last % count, loop});\n }\n\n return result;\n}\n\n/**\n * Compute the continuous segments that define the whole line\n * There can be skipped points within a segment, if spanGaps is true.\n * @param {LineElement} line\n * @param {object} [segmentOptions]\n * @return {Segment[]}\n * @private\n */\nexport function _computeSegments(line, segmentOptions) {\n const points = line.points;\n const spanGaps = line.options.spanGaps;\n const count = points.length;\n\n if (!count) {\n return [];\n }\n\n const loop = !!line._loop;\n const {start, end} = findStartAndEnd(points, count, loop, spanGaps);\n\n if (spanGaps === true) {\n return splitByStyles(line, [{start, end, loop}], points, segmentOptions);\n }\n\n const max = end < start ? end + count : end;\n const completeLoop = !!line._fullLoop && start === 0 && end === count - 1;\n return splitByStyles(line, solidSegments(points, start, max, completeLoop), points, segmentOptions);\n}\n\n/**\n * @param {Segment[]} segments\n * @param {PointElement[]} points\n * @param {object} [segmentOptions]\n * @return {Segment[]}\n */\nfunction splitByStyles(line, segments, points, segmentOptions) {\n if (!segmentOptions || !segmentOptions.setContext || !points) {\n return segments;\n }\n return doSplitByStyles(line, segments, points, segmentOptions);\n}\n\n/**\n * @param {LineElement} line\n * @param {Segment[]} segments\n * @param {PointElement[]} points\n * @param {object} [segmentOptions]\n * @return {Segment[]}\n */\nfunction doSplitByStyles(line, segments, points, segmentOptions) {\n const chartContext = line._chart.getContext();\n const baseStyle = readStyle(line.options);\n const {_datasetIndex: datasetIndex, options: {spanGaps}} = line;\n const count = points.length;\n const result = [];\n let prevStyle = baseStyle;\n let start = segments[0].start;\n let i = start;\n\n function addStyle(s, e, l, st) {\n const dir = spanGaps ? -1 : 1;\n if (s === e) {\n return;\n }\n // Style can not start/end on a skipped point, adjust indices accordingly\n s += count;\n while (points[s % count].skip) {\n s -= dir;\n }\n while (points[e % count].skip) {\n e += dir;\n }\n if (s % count !== e % count) {\n result.push({start: s % count, end: e % count, loop: l, style: st});\n prevStyle = st;\n start = e % count;\n }\n }\n\n for (const segment of segments) {\n start = spanGaps ? start : segment.start;\n let prev = points[start % count];\n let style;\n for (i = start + 1; i <= segment.end; i++) {\n const pt = points[i % count];\n style = readStyle(segmentOptions.setContext(createContext(chartContext, {\n type: 'segment',\n p0: prev,\n p1: pt,\n p0DataIndex: (i - 1) % count,\n p1DataIndex: i % count,\n datasetIndex\n })));\n if (styleChanged(style, prevStyle)) {\n addStyle(start, i - 1, segment.loop, prevStyle);\n }\n prev = pt;\n prevStyle = style;\n }\n if (start < i - 1) {\n addStyle(start, i - 1, segment.loop, prevStyle);\n }\n }\n\n return result;\n}\n\nfunction readStyle(options) {\n return {\n backgroundColor: options.backgroundColor,\n borderCapStyle: options.borderCapStyle,\n borderDash: options.borderDash,\n borderDashOffset: options.borderDashOffset,\n borderJoinStyle: options.borderJoinStyle,\n borderWidth: options.borderWidth,\n borderColor: options.borderColor\n };\n}\n\nfunction styleChanged(style, prevStyle) {\n return prevStyle && JSON.stringify(style) !== JSON.stringify(prevStyle);\n}\n","import {_lookupByKey, _rlookupByKey} from '../helpers/helpers.collection';\nimport {getRelativePosition} from '../helpers/helpers.dom';\nimport {_angleBetween, getAngleFromPoint} from '../helpers/helpers.math';\nimport {_isPointInArea} from '../helpers';\n\n/**\n * @typedef { import(\"./core.controller\").default } Chart\n * @typedef { import(\"../../types\").ChartEvent } ChartEvent\n * @typedef {{axis?: string, intersect?: boolean, includeInvisible?: boolean}} InteractionOptions\n * @typedef {{datasetIndex: number, index: number, element: import(\"./core.element\").default}} InteractionItem\n * @typedef { import(\"../../types\").Point } Point\n */\n\n/**\n * Helper function to do binary search when possible\n * @param {object} metaset - the dataset meta\n * @param {string} axis - the axis mode. x|y|xy|r\n * @param {number} value - the value to find\n * @param {boolean} [intersect] - should the element intersect\n * @returns {{lo:number, hi:number}} indices to search data array between\n */\nfunction binarySearch(metaset, axis, value, intersect) {\n const {controller, data, _sorted} = metaset;\n const iScale = controller._cachedMeta.iScale;\n if (iScale && axis === iScale.axis && axis !== 'r' && _sorted && data.length) {\n const lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;\n if (!intersect) {\n return lookupMethod(data, axis, value);\n } else if (controller._sharedOptions) {\n // _sharedOptions indicates that each element has equal options -> equal proportions\n // So we can do a ranged binary search based on the range of first element and\n // be confident to get the full range of indices that can intersect with the value.\n const el = data[0];\n const range = typeof el.getRange === 'function' && el.getRange(axis);\n if (range) {\n const start = lookupMethod(data, axis, value - range);\n const end = lookupMethod(data, axis, value + range);\n return {lo: start.lo, hi: end.hi};\n }\n }\n }\n // Default to all elements, when binary search can not be used.\n return {lo: 0, hi: data.length - 1};\n}\n\n/**\n * Helper function to select candidate elements for interaction\n * @param {Chart} chart - the chart\n * @param {string} axis - the axis mode. x|y|xy|r\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {function} handler - the callback to execute for each visible item\n * @param {boolean} [intersect] - consider intersecting items\n */\nfunction evaluateInteractionItems(chart, axis, position, handler, intersect) {\n const metasets = chart.getSortedVisibleDatasetMetas();\n const value = position[axis];\n for (let i = 0, ilen = metasets.length; i < ilen; ++i) {\n const {index, data} = metasets[i];\n const {lo, hi} = binarySearch(metasets[i], axis, value, intersect);\n for (let j = lo; j <= hi; ++j) {\n const element = data[j];\n if (!element.skip) {\n handler(element, index, j);\n }\n }\n }\n}\n\n/**\n * Get a distance metric function for two points based on the\n * axis mode setting\n * @param {string} axis - the axis mode. x|y|xy|r\n */\nfunction getDistanceMetricForAxis(axis) {\n const useX = axis.indexOf('x') !== -1;\n const useY = axis.indexOf('y') !== -1;\n\n return function(pt1, pt2) {\n const deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;\n const deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;\n return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\n };\n}\n\n/**\n * Helper function to get the items that intersect the event position\n * @param {Chart} chart - the chart\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axis mode. x|y|xy|r\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @param {boolean} [includeInvisible] - include invisible points that are outside of the chart area\n * @return {InteractionItem[]} the nearest items\n */\nfunction getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) {\n const items = [];\n\n if (!includeInvisible && !chart.isPointInArea(position)) {\n return items;\n }\n\n const evaluationFunc = function(element, datasetIndex, index) {\n if (!includeInvisible && !_isPointInArea(element, chart.chartArea, 0)) {\n return;\n }\n if (element.inRange(position.x, position.y, useFinalPosition)) {\n items.push({element, datasetIndex, index});\n }\n };\n\n evaluateInteractionItems(chart, axis, position, evaluationFunc, true);\n return items;\n}\n\n/**\n * Helper function to get the items nearest to the event position for a radial chart\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axes along which to measure distance\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @return {InteractionItem[]} the nearest items\n */\nfunction getNearestRadialItems(chart, position, axis, useFinalPosition) {\n let items = [];\n\n function evaluationFunc(element, datasetIndex, index) {\n const {startAngle, endAngle} = element.getProps(['startAngle', 'endAngle'], useFinalPosition);\n const {angle} = getAngleFromPoint(element, {x: position.x, y: position.y});\n\n if (_angleBetween(angle, startAngle, endAngle)) {\n items.push({element, datasetIndex, index});\n }\n }\n\n evaluateInteractionItems(chart, axis, position, evaluationFunc);\n return items;\n}\n\n/**\n * Helper function to get the items nearest to the event position for a cartesian chart\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axes along which to measure distance\n * @param {boolean} [intersect] - if true, only consider items that intersect the position\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @param {boolean} [includeInvisible] - include invisible points that are outside of the chart area\n * @return {InteractionItem[]} the nearest items\n */\nfunction getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition, includeInvisible) {\n let items = [];\n const distanceMetric = getDistanceMetricForAxis(axis);\n let minDistance = Number.POSITIVE_INFINITY;\n\n function evaluationFunc(element, datasetIndex, index) {\n const inRange = element.inRange(position.x, position.y, useFinalPosition);\n if (intersect && !inRange) {\n return;\n }\n\n const center = element.getCenterPoint(useFinalPosition);\n const pointInArea = !!includeInvisible || chart.isPointInArea(center);\n if (!pointInArea && !inRange) {\n return;\n }\n\n const distance = distanceMetric(position, center);\n if (distance < minDistance) {\n items = [{element, datasetIndex, index}];\n minDistance = distance;\n } else if (distance === minDistance) {\n // Can have multiple items at the same distance in which case we sort by size\n items.push({element, datasetIndex, index});\n }\n }\n\n evaluateInteractionItems(chart, axis, position, evaluationFunc);\n return items;\n}\n\n/**\n * Helper function to get the items nearest to the event position considering all visible items in the chart\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axes along which to measure distance\n * @param {boolean} [intersect] - if true, only consider items that intersect the position\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @param {boolean} [includeInvisible] - include invisible points that are outside of the chart area\n * @return {InteractionItem[]} the nearest items\n */\nfunction getNearestItems(chart, position, axis, intersect, useFinalPosition, includeInvisible) {\n if (!includeInvisible && !chart.isPointInArea(position)) {\n return [];\n }\n\n return axis === 'r' && !intersect\n ? getNearestRadialItems(chart, position, axis, useFinalPosition)\n : getNearestCartesianItems(chart, position, axis, intersect, useFinalPosition, includeInvisible);\n}\n\n/**\n * Helper function to get the items matching along the given X or Y axis\n * @param {Chart} chart - the chart to look at elements from\n * @param {Point} position - the point to be nearest to, in relative coordinates\n * @param {string} axis - the axis to match\n * @param {boolean} [intersect] - if true, only consider items that intersect the position\n * @param {boolean} [useFinalPosition] - use the element's animation target instead of current position\n * @return {InteractionItem[]} the nearest items\n */\nfunction getAxisItems(chart, position, axis, intersect, useFinalPosition) {\n const items = [];\n const rangeMethod = axis === 'x' ? 'inXRange' : 'inYRange';\n let intersectsItem = false;\n\n evaluateInteractionItems(chart, axis, position, (element, datasetIndex, index) => {\n if (element[rangeMethod](position[axis], useFinalPosition)) {\n items.push({element, datasetIndex, index});\n intersectsItem = intersectsItem || element.inRange(position.x, position.y, useFinalPosition);\n }\n });\n\n // If we want to trigger on an intersect and we don't have any items\n // that intersect the position, return nothing\n if (intersect && !intersectsItem) {\n return [];\n }\n return items;\n}\n\n/**\n * Contains interaction related functions\n * @namespace Chart.Interaction\n */\nexport default {\n // Part of the public API to facilitate developers creating their own modes\n evaluateInteractionItems,\n\n // Helper function for different modes\n modes: {\n /**\n\t\t * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something\n\t\t * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item\n\t\t * @function Chart.Interaction.modes.index\n\t\t * @since v2.4.0\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n index(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n // Default axis for index mode is 'x' to match old behaviour\n const axis = options.axis || 'x';\n const includeInvisible = options.includeInvisible || false;\n const items = options.intersect\n ? getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible)\n : getNearestItems(chart, position, axis, false, useFinalPosition, includeInvisible);\n const elements = [];\n\n if (!items.length) {\n return [];\n }\n\n chart.getSortedVisibleDatasetMetas().forEach((meta) => {\n const index = items[0].index;\n const element = meta.data[index];\n\n // don't count items that are skipped (null data)\n if (element && !element.skip) {\n elements.push({element, datasetIndex: meta.index, index});\n }\n });\n\n return elements;\n },\n\n /**\n\t\t * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something\n\t\t * If the options.intersect is false, we find the nearest item and return the items in that dataset\n\t\t * @function Chart.Interaction.modes.dataset\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n dataset(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n const includeInvisible = options.includeInvisible || false;\n let items = options.intersect\n ? getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible) :\n getNearestItems(chart, position, axis, false, useFinalPosition, includeInvisible);\n\n if (items.length > 0) {\n const datasetIndex = items[0].datasetIndex;\n const data = chart.getDatasetMeta(datasetIndex).data;\n items = [];\n for (let i = 0; i < data.length; ++i) {\n items.push({element: data[i], datasetIndex, index: i});\n }\n }\n\n return items;\n },\n\n /**\n\t\t * Point mode returns all elements that hit test based on the event position\n\t\t * of the event\n\t\t * @function Chart.Interaction.modes.intersect\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n point(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n const includeInvisible = options.includeInvisible || false;\n return getIntersectItems(chart, position, axis, useFinalPosition, includeInvisible);\n },\n\n /**\n\t\t * nearest mode returns the element closest to the point\n\t\t * @function Chart.Interaction.modes.intersect\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n nearest(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n const axis = options.axis || 'xy';\n const includeInvisible = options.includeInvisible || false;\n return getNearestItems(chart, position, axis, options.intersect, useFinalPosition, includeInvisible);\n },\n\n /**\n\t\t * x mode returns the elements that hit-test at the current x coordinate\n\t\t * @function Chart.Interaction.modes.x\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n x(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n return getAxisItems(chart, position, 'x', options.intersect, useFinalPosition);\n },\n\n /**\n\t\t * y mode returns the elements that hit-test at the current y coordinate\n\t\t * @function Chart.Interaction.modes.y\n\t\t * @param {Chart} chart - the chart we are returning items from\n\t\t * @param {Event} e - the event we are find things at\n\t\t * @param {InteractionOptions} options - options to use\n\t\t * @param {boolean} [useFinalPosition] - use final element position (animation target)\n\t\t * @return {InteractionItem[]} - items that are found\n\t\t */\n y(chart, e, options, useFinalPosition) {\n const position = getRelativePosition(e, chart);\n return getAxisItems(chart, position, 'y', options.intersect, useFinalPosition);\n }\n }\n};\n","import {defined, each, isObject} from '../helpers/helpers.core';\nimport {toPadding} from '../helpers/helpers.options';\n\n/**\n * @typedef { import(\"./core.controller\").default } Chart\n */\n\nconst STATIC_POSITIONS = ['left', 'top', 'right', 'bottom'];\n\nfunction filterByPosition(array, position) {\n return array.filter(v => v.pos === position);\n}\n\nfunction filterDynamicPositionByAxis(array, axis) {\n return array.filter(v => STATIC_POSITIONS.indexOf(v.pos) === -1 && v.box.axis === axis);\n}\n\nfunction sortByWeight(array, reverse) {\n return array.sort((a, b) => {\n const v0 = reverse ? b : a;\n const v1 = reverse ? a : b;\n return v0.weight === v1.weight ?\n v0.index - v1.index :\n v0.weight - v1.weight;\n });\n}\n\nfunction wrapBoxes(boxes) {\n const layoutBoxes = [];\n let i, ilen, box, pos, stack, stackWeight;\n\n for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {\n box = boxes[i];\n ({position: pos, options: {stack, stackWeight = 1}} = box);\n layoutBoxes.push({\n index: i,\n box,\n pos,\n horizontal: box.isHorizontal(),\n weight: box.weight,\n stack: stack && (pos + stack),\n stackWeight\n });\n }\n return layoutBoxes;\n}\n\nfunction buildStacks(layouts) {\n const stacks = {};\n for (const wrap of layouts) {\n const {stack, pos, stackWeight} = wrap;\n if (!stack || !STATIC_POSITIONS.includes(pos)) {\n continue;\n }\n const _stack = stacks[stack] || (stacks[stack] = {count: 0, placed: 0, weight: 0, size: 0});\n _stack.count++;\n _stack.weight += stackWeight;\n }\n return stacks;\n}\n\n/**\n * store dimensions used instead of available chartArea in fitBoxes\n **/\nfunction setLayoutDims(layouts, params) {\n const stacks = buildStacks(layouts);\n const {vBoxMaxWidth, hBoxMaxHeight} = params;\n let i, ilen, layout;\n for (i = 0, ilen = layouts.length; i < ilen; ++i) {\n layout = layouts[i];\n const {fullSize} = layout.box;\n const stack = stacks[layout.stack];\n const factor = stack && layout.stackWeight / stack.weight;\n if (layout.horizontal) {\n layout.width = factor ? factor * vBoxMaxWidth : fullSize && params.availableWidth;\n layout.height = hBoxMaxHeight;\n } else {\n layout.width = vBoxMaxWidth;\n layout.height = factor ? factor * hBoxMaxHeight : fullSize && params.availableHeight;\n }\n }\n return stacks;\n}\n\nfunction buildLayoutBoxes(boxes) {\n const layoutBoxes = wrapBoxes(boxes);\n const fullSize = sortByWeight(layoutBoxes.filter(wrap => wrap.box.fullSize), true);\n const left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);\n const right = sortByWeight(filterByPosition(layoutBoxes, 'right'));\n const top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);\n const bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));\n const centerHorizontal = filterDynamicPositionByAxis(layoutBoxes, 'x');\n const centerVertical = filterDynamicPositionByAxis(layoutBoxes, 'y');\n\n return {\n fullSize,\n leftAndTop: left.concat(top),\n rightAndBottom: right.concat(centerVertical).concat(bottom).concat(centerHorizontal),\n chartArea: filterByPosition(layoutBoxes, 'chartArea'),\n vertical: left.concat(right).concat(centerVertical),\n horizontal: top.concat(bottom).concat(centerHorizontal)\n };\n}\n\nfunction getCombinedMax(maxPadding, chartArea, a, b) {\n return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);\n}\n\nfunction updateMaxPadding(maxPadding, boxPadding) {\n maxPadding.top = Math.max(maxPadding.top, boxPadding.top);\n maxPadding.left = Math.max(maxPadding.left, boxPadding.left);\n maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);\n maxPadding.right = Math.max(maxPadding.right, boxPadding.right);\n}\n\nfunction updateDims(chartArea, params, layout, stacks) {\n const {pos, box} = layout;\n const maxPadding = chartArea.maxPadding;\n\n // dynamically placed boxes size is not considered\n if (!isObject(pos)) {\n if (layout.size) {\n // this layout was already counted for, lets first reduce old size\n chartArea[pos] -= layout.size;\n }\n const stack = stacks[layout.stack] || {size: 0, count: 1};\n stack.size = Math.max(stack.size, layout.horizontal ? box.height : box.width);\n layout.size = stack.size / stack.count;\n chartArea[pos] += layout.size;\n }\n\n if (box.getPadding) {\n updateMaxPadding(maxPadding, box.getPadding());\n }\n\n const newWidth = Math.max(0, params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right'));\n const newHeight = Math.max(0, params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom'));\n const widthChanged = newWidth !== chartArea.w;\n const heightChanged = newHeight !== chartArea.h;\n chartArea.w = newWidth;\n chartArea.h = newHeight;\n\n // return booleans on the changes per direction\n return layout.horizontal\n ? {same: widthChanged, other: heightChanged}\n : {same: heightChanged, other: widthChanged};\n}\n\nfunction handleMaxPadding(chartArea) {\n const maxPadding = chartArea.maxPadding;\n\n function updatePos(pos) {\n const change = Math.max(maxPadding[pos] - chartArea[pos], 0);\n chartArea[pos] += change;\n return change;\n }\n chartArea.y += updatePos('top');\n chartArea.x += updatePos('left');\n updatePos('right');\n updatePos('bottom');\n}\n\nfunction getMargins(horizontal, chartArea) {\n const maxPadding = chartArea.maxPadding;\n\n function marginForPositions(positions) {\n const margin = {left: 0, top: 0, right: 0, bottom: 0};\n positions.forEach((pos) => {\n margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);\n });\n return margin;\n }\n\n return horizontal\n ? marginForPositions(['left', 'right'])\n : marginForPositions(['top', 'bottom']);\n}\n\nfunction fitBoxes(boxes, chartArea, params, stacks) {\n const refitBoxes = [];\n let i, ilen, layout, box, refit, changed;\n\n for (i = 0, ilen = boxes.length, refit = 0; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n\n box.update(\n layout.width || chartArea.w,\n layout.height || chartArea.h,\n getMargins(layout.horizontal, chartArea)\n );\n const {same, other} = updateDims(chartArea, params, layout, stacks);\n\n // Dimensions changed and there were non full width boxes before this\n // -> we have to refit those\n refit |= same && refitBoxes.length;\n\n // Chart area changed in the opposite direction\n changed = changed || other;\n\n if (!box.fullSize) { // fullSize boxes don't need to be re-fitted in any case\n refitBoxes.push(layout);\n }\n }\n\n return refit && fitBoxes(refitBoxes, chartArea, params, stacks) || changed;\n}\n\nfunction setBoxDims(box, left, top, width, height) {\n box.top = top;\n box.left = left;\n box.right = left + width;\n box.bottom = top + height;\n box.width = width;\n box.height = height;\n}\n\nfunction placeBoxes(boxes, chartArea, params, stacks) {\n const userPadding = params.padding;\n let {x, y} = chartArea;\n\n for (const layout of boxes) {\n const box = layout.box;\n const stack = stacks[layout.stack] || {count: 1, placed: 0, weight: 1};\n const weight = (layout.stackWeight / stack.weight) || 1;\n if (layout.horizontal) {\n const width = chartArea.w * weight;\n const height = stack.size || box.height;\n if (defined(stack.start)) {\n y = stack.start;\n }\n if (box.fullSize) {\n setBoxDims(box, userPadding.left, y, params.outerWidth - userPadding.right - userPadding.left, height);\n } else {\n setBoxDims(box, chartArea.left + stack.placed, y, width, height);\n }\n stack.start = y;\n stack.placed += width;\n y = box.bottom;\n } else {\n const height = chartArea.h * weight;\n const width = stack.size || box.width;\n if (defined(stack.start)) {\n x = stack.start;\n }\n if (box.fullSize) {\n setBoxDims(box, x, userPadding.top, width, params.outerHeight - userPadding.bottom - userPadding.top);\n } else {\n setBoxDims(box, x, chartArea.top + stack.placed, width, height);\n }\n stack.start = x;\n stack.placed += height;\n x = box.right;\n }\n }\n\n chartArea.x = x;\n chartArea.y = y;\n}\n\n/**\n * @interface LayoutItem\n * @typedef {object} LayoutItem\n * @prop {string} position - The position of the item in the chart layout. Possible values are\n * 'left', 'top', 'right', 'bottom', and 'chartArea'\n * @prop {number} weight - The weight used to sort the item. Higher weights are further away from the chart area\n * @prop {boolean} fullSize - if true, and the item is horizontal, then push vertical boxes down\n * @prop {function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)\n * @prop {function} update - Takes two parameters: width and height. Returns size of item\n * @prop {function} draw - Draws the element\n * @prop {function} [getPadding] - Returns an object with padding on the edges\n * @prop {number} width - Width of item. Must be valid after update()\n * @prop {number} height - Height of item. Must be valid after update()\n * @prop {number} left - Left edge of the item. Set by layout system and cannot be used in update\n * @prop {number} top - Top edge of the item. Set by layout system and cannot be used in update\n * @prop {number} right - Right edge of the item. Set by layout system and cannot be used in update\n * @prop {number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update\n */\n\n// The layout service is very self explanatory. It's responsible for the layout within a chart.\n// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need\n// It is this service's responsibility of carrying out that layout.\nexport default {\n\n /**\n\t * Register a box to a chart.\n\t * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.\n\t * @param {Chart} chart - the chart to use\n\t * @param {LayoutItem} item - the item to add to be laid out\n\t */\n addBox(chart, item) {\n if (!chart.boxes) {\n chart.boxes = [];\n }\n\n // initialize item with default values\n item.fullSize = item.fullSize || false;\n item.position = item.position || 'top';\n item.weight = item.weight || 0;\n // @ts-ignore\n item._layers = item._layers || function() {\n return [{\n z: 0,\n draw(chartArea) {\n item.draw(chartArea);\n }\n }];\n };\n\n chart.boxes.push(item);\n },\n\n /**\n\t * Remove a layoutItem from a chart\n\t * @param {Chart} chart - the chart to remove the box from\n\t * @param {LayoutItem} layoutItem - the item to remove from the layout\n\t */\n removeBox(chart, layoutItem) {\n const index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;\n if (index !== -1) {\n chart.boxes.splice(index, 1);\n }\n },\n\n /**\n\t * Sets (or updates) options on the given `item`.\n\t * @param {Chart} chart - the chart in which the item lives (or will be added to)\n\t * @param {LayoutItem} item - the item to configure with the given options\n\t * @param {object} options - the new item options.\n\t */\n configure(chart, item, options) {\n item.fullSize = options.fullSize;\n item.position = options.position;\n item.weight = options.weight;\n },\n\n /**\n\t * Fits boxes of the given chart into the given size by having each box measure itself\n\t * then running a fitting algorithm\n\t * @param {Chart} chart - the chart\n\t * @param {number} width - the width to fit into\n\t * @param {number} height - the height to fit into\n * @param {number} minPadding - minimum padding required for each side of chart area\n\t */\n update(chart, width, height, minPadding) {\n if (!chart) {\n return;\n }\n\n const padding = toPadding(chart.options.layout.padding);\n const availableWidth = Math.max(width - padding.width, 0);\n const availableHeight = Math.max(height - padding.height, 0);\n const boxes = buildLayoutBoxes(chart.boxes);\n const verticalBoxes = boxes.vertical;\n const horizontalBoxes = boxes.horizontal;\n\n // Before any changes are made, notify boxes that an update is about to being\n // This is used to clear any cached data (e.g. scale limits)\n each(chart.boxes, box => {\n if (typeof box.beforeLayout === 'function') {\n box.beforeLayout();\n }\n });\n\n // Essentially we now have any number of boxes on each of the 4 sides.\n // Our canvas looks like the following.\n // The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and\n // B1 is the bottom axis\n // There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays\n // These locations are single-box locations only, when trying to register a chartArea location that is already taken,\n // an error will be thrown.\n //\n // |----------------------------------------------------|\n // | T1 (Full Width) |\n // |----------------------------------------------------|\n // | | | T2 | |\n // | |----|-------------------------------------|----|\n // | | | C1 | | C2 | |\n // | | |----| |----| |\n // | | | | |\n // | L1 | L2 | ChartArea (C0) | R1 |\n // | | | | |\n // | | |----| |----| |\n // | | | C3 | | C4 | |\n // | |----|-------------------------------------|----|\n // | | | B1 | |\n // |----------------------------------------------------|\n // | B2 (Full Width) |\n // |----------------------------------------------------|\n //\n\n const visibleVerticalBoxCount = verticalBoxes.reduce((total, wrap) =>\n wrap.box.options && wrap.box.options.display === false ? total : total + 1, 0) || 1;\n\n const params = Object.freeze({\n outerWidth: width,\n outerHeight: height,\n padding,\n availableWidth,\n availableHeight,\n vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,\n hBoxMaxHeight: availableHeight / 2\n });\n const maxPadding = Object.assign({}, padding);\n updateMaxPadding(maxPadding, toPadding(minPadding));\n const chartArea = Object.assign({\n maxPadding,\n w: availableWidth,\n h: availableHeight,\n x: padding.left,\n y: padding.top\n }, padding);\n\n const stacks = setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);\n\n // First fit the fullSize boxes, to reduce probability of re-fitting.\n fitBoxes(boxes.fullSize, chartArea, params, stacks);\n\n // Then fit vertical boxes\n fitBoxes(verticalBoxes, chartArea, params, stacks);\n\n // Then fit horizontal boxes\n if (fitBoxes(horizontalBoxes, chartArea, params, stacks)) {\n // if the area changed, re-fit vertical boxes\n fitBoxes(verticalBoxes, chartArea, params, stacks);\n }\n\n handleMaxPadding(chartArea);\n\n // Finally place the boxes to correct coordinates\n placeBoxes(boxes.leftAndTop, chartArea, params, stacks);\n\n // Move to opposite side of chart\n chartArea.x += chartArea.w;\n chartArea.y += chartArea.h;\n\n placeBoxes(boxes.rightAndBottom, chartArea, params, stacks);\n\n chart.chartArea = {\n left: chartArea.left,\n top: chartArea.top,\n right: chartArea.left + chartArea.w,\n bottom: chartArea.top + chartArea.h,\n height: chartArea.h,\n width: chartArea.w,\n };\n\n // Finally update boxes in chartArea (radial scale for example)\n each(boxes.chartArea, (layout) => {\n const box = layout.box;\n Object.assign(box, chart.chartArea);\n box.update(chartArea.w, chartArea.h, {left: 0, top: 0, right: 0, bottom: 0});\n });\n }\n};\n","\n/**\n * @typedef { import(\"../core/core.controller\").default } Chart\n */\n\n/**\n * Abstract class that allows abstracting platform dependencies away from the chart.\n */\nexport default class BasePlatform {\n /**\n\t * Called at chart construction time, returns a context2d instance implementing\n\t * the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}.\n\t * @param {HTMLCanvasElement} canvas - The canvas from which to acquire context (platform specific)\n\t * @param {number} [aspectRatio] - The chart options\n\t */\n acquireContext(canvas, aspectRatio) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * Called at chart destruction time, releases any resources associated to the context\n\t * previously returned by the acquireContext() method.\n\t * @param {CanvasRenderingContext2D} context - The context2d instance\n\t * @returns {boolean} true if the method succeeded, else false\n\t */\n releaseContext(context) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n\t * Registers the specified listener on the given chart.\n\t * @param {Chart} chart - Chart from which to listen for event\n\t * @param {string} type - The ({@link ChartEvent}) type to listen for\n\t * @param {function} listener - Receives a notification (an object that implements\n\t * the {@link ChartEvent} interface) when an event of the specified type occurs.\n\t */\n addEventListener(chart, type, listener) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * Removes the specified listener previously registered with addEventListener.\n\t * @param {Chart} chart - Chart from which to remove the listener\n\t * @param {string} type - The ({@link ChartEvent}) type to remove\n\t * @param {function} listener - The listener function to remove from the event target.\n\t */\n removeEventListener(chart, type, listener) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * @returns {number} the current devicePixelRatio of the device this platform is connected to.\n\t */\n getDevicePixelRatio() {\n return 1;\n }\n\n /**\n\t * Returns the maximum size in pixels of given canvas element.\n\t * @param {HTMLCanvasElement} element\n\t * @param {number} [width] - content width of parent element\n\t * @param {number} [height] - content height of parent element\n\t * @param {number} [aspectRatio] - aspect ratio to maintain\n\t */\n getMaximumSize(element, width, height, aspectRatio) {\n width = Math.max(0, width || element.width);\n height = height || element.height;\n return {\n width,\n height: Math.max(0, aspectRatio ? Math.floor(width / aspectRatio) : height)\n };\n }\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t * @returns {boolean} true if the canvas is attached to the platform, false if not.\n\t */\n isAttached(canvas) { // eslint-disable-line no-unused-vars\n return true;\n }\n\n /**\n * Updates config with platform specific requirements\n * @param {import(\"../core/core.config\").default} config\n */\n updateConfig(config) { // eslint-disable-line no-unused-vars\n // no-op\n }\n}\n","/**\n * Platform fallback implementation (minimal).\n * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939\n */\n\nimport BasePlatform from './platform.base';\n\n/**\n * Platform class for charts without access to the DOM or to many element properties\n * This platform is used by default for any chart passed an OffscreenCanvas.\n * @extends BasePlatform\n */\nexport default class BasicPlatform extends BasePlatform {\n acquireContext(item) {\n // To prevent canvas fingerprinting, some add-ons undefine the getContext\n // method, for example: https://github.com/kkapsner/CanvasBlocker\n // https://github.com/chartjs/Chart.js/issues/2807\n return item && item.getContext && item.getContext('2d') || null;\n }\n updateConfig(config) {\n config.options.animation = false;\n }\n}\n","/**\n * Chart.Platform implementation for targeting a web browser\n */\n\nimport BasePlatform from './platform.base';\nimport {_getParentNode, getRelativePosition, supportsEventListenerOptions, readUsedSize, getMaximumSize} from '../helpers/helpers.dom';\nimport {throttled} from '../helpers/helpers.extras';\nimport {isNullOrUndef} from '../helpers/helpers.core';\n\n/**\n * @typedef { import(\"../core/core.controller\").default } Chart\n */\n\nconst EXPANDO_KEY = '$chartjs';\n\n/**\n * DOM event types -> Chart.js event types.\n * Note: only events with different types are mapped.\n * @see https://developer.mozilla.org/en-US/docs/Web/Events\n */\nconst EVENT_TYPES = {\n touchstart: 'mousedown',\n touchmove: 'mousemove',\n touchend: 'mouseup',\n pointerenter: 'mouseenter',\n pointerdown: 'mousedown',\n pointermove: 'mousemove',\n pointerup: 'mouseup',\n pointerleave: 'mouseout',\n pointerout: 'mouseout'\n};\n\nconst isNullOrEmpty = value => value === null || value === '';\n/**\n * Initializes the canvas style and render size without modifying the canvas display size,\n * since responsiveness is handled by the controller.resize() method. The config is used\n * to determine the aspect ratio to apply in case no explicit height has been specified.\n * @param {HTMLCanvasElement} canvas\n * @param {number} [aspectRatio]\n */\nfunction initCanvas(canvas, aspectRatio) {\n const style = canvas.style;\n\n // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it\n // returns null or '' if no explicit value has been set to the canvas attribute.\n const renderHeight = canvas.getAttribute('height');\n const renderWidth = canvas.getAttribute('width');\n\n // Chart.js modifies some canvas values that we want to restore on destroy\n canvas[EXPANDO_KEY] = {\n initial: {\n height: renderHeight,\n width: renderWidth,\n style: {\n display: style.display,\n height: style.height,\n width: style.width\n }\n }\n };\n\n // Force canvas to display as block to avoid extra space caused by inline\n // elements, which would interfere with the responsive resize process.\n // https://github.com/chartjs/Chart.js/issues/2538\n style.display = style.display || 'block';\n // Include possible borders in the size\n style.boxSizing = style.boxSizing || 'border-box';\n\n if (isNullOrEmpty(renderWidth)) {\n const displayWidth = readUsedSize(canvas, 'width');\n if (displayWidth !== undefined) {\n canvas.width = displayWidth;\n }\n }\n\n if (isNullOrEmpty(renderHeight)) {\n if (canvas.style.height === '') {\n // If no explicit render height and style height, let's apply the aspect ratio,\n // which one can be specified by the user but also by charts as default option\n // (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.\n canvas.height = canvas.width / (aspectRatio || 2);\n } else {\n const displayHeight = readUsedSize(canvas, 'height');\n if (displayHeight !== undefined) {\n canvas.height = displayHeight;\n }\n }\n }\n\n return canvas;\n}\n\n// Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.\n// https://github.com/chartjs/Chart.js/issues/4287\nconst eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;\n\nfunction addListener(node, type, listener) {\n node.addEventListener(type, listener, eventListenerOptions);\n}\n\nfunction removeListener(chart, type, listener) {\n chart.canvas.removeEventListener(type, listener, eventListenerOptions);\n}\n\nfunction fromNativeEvent(event, chart) {\n const type = EVENT_TYPES[event.type] || event.type;\n const {x, y} = getRelativePosition(event, chart);\n return {\n type,\n chart,\n native: event,\n x: x !== undefined ? x : null,\n y: y !== undefined ? y : null,\n };\n}\n\nfunction nodeListContains(nodeList, canvas) {\n for (const node of nodeList) {\n if (node === canvas || node.contains(canvas)) {\n return true;\n }\n }\n}\n\nfunction createAttachObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const observer = new MutationObserver(entries => {\n let trigger = false;\n for (const entry of entries) {\n trigger = trigger || nodeListContains(entry.addedNodes, canvas);\n trigger = trigger && !nodeListContains(entry.removedNodes, canvas);\n }\n if (trigger) {\n listener();\n }\n });\n observer.observe(document, {childList: true, subtree: true});\n return observer;\n}\n\nfunction createDetachObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const observer = new MutationObserver(entries => {\n let trigger = false;\n for (const entry of entries) {\n trigger = trigger || nodeListContains(entry.removedNodes, canvas);\n trigger = trigger && !nodeListContains(entry.addedNodes, canvas);\n }\n if (trigger) {\n listener();\n }\n });\n observer.observe(document, {childList: true, subtree: true});\n return observer;\n}\n\nconst drpListeningCharts = new Map();\nlet oldDevicePixelRatio = 0;\n\nfunction onWindowResize() {\n const dpr = window.devicePixelRatio;\n if (dpr === oldDevicePixelRatio) {\n return;\n }\n oldDevicePixelRatio = dpr;\n drpListeningCharts.forEach((resize, chart) => {\n if (chart.currentDevicePixelRatio !== dpr) {\n resize();\n }\n });\n}\n\nfunction listenDevicePixelRatioChanges(chart, resize) {\n if (!drpListeningCharts.size) {\n window.addEventListener('resize', onWindowResize);\n }\n drpListeningCharts.set(chart, resize);\n}\n\nfunction unlistenDevicePixelRatioChanges(chart) {\n drpListeningCharts.delete(chart);\n if (!drpListeningCharts.size) {\n window.removeEventListener('resize', onWindowResize);\n }\n}\n\nfunction createResizeObserver(chart, type, listener) {\n const canvas = chart.canvas;\n const container = canvas && _getParentNode(canvas);\n if (!container) {\n return;\n }\n const resize = throttled((width, height) => {\n const w = container.clientWidth;\n listener(width, height);\n if (w < container.clientWidth) {\n // If the container size shrank during chart resize, let's assume\n // scrollbar appeared. So we resize again with the scrollbar visible -\n // effectively making chart smaller and the scrollbar hidden again.\n // Because we are inside `throttled`, and currently `ticking`, scroll\n // events are ignored during this whole 2 resize process.\n // If we assumed wrong and something else happened, we are resizing\n // twice in a frame (potential performance issue)\n listener();\n }\n }, window);\n\n // @ts-ignore until https://github.com/microsoft/TypeScript/issues/37861 implemented\n const observer = new ResizeObserver(entries => {\n const entry = entries[0];\n const width = entry.contentRect.width;\n const height = entry.contentRect.height;\n // When its container's display is set to 'none' the callback will be called with a\n // size of (0, 0), which will cause the chart to lose its original height, so skip\n // resizing in such case.\n if (width === 0 && height === 0) {\n return;\n }\n resize(width, height);\n });\n observer.observe(container);\n listenDevicePixelRatioChanges(chart, resize);\n\n return observer;\n}\n\nfunction releaseObserver(chart, type, observer) {\n if (observer) {\n observer.disconnect();\n }\n if (type === 'resize') {\n unlistenDevicePixelRatioChanges(chart);\n }\n}\n\nfunction createProxyAndListen(chart, type, listener) {\n const canvas = chart.canvas;\n const proxy = throttled((event) => {\n // This case can occur if the chart is destroyed while waiting\n // for the throttled function to occur. We prevent crashes by checking\n // for a destroyed chart\n if (chart.ctx !== null) {\n listener(fromNativeEvent(event, chart));\n }\n }, chart);\n\n addListener(canvas, type, proxy);\n\n return proxy;\n}\n\n/**\n * Platform class for charts that can access the DOM and global window/document properties\n * @extends BasePlatform\n */\nexport default class DomPlatform extends BasePlatform {\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t * @param {number} [aspectRatio]\n\t * @return {CanvasRenderingContext2D|null}\n\t */\n acquireContext(canvas, aspectRatio) {\n // To prevent canvas fingerprinting, some add-ons undefine the getContext\n // method, for example: https://github.com/kkapsner/CanvasBlocker\n // https://github.com/chartjs/Chart.js/issues/2807\n const context = canvas && canvas.getContext && canvas.getContext('2d');\n\n // `instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the canvas is\n // inside an iframe or when running in a protected environment. We could guess the\n // types from their toString() value but let's keep things flexible and assume it's\n // a sufficient condition if the canvas has a context2D which has canvas as `canvas`.\n // https://github.com/chartjs/Chart.js/issues/3887\n // https://github.com/chartjs/Chart.js/issues/4102\n // https://github.com/chartjs/Chart.js/issues/4152\n if (context && context.canvas === canvas) {\n // Load platform resources on first chart creation, to make it possible to\n // import the library before setting platform options.\n initCanvas(canvas, aspectRatio);\n return context;\n }\n\n return null;\n }\n\n /**\n\t * @param {CanvasRenderingContext2D} context\n\t */\n releaseContext(context) {\n const canvas = context.canvas;\n if (!canvas[EXPANDO_KEY]) {\n return false;\n }\n\n const initial = canvas[EXPANDO_KEY].initial;\n ['height', 'width'].forEach((prop) => {\n const value = initial[prop];\n if (isNullOrUndef(value)) {\n canvas.removeAttribute(prop);\n } else {\n canvas.setAttribute(prop, value);\n }\n });\n\n const style = initial.style || {};\n Object.keys(style).forEach((key) => {\n canvas.style[key] = style[key];\n });\n\n // The canvas render size might have been changed (and thus the state stack discarded),\n // we can't use save() and restore() to restore the initial state. So make sure that at\n // least the canvas context is reset to the default state by setting the canvas width.\n // https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html\n // eslint-disable-next-line no-self-assign\n canvas.width = canvas.width;\n\n delete canvas[EXPANDO_KEY];\n return true;\n }\n\n /**\n\t *\n\t * @param {Chart} chart\n\t * @param {string} type\n\t * @param {function} listener\n\t */\n addEventListener(chart, type, listener) {\n // Can have only one listener per type, so make sure previous is removed\n this.removeEventListener(chart, type);\n\n const proxies = chart.$proxies || (chart.$proxies = {});\n const handlers = {\n attach: createAttachObserver,\n detach: createDetachObserver,\n resize: createResizeObserver\n };\n const handler = handlers[type] || createProxyAndListen;\n proxies[type] = handler(chart, type, listener);\n }\n\n\n /**\n\t * @param {Chart} chart\n\t * @param {string} type\n\t */\n removeEventListener(chart, type) {\n const proxies = chart.$proxies || (chart.$proxies = {});\n const proxy = proxies[type];\n\n if (!proxy) {\n return;\n }\n\n const handlers = {\n attach: releaseObserver,\n detach: releaseObserver,\n resize: releaseObserver\n };\n const handler = handlers[type] || removeListener;\n handler(chart, type, proxy);\n proxies[type] = undefined;\n }\n\n getDevicePixelRatio() {\n return window.devicePixelRatio;\n }\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t * @param {number} [width] - content width of parent element\n\t * @param {number} [height] - content height of parent element\n\t * @param {number} [aspectRatio] - aspect ratio to maintain\n\t */\n getMaximumSize(canvas, width, height, aspectRatio) {\n return getMaximumSize(canvas, width, height, aspectRatio);\n }\n\n /**\n\t * @param {HTMLCanvasElement} canvas\n\t */\n isAttached(canvas) {\n const container = _getParentNode(canvas);\n return !!(container && container.isConnected);\n }\n}\n","import {_isDomSupported} from '../helpers';\nimport BasePlatform from './platform.base';\nimport BasicPlatform from './platform.basic';\nimport DomPlatform from './platform.dom';\n\nexport function _detectPlatform(canvas) {\n if (!_isDomSupported() || (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas)) {\n return BasicPlatform;\n }\n return DomPlatform;\n}\n\nexport {BasePlatform, BasicPlatform, DomPlatform};\n","import effects from '../helpers/helpers.easing';\nimport {resolve} from '../helpers/helpers.options';\nimport {color as helpersColor} from '../helpers/helpers.color';\n\nconst transparent = 'transparent';\nconst interpolators = {\n boolean(from, to, factor) {\n return factor > 0.5 ? to : from;\n },\n /**\n * @param {string} from\n * @param {string} to\n * @param {number} factor\n */\n color(from, to, factor) {\n const c0 = helpersColor(from || transparent);\n const c1 = c0.valid && helpersColor(to || transparent);\n return c1 && c1.valid\n ? c1.mix(c0, factor).hexString()\n : to;\n },\n number(from, to, factor) {\n return from + (to - from) * factor;\n }\n};\n\nexport default class Animation {\n constructor(cfg, target, prop, to) {\n const currentValue = target[prop];\n\n to = resolve([cfg.to, to, currentValue, cfg.from]);\n const from = resolve([cfg.from, currentValue, to]);\n\n this._active = true;\n this._fn = cfg.fn || interpolators[cfg.type || typeof from];\n this._easing = effects[cfg.easing] || effects.linear;\n this._start = Math.floor(Date.now() + (cfg.delay || 0));\n this._duration = this._total = Math.floor(cfg.duration);\n this._loop = !!cfg.loop;\n this._target = target;\n this._prop = prop;\n this._from = from;\n this._to = to;\n this._promises = undefined;\n }\n\n active() {\n return this._active;\n }\n\n update(cfg, to, date) {\n if (this._active) {\n this._notify(false);\n\n const currentValue = this._target[this._prop];\n const elapsed = date - this._start;\n const remain = this._duration - elapsed;\n this._start = date;\n this._duration = Math.floor(Math.max(remain, cfg.duration));\n this._total += elapsed;\n this._loop = !!cfg.loop;\n this._to = resolve([cfg.to, to, currentValue, cfg.from]);\n this._from = resolve([cfg.from, currentValue, to]);\n }\n }\n\n cancel() {\n if (this._active) {\n // update current evaluated value, for smoother animations\n this.tick(Date.now());\n this._active = false;\n this._notify(false);\n }\n }\n\n tick(date) {\n const elapsed = date - this._start;\n const duration = this._duration;\n const prop = this._prop;\n const from = this._from;\n const loop = this._loop;\n const to = this._to;\n let factor;\n\n this._active = from !== to && (loop || (elapsed < duration));\n\n if (!this._active) {\n this._target[prop] = to;\n this._notify(true);\n return;\n }\n\n if (elapsed < 0) {\n this._target[prop] = from;\n return;\n }\n\n factor = (elapsed / duration) % 2;\n factor = loop && factor > 1 ? 2 - factor : factor;\n factor = this._easing(Math.min(1, Math.max(0, factor)));\n\n this._target[prop] = this._fn(from, to, factor);\n }\n\n wait() {\n const promises = this._promises || (this._promises = []);\n return new Promise((res, rej) => {\n promises.push({res, rej});\n });\n }\n\n _notify(resolved) {\n const method = resolved ? 'res' : 'rej';\n const promises = this._promises || [];\n for (let i = 0; i < promises.length; i++) {\n promises[i][method]();\n }\n }\n}\n","import animator from './core.animator';\nimport Animation from './core.animation';\nimport defaults from './core.defaults';\nimport {isArray, isObject} from '../helpers/helpers.core';\n\nexport default class Animations {\n constructor(chart, config) {\n this._chart = chart;\n this._properties = new Map();\n this.configure(config);\n }\n\n configure(config) {\n if (!isObject(config)) {\n return;\n }\n\n const animationOptions = Object.keys(defaults.animation);\n const animatedProps = this._properties;\n\n Object.getOwnPropertyNames(config).forEach(key => {\n const cfg = config[key];\n if (!isObject(cfg)) {\n return;\n }\n const resolved = {};\n for (const option of animationOptions) {\n resolved[option] = cfg[option];\n }\n\n (isArray(cfg.properties) && cfg.properties || [key]).forEach((prop) => {\n if (prop === key || !animatedProps.has(prop)) {\n animatedProps.set(prop, resolved);\n }\n });\n });\n }\n\n /**\n\t * Utility to handle animation of `options`.\n\t * @private\n\t */\n _animateOptions(target, values) {\n const newOptions = values.options;\n const options = resolveTargetOptions(target, newOptions);\n if (!options) {\n return [];\n }\n\n const animations = this._createAnimations(options, newOptions);\n if (newOptions.$shared) {\n // Going to shared options:\n // After all animations are done, assign the shared options object to the element\n // So any new updates to the shared options are observed\n awaitAll(target.options.$animations, newOptions).then(() => {\n target.options = newOptions;\n }, () => {\n // rejected, noop\n });\n }\n\n return animations;\n }\n\n /**\n\t * @private\n\t */\n _createAnimations(target, values) {\n const animatedProps = this._properties;\n const animations = [];\n const running = target.$animations || (target.$animations = {});\n const props = Object.keys(values);\n const date = Date.now();\n let i;\n\n for (i = props.length - 1; i >= 0; --i) {\n const prop = props[i];\n if (prop.charAt(0) === '$') {\n continue;\n }\n\n if (prop === 'options') {\n animations.push(...this._animateOptions(target, values));\n continue;\n }\n const value = values[prop];\n let animation = running[prop];\n const cfg = animatedProps.get(prop);\n\n if (animation) {\n if (cfg && animation.active()) {\n // There is an existing active animation, let's update that\n animation.update(cfg, value, date);\n continue;\n } else {\n animation.cancel();\n }\n }\n if (!cfg || !cfg.duration) {\n // not animated, set directly to new value\n target[prop] = value;\n continue;\n }\n\n running[prop] = animation = new Animation(cfg, target, prop, value);\n animations.push(animation);\n }\n return animations;\n }\n\n\n /**\n\t * Update `target` properties to new values, using configured animations\n\t * @param {object} target - object to update\n\t * @param {object} values - new target properties\n\t * @returns {boolean|undefined} - `true` if animations were started\n\t **/\n update(target, values) {\n if (this._properties.size === 0) {\n // Nothing is animated, just apply the new values.\n Object.assign(target, values);\n return;\n }\n\n const animations = this._createAnimations(target, values);\n\n if (animations.length) {\n animator.add(this._chart, animations);\n return true;\n }\n }\n}\n\nfunction awaitAll(animations, properties) {\n const running = [];\n const keys = Object.keys(properties);\n for (let i = 0; i < keys.length; i++) {\n const anim = animations[keys[i]];\n if (anim && anim.active()) {\n running.push(anim.wait());\n }\n }\n // @ts-ignore\n return Promise.all(running);\n}\n\nfunction resolveTargetOptions(target, newOptions) {\n if (!newOptions) {\n return;\n }\n let options = target.options;\n if (!options) {\n target.options = newOptions;\n return;\n }\n if (options.$shared) {\n // Going from shared options to distinct one:\n // Create new options object containing the old shared values and start updating that.\n target.options = options = Object.assign({}, options, {$shared: false, $animations: {}});\n }\n return options;\n}\n","import Animations from './core.animations';\nimport defaults from './core.defaults';\nimport {isArray, isFinite, isObject, valueOrDefault, resolveObjectKey, defined} from '../helpers/helpers.core';\nimport {listenArrayEvents, unlistenArrayEvents} from '../helpers/helpers.collection';\nimport {createContext, sign} from '../helpers';\n\n/**\n * @typedef { import(\"./core.controller\").default } Chart\n * @typedef { import(\"./core.scale\").default } Scale\n */\n\nfunction scaleClip(scale, allowedOverflow) {\n const opts = scale && scale.options || {};\n const reverse = opts.reverse;\n const min = opts.min === undefined ? allowedOverflow : 0;\n const max = opts.max === undefined ? allowedOverflow : 0;\n return {\n start: reverse ? max : min,\n end: reverse ? min : max\n };\n}\n\nfunction defaultClip(xScale, yScale, allowedOverflow) {\n if (allowedOverflow === false) {\n return false;\n }\n const x = scaleClip(xScale, allowedOverflow);\n const y = scaleClip(yScale, allowedOverflow);\n\n return {\n top: y.end,\n right: x.end,\n bottom: y.start,\n left: x.start\n };\n}\n\nfunction toClip(value) {\n let t, r, b, l;\n\n if (isObject(value)) {\n t = value.top;\n r = value.right;\n b = value.bottom;\n l = value.left;\n } else {\n t = r = b = l = value;\n }\n\n return {\n top: t,\n right: r,\n bottom: b,\n left: l,\n disabled: value === false\n };\n}\n\nfunction getSortedDatasetIndices(chart, filterVisible) {\n const keys = [];\n const metasets = chart._getSortedDatasetMetas(filterVisible);\n let i, ilen;\n\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n keys.push(metasets[i].index);\n }\n return keys;\n}\n\nfunction applyStack(stack, value, dsIndex, options = {}) {\n const keys = stack.keys;\n const singleMode = options.mode === 'single';\n let i, ilen, datasetIndex, otherValue;\n\n if (value === null) {\n return;\n }\n\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n datasetIndex = +keys[i];\n if (datasetIndex === dsIndex) {\n if (options.all) {\n continue;\n }\n break;\n }\n otherValue = stack.values[datasetIndex];\n if (isFinite(otherValue) && (singleMode || (value === 0 || sign(value) === sign(otherValue)))) {\n value += otherValue;\n }\n }\n return value;\n}\n\nfunction convertObjectDataToArray(data) {\n const keys = Object.keys(data);\n const adata = new Array(keys.length);\n let i, ilen, key;\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n key = keys[i];\n adata[i] = {\n x: key,\n y: data[key]\n };\n }\n return adata;\n}\n\nfunction isStacked(scale, meta) {\n const stacked = scale && scale.options.stacked;\n return stacked || (stacked === undefined && meta.stack !== undefined);\n}\n\nfunction getStackKey(indexScale, valueScale, meta) {\n return `${indexScale.id}.${valueScale.id}.${meta.stack || meta.type}`;\n}\n\nfunction getUserBounds(scale) {\n const {min, max, minDefined, maxDefined} = scale.getUserBounds();\n return {\n min: minDefined ? min : Number.NEGATIVE_INFINITY,\n max: maxDefined ? max : Number.POSITIVE_INFINITY\n };\n}\n\nfunction getOrCreateStack(stacks, stackKey, indexValue) {\n const subStack = stacks[stackKey] || (stacks[stackKey] = {});\n return subStack[indexValue] || (subStack[indexValue] = {});\n}\n\nfunction getLastIndexInStack(stack, vScale, positive, type) {\n for (const meta of vScale.getMatchingVisibleMetas(type).reverse()) {\n const value = stack[meta.index];\n if ((positive && value > 0) || (!positive && value < 0)) {\n return meta.index;\n }\n }\n\n return null;\n}\n\nfunction updateStacks(controller, parsed) {\n const {chart, _cachedMeta: meta} = controller;\n const stacks = chart._stacks || (chart._stacks = {}); // map structure is {stackKey: {datasetIndex: value}}\n const {iScale, vScale, index: datasetIndex} = meta;\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const key = getStackKey(iScale, vScale, meta);\n const ilen = parsed.length;\n let stack;\n\n for (let i = 0; i < ilen; ++i) {\n const item = parsed[i];\n const {[iAxis]: index, [vAxis]: value} = item;\n const itemStacks = item._stacks || (item._stacks = {});\n stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, index);\n stack[datasetIndex] = value;\n\n stack._top = getLastIndexInStack(stack, vScale, true, meta.type);\n stack._bottom = getLastIndexInStack(stack, vScale, false, meta.type);\n }\n}\n\nfunction getFirstScaleId(chart, axis) {\n const scales = chart.scales;\n return Object.keys(scales).filter(key => scales[key].axis === axis).shift();\n}\n\nfunction createDatasetContext(parent, index) {\n return createContext(parent,\n {\n active: false,\n dataset: undefined,\n datasetIndex: index,\n index,\n mode: 'default',\n type: 'dataset'\n }\n );\n}\n\nfunction createDataContext(parent, index, element) {\n return createContext(parent, {\n active: false,\n dataIndex: index,\n parsed: undefined,\n raw: undefined,\n element,\n index,\n mode: 'default',\n type: 'data'\n });\n}\n\nfunction clearStacks(meta, items) {\n // Not using meta.index here, because it might be already updated if the dataset changed location\n const datasetIndex = meta.controller.index;\n const axis = meta.vScale && meta.vScale.axis;\n if (!axis) {\n return;\n }\n\n items = items || meta._parsed;\n for (const parsed of items) {\n const stacks = parsed._stacks;\n if (!stacks || stacks[axis] === undefined || stacks[axis][datasetIndex] === undefined) {\n return;\n }\n delete stacks[axis][datasetIndex];\n }\n}\n\nconst isDirectUpdateMode = (mode) => mode === 'reset' || mode === 'none';\nconst cloneIfNotShared = (cached, shared) => shared ? cached : Object.assign({}, cached);\nconst createStack = (canStack, meta, chart) => canStack && !meta.hidden && meta._stacked\n && {keys: getSortedDatasetIndices(chart, true), values: null};\n\nexport default class DatasetController {\n\n /**\n * @type {any}\n */\n static defaults = {};\n\n /**\n * Element type used to generate a meta dataset (e.g. Chart.element.LineElement).\n */\n static datasetElementType = null;\n\n /**\n * Element type used to generate a meta data (e.g. Chart.element.PointElement).\n */\n static dataElementType = null;\n\n /**\n\t * @param {Chart} chart\n\t * @param {number} datasetIndex\n\t */\n constructor(chart, datasetIndex) {\n this.chart = chart;\n this._ctx = chart.ctx;\n this.index = datasetIndex;\n this._cachedDataOpts = {};\n this._cachedMeta = this.getMeta();\n this._type = this._cachedMeta.type;\n this.options = undefined;\n /** @type {boolean | object} */\n this._parsing = false;\n this._data = undefined;\n this._objectData = undefined;\n this._sharedOptions = undefined;\n this._drawStart = undefined;\n this._drawCount = undefined;\n this.enableOptionSharing = false;\n this.supportsDecimation = false;\n this.$context = undefined;\n this._syncList = [];\n this.datasetElementType = new.target.datasetElementType;\n this.dataElementType = new.target.dataElementType;\n\n this.initialize();\n }\n\n initialize() {\n const meta = this._cachedMeta;\n this.configure();\n this.linkScales();\n meta._stacked = isStacked(meta.vScale, meta);\n this.addElements();\n\n if (this.options.fill && !this.chart.isPluginEnabled('filler')) {\n console.warn(\"Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options\");\n }\n }\n\n updateIndex(datasetIndex) {\n if (this.index !== datasetIndex) {\n clearStacks(this._cachedMeta);\n }\n this.index = datasetIndex;\n }\n\n linkScales() {\n const chart = this.chart;\n const meta = this._cachedMeta;\n const dataset = this.getDataset();\n\n const chooseId = (axis, x, y, r) => axis === 'x' ? x : axis === 'r' ? r : y;\n\n const xid = meta.xAxisID = valueOrDefault(dataset.xAxisID, getFirstScaleId(chart, 'x'));\n const yid = meta.yAxisID = valueOrDefault(dataset.yAxisID, getFirstScaleId(chart, 'y'));\n const rid = meta.rAxisID = valueOrDefault(dataset.rAxisID, getFirstScaleId(chart, 'r'));\n const indexAxis = meta.indexAxis;\n const iid = meta.iAxisID = chooseId(indexAxis, xid, yid, rid);\n const vid = meta.vAxisID = chooseId(indexAxis, yid, xid, rid);\n meta.xScale = this.getScaleForId(xid);\n meta.yScale = this.getScaleForId(yid);\n meta.rScale = this.getScaleForId(rid);\n meta.iScale = this.getScaleForId(iid);\n meta.vScale = this.getScaleForId(vid);\n }\n\n getDataset() {\n return this.chart.data.datasets[this.index];\n }\n\n getMeta() {\n return this.chart.getDatasetMeta(this.index);\n }\n\n /**\n\t * @param {string} scaleID\n\t * @return {Scale}\n\t */\n getScaleForId(scaleID) {\n return this.chart.scales[scaleID];\n }\n\n /**\n\t * @private\n\t */\n _getOtherScale(scale) {\n const meta = this._cachedMeta;\n return scale === meta.iScale\n ? meta.vScale\n : meta.iScale;\n }\n\n reset() {\n this._update('reset');\n }\n\n /**\n\t * @private\n\t */\n _destroy() {\n const meta = this._cachedMeta;\n if (this._data) {\n unlistenArrayEvents(this._data, this);\n }\n if (meta._stacked) {\n clearStacks(meta);\n }\n }\n\n /**\n\t * @private\n\t */\n _dataCheck() {\n const dataset = this.getDataset();\n const data = dataset.data || (dataset.data = []);\n const _data = this._data;\n\n // In order to correctly handle data addition/deletion animation (an thus simulate\n // real-time charts), we need to monitor these data modifications and synchronize\n // the internal meta data accordingly.\n\n if (isObject(data)) {\n this._data = convertObjectDataToArray(data);\n } else if (_data !== data) {\n if (_data) {\n // This case happens when the user replaced the data array instance.\n unlistenArrayEvents(_data, this);\n // Discard old parsed data and stacks\n const meta = this._cachedMeta;\n clearStacks(meta);\n meta._parsed = [];\n }\n if (data && Object.isExtensible(data)) {\n listenArrayEvents(data, this);\n }\n this._syncList = [];\n this._data = data;\n }\n }\n\n addElements() {\n const meta = this._cachedMeta;\n\n this._dataCheck();\n\n if (this.datasetElementType) {\n meta.dataset = new this.datasetElementType();\n }\n }\n\n buildOrUpdateElements(resetNewElements) {\n const meta = this._cachedMeta;\n const dataset = this.getDataset();\n let stackChanged = false;\n\n this._dataCheck();\n\n // make sure cached _stacked status is current\n const oldStacked = meta._stacked;\n meta._stacked = isStacked(meta.vScale, meta);\n\n // detect change in stack option\n if (meta.stack !== dataset.stack) {\n stackChanged = true;\n // remove values from old stack\n clearStacks(meta);\n meta.stack = dataset.stack;\n }\n\n // Re-sync meta data in case the user replaced the data array or if we missed\n // any updates and so make sure that we handle number of datapoints changing.\n this._resyncElements(resetNewElements);\n\n // if stack changed, update stack values for the whole dataset\n if (stackChanged || oldStacked !== meta._stacked) {\n updateStacks(this, meta._parsed);\n }\n }\n\n /**\n\t * Merges user-supplied and default dataset-level options\n\t * @private\n\t */\n configure() {\n const config = this.chart.config;\n const scopeKeys = config.datasetScopeKeys(this._type);\n const scopes = config.getOptionScopes(this.getDataset(), scopeKeys, true);\n this.options = config.createResolver(scopes, this.getContext());\n this._parsing = this.options.parsing;\n this._cachedDataOpts = {};\n }\n\n /**\n\t * @param {number} start\n\t * @param {number} count\n\t */\n parse(start, count) {\n const {_cachedMeta: meta, _data: data} = this;\n const {iScale, _stacked} = meta;\n const iAxis = iScale.axis;\n\n let sorted = start === 0 && count === data.length ? true : meta._sorted;\n let prev = start > 0 && meta._parsed[start - 1];\n let i, cur, parsed;\n\n if (this._parsing === false) {\n meta._parsed = data;\n meta._sorted = true;\n parsed = data;\n } else {\n if (isArray(data[start])) {\n parsed = this.parseArrayData(meta, data, start, count);\n } else if (isObject(data[start])) {\n parsed = this.parseObjectData(meta, data, start, count);\n } else {\n parsed = this.parsePrimitiveData(meta, data, start, count);\n }\n\n const isNotInOrderComparedToPrev = () => cur[iAxis] === null || (prev && cur[iAxis] < prev[iAxis]);\n for (i = 0; i < count; ++i) {\n meta._parsed[i + start] = cur = parsed[i];\n if (sorted) {\n if (isNotInOrderComparedToPrev()) {\n sorted = false;\n }\n prev = cur;\n }\n }\n meta._sorted = sorted;\n }\n\n if (_stacked) {\n updateStacks(this, parsed);\n }\n }\n\n /**\n\t * Parse array of primitive values\n\t * @param {object} meta - dataset meta\n\t * @param {array} data - data array. Example [1,3,4]\n\t * @param {number} start - start index\n\t * @param {number} count - number of items to parse\n\t * @returns {object} parsed item - item containing index and a parsed value\n\t * for each scale id.\n\t * Example: {xScale0: 0, yScale0: 1}\n\t * @protected\n\t */\n parsePrimitiveData(meta, data, start, count) {\n const {iScale, vScale} = meta;\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const labels = iScale.getLabels();\n const singleScale = iScale === vScale;\n const parsed = new Array(count);\n let i, ilen, index;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n parsed[i] = {\n [iAxis]: singleScale || iScale.parse(labels[index], index),\n [vAxis]: vScale.parse(data[index], index)\n };\n }\n return parsed;\n }\n\n /**\n\t * Parse array of arrays\n\t * @param {object} meta - dataset meta\n\t * @param {array} data - data array. Example [[1,2],[3,4]]\n\t * @param {number} start - start index\n\t * @param {number} count - number of items to parse\n\t * @returns {object} parsed item - item containing index and a parsed value\n\t * for each scale id.\n\t * Example: {x: 0, y: 1}\n\t * @protected\n\t */\n parseArrayData(meta, data, start, count) {\n const {xScale, yScale} = meta;\n const parsed = new Array(count);\n let i, ilen, index, item;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(item[0], index),\n y: yScale.parse(item[1], index)\n };\n }\n return parsed;\n }\n\n /**\n\t * Parse array of objects\n\t * @param {object} meta - dataset meta\n\t * @param {array} data - data array. Example [{x:1, y:5}, {x:2, y:10}]\n\t * @param {number} start - start index\n\t * @param {number} count - number of items to parse\n\t * @returns {object} parsed item - item containing index and a parsed value\n\t * for each scale id. _custom is optional\n\t * Example: {xScale0: 0, yScale0: 1, _custom: {r: 10, foo: 'bar'}}\n\t * @protected\n\t */\n parseObjectData(meta, data, start, count) {\n const {xScale, yScale} = meta;\n const {xAxisKey = 'x', yAxisKey = 'y'} = this._parsing;\n const parsed = new Array(count);\n let i, ilen, index, item;\n\n for (i = 0, ilen = count; i < ilen; ++i) {\n index = i + start;\n item = data[index];\n parsed[i] = {\n x: xScale.parse(resolveObjectKey(item, xAxisKey), index),\n y: yScale.parse(resolveObjectKey(item, yAxisKey), index)\n };\n }\n return parsed;\n }\n\n /**\n\t * @protected\n\t */\n getParsed(index) {\n return this._cachedMeta._parsed[index];\n }\n\n /**\n\t * @protected\n\t */\n getDataElement(index) {\n return this._cachedMeta.data[index];\n }\n\n /**\n\t * @protected\n\t */\n applyStack(scale, parsed, mode) {\n const chart = this.chart;\n const meta = this._cachedMeta;\n const value = parsed[scale.axis];\n const stack = {\n keys: getSortedDatasetIndices(chart, true),\n values: parsed._stacks[scale.axis]\n };\n return applyStack(stack, value, meta.index, {mode});\n }\n\n /**\n\t * @protected\n\t */\n updateRangeFromParsed(range, scale, parsed, stack) {\n const parsedValue = parsed[scale.axis];\n let value = parsedValue === null ? NaN : parsedValue;\n const values = stack && parsed._stacks[scale.axis];\n if (stack && values) {\n stack.values = values;\n value = applyStack(stack, parsedValue, this._cachedMeta.index);\n }\n range.min = Math.min(range.min, value);\n range.max = Math.max(range.max, value);\n }\n\n /**\n\t * @protected\n\t */\n getMinMax(scale, canStack) {\n const meta = this._cachedMeta;\n const _parsed = meta._parsed;\n const sorted = meta._sorted && scale === meta.iScale;\n const ilen = _parsed.length;\n const otherScale = this._getOtherScale(scale);\n const stack = createStack(canStack, meta, this.chart);\n const range = {min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY};\n const {min: otherMin, max: otherMax} = getUserBounds(otherScale);\n let i, parsed;\n\n function _skip() {\n parsed = _parsed[i];\n const otherValue = parsed[otherScale.axis];\n return !isFinite(parsed[scale.axis]) || otherMin > otherValue || otherMax < otherValue;\n }\n\n for (i = 0; i < ilen; ++i) {\n if (_skip()) {\n continue;\n }\n this.updateRangeFromParsed(range, scale, parsed, stack);\n if (sorted) {\n // if the data is sorted, we don't need to check further from this end of array\n break;\n }\n }\n if (sorted) {\n // in the sorted case, find first non-skipped value from other end of array\n for (i = ilen - 1; i >= 0; --i) {\n if (_skip()) {\n continue;\n }\n this.updateRangeFromParsed(range, scale, parsed, stack);\n break;\n }\n }\n return range;\n }\n\n getAllParsedValues(scale) {\n const parsed = this._cachedMeta._parsed;\n const values = [];\n let i, ilen, value;\n\n for (i = 0, ilen = parsed.length; i < ilen; ++i) {\n value = parsed[i][scale.axis];\n if (isFinite(value)) {\n values.push(value);\n }\n }\n return values;\n }\n\n /**\n\t * @return {number|boolean}\n\t * @protected\n\t */\n getMaxOverflow() {\n return false;\n }\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const iScale = meta.iScale;\n const vScale = meta.vScale;\n const parsed = this.getParsed(index);\n return {\n label: iScale ? '' + iScale.getLabelForValue(parsed[iScale.axis]) : '',\n value: vScale ? '' + vScale.getLabelForValue(parsed[vScale.axis]) : ''\n };\n }\n\n /**\n\t * @private\n\t */\n _update(mode) {\n const meta = this._cachedMeta;\n this.update(mode || 'default');\n meta._clip = toClip(valueOrDefault(this.options.clip, defaultClip(meta.xScale, meta.yScale, this.getMaxOverflow())));\n }\n\n /**\n\t * @param {string} mode\n\t */\n update(mode) {} // eslint-disable-line no-unused-vars\n\n draw() {\n const ctx = this._ctx;\n const chart = this.chart;\n const meta = this._cachedMeta;\n const elements = meta.data || [];\n const area = chart.chartArea;\n const active = [];\n const start = this._drawStart || 0;\n const count = this._drawCount || (elements.length - start);\n const drawActiveElementsOnTop = this.options.drawActiveElementsOnTop;\n let i;\n\n if (meta.dataset) {\n meta.dataset.draw(ctx, area, start, count);\n }\n\n for (i = start; i < start + count; ++i) {\n const element = elements[i];\n if (element.hidden) {\n continue;\n }\n if (element.active && drawActiveElementsOnTop) {\n active.push(element);\n } else {\n element.draw(ctx, area);\n }\n }\n\n for (i = 0; i < active.length; ++i) {\n active[i].draw(ctx, area);\n }\n }\n\n /**\n\t * Returns a set of predefined style properties that should be used to represent the dataset\n\t * or the data if the index is specified\n\t * @param {number} index - data index\n\t * @param {boolean} [active] - true if hover\n\t * @return {object} style object\n\t */\n getStyle(index, active) {\n const mode = active ? 'active' : 'default';\n return index === undefined && this._cachedMeta.dataset\n ? this.resolveDatasetElementOptions(mode)\n : this.resolveDataElementOptions(index || 0, mode);\n }\n\n /**\n\t * @protected\n\t */\n getContext(index, active, mode) {\n const dataset = this.getDataset();\n let context;\n if (index >= 0 && index < this._cachedMeta.data.length) {\n const element = this._cachedMeta.data[index];\n context = element.$context ||\n (element.$context = createDataContext(this.getContext(), index, element));\n context.parsed = this.getParsed(index);\n context.raw = dataset.data[index];\n context.index = context.dataIndex = index;\n } else {\n context = this.$context ||\n (this.$context = createDatasetContext(this.chart.getContext(), this.index));\n context.dataset = dataset;\n context.index = context.datasetIndex = this.index;\n }\n\n context.active = !!active;\n context.mode = mode;\n return context;\n }\n\n /**\n\t * @param {string} [mode]\n\t * @protected\n\t */\n resolveDatasetElementOptions(mode) {\n return this._resolveElementOptions(this.datasetElementType.id, mode);\n }\n\n /**\n\t * @param {number} index\n\t * @param {string} [mode]\n\t * @protected\n\t */\n resolveDataElementOptions(index, mode) {\n return this._resolveElementOptions(this.dataElementType.id, mode, index);\n }\n\n /**\n\t * @private\n\t */\n _resolveElementOptions(elementType, mode = 'default', index) {\n const active = mode === 'active';\n const cache = this._cachedDataOpts;\n const cacheKey = elementType + '-' + mode;\n const cached = cache[cacheKey];\n const sharing = this.enableOptionSharing && defined(index);\n if (cached) {\n return cloneIfNotShared(cached, sharing);\n }\n const config = this.chart.config;\n const scopeKeys = config.datasetElementScopeKeys(this._type, elementType);\n const prefixes = active ? [`${elementType}Hover`, 'hover', elementType, ''] : [elementType, ''];\n const scopes = config.getOptionScopes(this.getDataset(), scopeKeys);\n const names = Object.keys(defaults.elements[elementType]);\n // context is provided as a function, and is called only if needed,\n // so we don't create a context for each element if not needed.\n const context = () => this.getContext(index, active);\n const values = config.resolveNamedOptions(scopes, names, context, prefixes);\n\n if (values.$shared) {\n // `$shared` indicates this set of options can be shared between multiple elements.\n // Sharing is used to reduce number of properties to change during animation.\n values.$shared = sharing;\n\n // We cache options by `mode`, which can be 'active' for example. This enables us\n // to have the 'active' element options and 'default' options to switch between\n // when interacting.\n cache[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));\n }\n\n return values;\n }\n\n\n /**\n\t * @private\n\t */\n _resolveAnimations(index, transition, active) {\n const chart = this.chart;\n const cache = this._cachedDataOpts;\n const cacheKey = `animation-${transition}`;\n const cached = cache[cacheKey];\n if (cached) {\n return cached;\n }\n let options;\n if (chart.options.animation !== false) {\n const config = this.chart.config;\n const scopeKeys = config.datasetAnimationScopeKeys(this._type, transition);\n const scopes = config.getOptionScopes(this.getDataset(), scopeKeys);\n options = config.createResolver(scopes, this.getContext(index, active, transition));\n }\n const animations = new Animations(chart, options && options.animations);\n if (options && options._cacheable) {\n cache[cacheKey] = Object.freeze(animations);\n }\n return animations;\n }\n\n /**\n\t * Utility for getting the options object shared between elements\n\t * @protected\n\t */\n getSharedOptions(options) {\n if (!options.$shared) {\n return;\n }\n return this._sharedOptions || (this._sharedOptions = Object.assign({}, options));\n }\n\n /**\n\t * Utility for determining if `options` should be included in the updated properties\n\t * @protected\n\t */\n includeOptions(mode, sharedOptions) {\n return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;\n }\n\n /**\n * @todo v4, rename to getSharedOptions and remove excess functions\n */\n _getSharedOptions(start, mode) {\n const firstOpts = this.resolveDataElementOptions(start, mode);\n const previouslySharedOptions = this._sharedOptions;\n const sharedOptions = this.getSharedOptions(firstOpts);\n const includeOptions = this.includeOptions(mode, sharedOptions) || (sharedOptions !== previouslySharedOptions);\n this.updateSharedOptions(sharedOptions, mode, firstOpts);\n return {sharedOptions, includeOptions};\n }\n\n /**\n\t * Utility for updating an element with new properties, using animations when appropriate.\n\t * @protected\n\t */\n updateElement(element, index, properties, mode) {\n if (isDirectUpdateMode(mode)) {\n Object.assign(element, properties);\n } else {\n this._resolveAnimations(index, mode).update(element, properties);\n }\n }\n\n /**\n\t * Utility to animate the shared options, that are potentially affecting multiple elements.\n\t * @protected\n\t */\n updateSharedOptions(sharedOptions, mode, newOptions) {\n if (sharedOptions && !isDirectUpdateMode(mode)) {\n this._resolveAnimations(undefined, mode).update(sharedOptions, newOptions);\n }\n }\n\n /**\n\t * @private\n\t */\n _setStyle(element, index, mode, active) {\n element.active = active;\n const options = this.getStyle(index, active);\n this._resolveAnimations(index, mode, active).update(element, {\n // When going from active to inactive, we need to update to the shared options.\n // This way the once hovered element will end up with the same original shared options instance, after animation.\n options: (!active && this.getSharedOptions(options)) || options\n });\n }\n\n removeHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', false);\n }\n\n setHoverStyle(element, datasetIndex, index) {\n this._setStyle(element, index, 'active', true);\n }\n\n /**\n\t * @private\n\t */\n _removeDatasetHoverStyle() {\n const element = this._cachedMeta.dataset;\n\n if (element) {\n this._setStyle(element, undefined, 'active', false);\n }\n }\n\n /**\n\t * @private\n\t */\n _setDatasetHoverStyle() {\n const element = this._cachedMeta.dataset;\n\n if (element) {\n this._setStyle(element, undefined, 'active', true);\n }\n }\n\n /**\n\t * @private\n\t */\n _resyncElements(resetNewElements) {\n const data = this._data;\n const elements = this._cachedMeta.data;\n\n // Apply changes detected through array listeners\n for (const [method, arg1, arg2] of this._syncList) {\n this[method](arg1, arg2);\n }\n this._syncList = [];\n\n const numMeta = elements.length;\n const numData = data.length;\n const count = Math.min(numData, numMeta);\n\n if (count) {\n // TODO: It is not optimal to always parse the old data\n // This is done because we are not detecting direct assignments:\n // chart.data.datasets[0].data[5] = 10;\n // chart.data.datasets[0].data[5].y = 10;\n this.parse(0, count);\n }\n\n if (numData > numMeta) {\n this._insertElements(numMeta, numData - numMeta, resetNewElements);\n } else if (numData < numMeta) {\n this._removeElements(numData, numMeta - numData);\n }\n }\n\n /**\n\t * @private\n\t */\n _insertElements(start, count, resetNewElements = true) {\n const meta = this._cachedMeta;\n const data = meta.data;\n const end = start + count;\n let i;\n\n const move = (arr) => {\n arr.length += count;\n for (i = arr.length - 1; i >= end; i--) {\n arr[i] = arr[i - count];\n }\n };\n move(data);\n\n for (i = start; i < end; ++i) {\n data[i] = new this.dataElementType();\n }\n\n if (this._parsing) {\n move(meta._parsed);\n }\n this.parse(start, count);\n\n if (resetNewElements) {\n this.updateElements(data, start, count, 'reset');\n }\n }\n\n updateElements(element, start, count, mode) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * @private\n\t */\n _removeElements(start, count) {\n const meta = this._cachedMeta;\n if (this._parsing) {\n const removed = meta._parsed.splice(start, count);\n if (meta._stacked) {\n clearStacks(meta, removed);\n }\n }\n meta.data.splice(start, count);\n }\n\n /**\n\t * @private\n */\n _sync(args) {\n if (this._parsing) {\n this._syncList.push(args);\n } else {\n const [method, arg1, arg2] = args;\n this[method](arg1, arg2);\n }\n this.chart._dataChanges.push([this.index, ...args]);\n }\n\n _onDataPush() {\n const count = arguments.length;\n this._sync(['_insertElements', this.getDataset().data.length - count, count]);\n }\n\n _onDataPop() {\n this._sync(['_removeElements', this._cachedMeta.data.length - 1, 1]);\n }\n\n _onDataShift() {\n this._sync(['_removeElements', 0, 1]);\n }\n\n _onDataSplice(start, count) {\n if (count) {\n this._sync(['_removeElements', start, count]);\n }\n const newCount = arguments.length - 2;\n if (newCount) {\n this._sync(['_insertElements', start, newCount]);\n }\n }\n\n _onDataUnshift() {\n this._sync(['_insertElements', 0, arguments.length]);\n }\n}\n","import type {AnyObject} from '../../types/basic';\nimport type {Point} from '../../types/geometric';\nimport type {Animation} from '../../types/animation';\nimport {isNumber} from '../helpers/helpers.math';\n\nexport default class Element {\n\n static defaults = {};\n static defaultRoutes = undefined;\n\n x: number;\n y: number;\n active = false;\n options: O;\n $animations: Record;\n\n tooltipPosition(useFinalPosition: boolean): Point {\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return {x, y} as Point;\n }\n\n hasValue() {\n return isNumber(this.x) && isNumber(this.y);\n }\n\n /**\n * Gets the current or final value of each prop. Can return extra properties (whole object).\n * @param props - properties to get\n * @param [final] - get the final value (animation target)\n */\n getProps

(props: P, final?: boolean): Pick;\n getProps

(props: P[], final?: boolean): Partial>;\n getProps(props: string[], final?: boolean): Partial> {\n const anims = this.$animations;\n if (!final || !anims) {\n // let's not create an object, if not needed\n return this as Record;\n }\n const ret: Record = {};\n props.forEach((prop) => {\n ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : this[prop as string];\n });\n return ret;\n }\n}\n","import {isNullOrUndef, valueOrDefault} from '../helpers/helpers.core';\nimport {_factorize} from '../helpers/helpers.math';\n\n\n/**\n * @typedef { import(\"./core.controller\").default } Chart\n * @typedef {{value:number | string, label?:string, major?:boolean, $context?:any}} Tick\n */\n\n/**\n * Returns a subset of ticks to be plotted to avoid overlapping labels.\n * @param {import('./core.scale').default} scale\n * @param {Tick[]} ticks\n * @return {Tick[]}\n * @private\n */\nexport function autoSkip(scale, ticks) {\n const tickOpts = scale.options.ticks;\n const determinedMaxTicks = determineMaxTicks(scale);\n const ticksLimit = Math.min(tickOpts.maxTicksLimit || determinedMaxTicks, determinedMaxTicks);\n const majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];\n const numMajorIndices = majorIndices.length;\n const first = majorIndices[0];\n const last = majorIndices[numMajorIndices - 1];\n const newTicks = [];\n\n // If there are too many major ticks to display them all\n if (numMajorIndices > ticksLimit) {\n skipMajors(ticks, newTicks, majorIndices, numMajorIndices / ticksLimit);\n return newTicks;\n }\n\n const spacing = calculateSpacing(majorIndices, ticks, ticksLimit);\n\n if (numMajorIndices > 0) {\n let i, ilen;\n const avgMajorSpacing = numMajorIndices > 1 ? Math.round((last - first) / (numMajorIndices - 1)) : null;\n skip(ticks, newTicks, spacing, isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);\n for (i = 0, ilen = numMajorIndices - 1; i < ilen; i++) {\n skip(ticks, newTicks, spacing, majorIndices[i], majorIndices[i + 1]);\n }\n skip(ticks, newTicks, spacing, last, isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);\n return newTicks;\n }\n skip(ticks, newTicks, spacing);\n return newTicks;\n}\n\nfunction determineMaxTicks(scale) {\n const offset = scale.options.offset;\n const tickLength = scale._tickSize();\n const maxScale = scale._length / tickLength + (offset ? 0 : 1);\n const maxChart = scale._maxLength / tickLength;\n return Math.floor(Math.min(maxScale, maxChart));\n}\n\n/**\n * @param {number[]} majorIndices\n * @param {Tick[]} ticks\n * @param {number} ticksLimit\n */\nfunction calculateSpacing(majorIndices, ticks, ticksLimit) {\n const evenMajorSpacing = getEvenSpacing(majorIndices);\n const spacing = ticks.length / ticksLimit;\n\n // If the major ticks are evenly spaced apart, place the minor ticks\n // so that they divide the major ticks into even chunks\n if (!evenMajorSpacing) {\n return Math.max(spacing, 1);\n }\n\n const factors = _factorize(evenMajorSpacing);\n for (let i = 0, ilen = factors.length - 1; i < ilen; i++) {\n const factor = factors[i];\n if (factor > spacing) {\n return factor;\n }\n }\n return Math.max(spacing, 1);\n}\n\n/**\n * @param {Tick[]} ticks\n */\nfunction getMajorIndices(ticks) {\n const result = [];\n let i, ilen;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n if (ticks[i].major) {\n result.push(i);\n }\n }\n return result;\n}\n\n/**\n * @param {Tick[]} ticks\n * @param {Tick[]} newTicks\n * @param {number[]} majorIndices\n * @param {number} spacing\n */\nfunction skipMajors(ticks, newTicks, majorIndices, spacing) {\n let count = 0;\n let next = majorIndices[0];\n let i;\n\n spacing = Math.ceil(spacing);\n for (i = 0; i < ticks.length; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = majorIndices[count * spacing];\n }\n }\n}\n\n/**\n * @param {Tick[]} ticks\n * @param {Tick[]} newTicks\n * @param {number} spacing\n * @param {number} [majorStart]\n * @param {number} [majorEnd]\n */\nfunction skip(ticks, newTicks, spacing, majorStart, majorEnd) {\n const start = valueOrDefault(majorStart, 0);\n const end = Math.min(valueOrDefault(majorEnd, ticks.length), ticks.length);\n let count = 0;\n let length, i, next;\n\n spacing = Math.ceil(spacing);\n if (majorEnd) {\n length = majorEnd - majorStart;\n spacing = length / Math.floor(length / spacing);\n }\n\n next = start;\n\n while (next < 0) {\n count++;\n next = Math.round(start + count * spacing);\n }\n\n for (i = Math.max(start, 0); i < end; i++) {\n if (i === next) {\n newTicks.push(ticks[i]);\n count++;\n next = Math.round(start + count * spacing);\n }\n }\n}\n\n\n/**\n * @param {number[]} arr\n */\nfunction getEvenSpacing(arr) {\n const len = arr.length;\n let i, diff;\n\n if (len < 2) {\n return false;\n }\n\n for (diff = arr[0], i = 1; i < len; ++i) {\n if (arr[i] - arr[i - 1] !== diff) {\n return false;\n }\n }\n return diff;\n}\n","import Element from './core.element';\nimport {_alignPixel, _measureText, renderText, clipArea, unclipArea} from '../helpers/helpers.canvas';\nimport {callback as call, each, finiteOrDefault, isArray, isFinite, isNullOrUndef, isObject, valueOrDefault} from '../helpers/helpers.core';\nimport {toDegrees, toRadians, _int16Range, _limitValue, HALF_PI} from '../helpers/helpers.math';\nimport {_alignStartEnd, _toLeftRightCenter} from '../helpers/helpers.extras';\nimport {createContext, toFont, toPadding, _addGrace} from '../helpers/helpers.options';\nimport {autoSkip} from './core.scale.autoskip';\n\nconst reverseAlign = (align) => align === 'left' ? 'right' : align === 'right' ? 'left' : align;\nconst offsetFromEdge = (scale, edge, offset) => edge === 'top' || edge === 'left' ? scale[edge] + offset : scale[edge] - offset;\n\n/**\n * @typedef { import(\"./core.controller\").default } Chart\n * @typedef {{value:number | string, label?:string, major?:boolean, $context?:any}} Tick\n */\n\n/**\n * Returns a new array containing numItems from arr\n * @param {any[]} arr\n * @param {number} numItems\n */\nfunction sample(arr, numItems) {\n const result = [];\n const increment = arr.length / numItems;\n const len = arr.length;\n let i = 0;\n\n for (; i < len; i += increment) {\n result.push(arr[Math.floor(i)]);\n }\n return result;\n}\n\n/**\n * @param {Scale} scale\n * @param {number} index\n * @param {boolean} offsetGridLines\n */\nfunction getPixelForGridLine(scale, index, offsetGridLines) {\n const length = scale.ticks.length;\n const validIndex = Math.min(index, length - 1);\n const start = scale._startPixel;\n const end = scale._endPixel;\n const epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.\n let lineValue = scale.getPixelForTick(validIndex);\n let offset;\n\n if (offsetGridLines) {\n if (length === 1) {\n offset = Math.max(lineValue - start, end - lineValue);\n } else if (index === 0) {\n offset = (scale.getPixelForTick(1) - lineValue) / 2;\n } else {\n offset = (lineValue - scale.getPixelForTick(validIndex - 1)) / 2;\n }\n lineValue += validIndex < index ? offset : -offset;\n\n // Return undefined if the pixel is out of the range\n if (lineValue < start - epsilon || lineValue > end + epsilon) {\n return;\n }\n }\n return lineValue;\n}\n\n/**\n * @param {object} caches\n * @param {number} length\n */\nfunction garbageCollect(caches, length) {\n each(caches, (cache) => {\n const gc = cache.gc;\n const gcLen = gc.length / 2;\n let i;\n if (gcLen > length) {\n for (i = 0; i < gcLen; ++i) {\n delete cache.data[gc[i]];\n }\n gc.splice(0, gcLen);\n }\n });\n}\n\n/**\n * @param {object} options\n */\nfunction getTickMarkLength(options) {\n return options.drawTicks ? options.tickLength : 0;\n}\n\n/**\n * @param {object} options\n */\nfunction getTitleHeight(options, fallback) {\n if (!options.display) {\n return 0;\n }\n\n const font = toFont(options.font, fallback);\n const padding = toPadding(options.padding);\n const lines = isArray(options.text) ? options.text.length : 1;\n\n return (lines * font.lineHeight) + padding.height;\n}\n\nfunction createScaleContext(parent, scale) {\n return createContext(parent, {\n scale,\n type: 'scale'\n });\n}\n\nfunction createTickContext(parent, index, tick) {\n return createContext(parent, {\n tick,\n index,\n type: 'tick'\n });\n}\n\nfunction titleAlign(align, position, reverse) {\n let ret = _toLeftRightCenter(align);\n if ((reverse && position !== 'right') || (!reverse && position === 'right')) {\n ret = reverseAlign(ret);\n }\n return ret;\n}\n\nfunction titleArgs(scale, offset, position, align) {\n const {top, left, bottom, right, chart} = scale;\n const {chartArea, scales} = chart;\n let rotation = 0;\n let maxWidth, titleX, titleY;\n const height = bottom - top;\n const width = right - left;\n\n if (scale.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n\n if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n titleY = scales[positionAxisID].getPixelForValue(value) + height - offset;\n } else if (position === 'center') {\n titleY = (chartArea.bottom + chartArea.top) / 2 + height - offset;\n } else {\n titleY = offsetFromEdge(scale, position, offset);\n }\n maxWidth = right - left;\n } else {\n if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n titleX = scales[positionAxisID].getPixelForValue(value) - width + offset;\n } else if (position === 'center') {\n titleX = (chartArea.left + chartArea.right) / 2 - width + offset;\n } else {\n titleX = offsetFromEdge(scale, position, offset);\n }\n titleY = _alignStartEnd(align, bottom, top);\n rotation = position === 'left' ? -HALF_PI : HALF_PI;\n }\n return {titleX, titleY, maxWidth, rotation};\n}\n\nexport default class Scale extends Element {\n\n // eslint-disable-next-line max-statements\n constructor(cfg) {\n super();\n\n /** @type {string} */\n this.id = cfg.id;\n /** @type {string} */\n this.type = cfg.type;\n /** @type {any} */\n this.options = undefined;\n /** @type {CanvasRenderingContext2D} */\n this.ctx = cfg.ctx;\n /** @type {Chart} */\n this.chart = cfg.chart;\n\n // implements box\n /** @type {number} */\n this.top = undefined;\n /** @type {number} */\n this.bottom = undefined;\n /** @type {number} */\n this.left = undefined;\n /** @type {number} */\n this.right = undefined;\n /** @type {number} */\n this.width = undefined;\n /** @type {number} */\n this.height = undefined;\n this._margins = {\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n };\n /** @type {number} */\n this.maxWidth = undefined;\n /** @type {number} */\n this.maxHeight = undefined;\n /** @type {number} */\n this.paddingTop = undefined;\n /** @type {number} */\n this.paddingBottom = undefined;\n /** @type {number} */\n this.paddingLeft = undefined;\n /** @type {number} */\n this.paddingRight = undefined;\n\n // scale-specific properties\n /** @type {string=} */\n this.axis = undefined;\n /** @type {number=} */\n this.labelRotation = undefined;\n this.min = undefined;\n this.max = undefined;\n this._range = undefined;\n /** @type {Tick[]} */\n this.ticks = [];\n /** @type {object[]|null} */\n this._gridLineItems = null;\n /** @type {object[]|null} */\n this._labelItems = null;\n /** @type {object|null} */\n this._labelSizes = null;\n this._length = 0;\n this._maxLength = 0;\n this._longestTextCache = {};\n /** @type {number} */\n this._startPixel = undefined;\n /** @type {number} */\n this._endPixel = undefined;\n this._reversePixels = false;\n this._userMax = undefined;\n this._userMin = undefined;\n this._suggestedMax = undefined;\n this._suggestedMin = undefined;\n this._ticksLength = 0;\n this._borderValue = 0;\n this._cache = {};\n this._dataLimitsCached = false;\n this.$context = undefined;\n }\n\n /**\n\t * @param {any} options\n\t * @since 3.0\n\t */\n init(options) {\n this.options = options.setContext(this.getContext());\n\n this.axis = options.axis;\n\n // parse min/max value, so we can properly determine min/max for other scales\n this._userMin = this.parse(options.min);\n this._userMax = this.parse(options.max);\n this._suggestedMin = this.parse(options.suggestedMin);\n this._suggestedMax = this.parse(options.suggestedMax);\n }\n\n /**\n\t * Parse a supported input value to internal representation.\n\t * @param {*} raw\n\t * @param {number} [index]\n\t * @since 3.0\n\t */\n parse(raw, index) { // eslint-disable-line no-unused-vars\n return raw;\n }\n\n /**\n\t * @return {{min: number, max: number, minDefined: boolean, maxDefined: boolean}}\n\t * @protected\n\t * @since 3.0\n\t */\n getUserBounds() {\n let {_userMin, _userMax, _suggestedMin, _suggestedMax} = this;\n _userMin = finiteOrDefault(_userMin, Number.POSITIVE_INFINITY);\n _userMax = finiteOrDefault(_userMax, Number.NEGATIVE_INFINITY);\n _suggestedMin = finiteOrDefault(_suggestedMin, Number.POSITIVE_INFINITY);\n _suggestedMax = finiteOrDefault(_suggestedMax, Number.NEGATIVE_INFINITY);\n return {\n min: finiteOrDefault(_userMin, _suggestedMin),\n max: finiteOrDefault(_userMax, _suggestedMax),\n minDefined: isFinite(_userMin),\n maxDefined: isFinite(_userMax)\n };\n }\n\n /**\n\t * @param {boolean} canStack\n\t * @return {{min: number, max: number}}\n\t * @protected\n\t * @since 3.0\n\t */\n getMinMax(canStack) {\n // eslint-disable-next-line prefer-const\n let {min, max, minDefined, maxDefined} = this.getUserBounds();\n let range;\n\n if (minDefined && maxDefined) {\n return {min, max};\n }\n\n const metas = this.getMatchingVisibleMetas();\n for (let i = 0, ilen = metas.length; i < ilen; ++i) {\n range = metas[i].controller.getMinMax(this, canStack);\n if (!minDefined) {\n min = Math.min(min, range.min);\n }\n if (!maxDefined) {\n max = Math.max(max, range.max);\n }\n }\n\n // Make sure min <= max when only min or max is defined by user and the data is outside that range\n min = maxDefined && min > max ? max : min;\n max = minDefined && min > max ? min : max;\n\n return {\n min: finiteOrDefault(min, finiteOrDefault(max, min)),\n max: finiteOrDefault(max, finiteOrDefault(min, max))\n };\n }\n\n /**\n\t * Get the padding needed for the scale\n\t * @return {{top: number, left: number, bottom: number, right: number}} the necessary padding\n\t * @private\n\t */\n getPadding() {\n return {\n left: this.paddingLeft || 0,\n top: this.paddingTop || 0,\n right: this.paddingRight || 0,\n bottom: this.paddingBottom || 0\n };\n }\n\n /**\n\t * Returns the scale tick objects\n\t * @return {Tick[]}\n\t * @since 2.7\n\t */\n getTicks() {\n return this.ticks;\n }\n\n /**\n\t * @return {string[]}\n\t */\n getLabels() {\n const data = this.chart.data;\n return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];\n }\n\n // When a new layout is created, reset the data limits cache\n beforeLayout() {\n this._cache = {};\n this._dataLimitsCached = false;\n }\n\n // These methods are ordered by lifecycle. Utilities then follow.\n // Any function defined here is inherited by all scale types.\n // Any function can be extended by the scale type\n\n beforeUpdate() {\n call(this.options.beforeUpdate, [this]);\n }\n\n /**\n\t * @param {number} maxWidth - the max width in pixels\n\t * @param {number} maxHeight - the max height in pixels\n\t * @param {{top: number, left: number, bottom: number, right: number}} margins - the space between the edge of the other scales and edge of the chart\n\t * This space comes from two sources:\n\t * - padding - space that's required to show the labels at the edges of the scale\n\t * - thickness of scales or legends in another orientation\n\t */\n update(maxWidth, maxHeight, margins) {\n const {beginAtZero, grace, ticks: tickOpts} = this.options;\n const sampleSize = tickOpts.sampleSize;\n\n // Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)\n this.beforeUpdate();\n\n // Absorb the master measurements\n this.maxWidth = maxWidth;\n this.maxHeight = maxHeight;\n this._margins = margins = Object.assign({\n left: 0,\n right: 0,\n top: 0,\n bottom: 0\n }, margins);\n\n this.ticks = null;\n this._labelSizes = null;\n this._gridLineItems = null;\n this._labelItems = null;\n\n // Dimensions\n this.beforeSetDimensions();\n this.setDimensions();\n this.afterSetDimensions();\n\n this._maxLength = this.isHorizontal()\n ? this.width + margins.left + margins.right\n : this.height + margins.top + margins.bottom;\n\n // Data min/max\n if (!this._dataLimitsCached) {\n this.beforeDataLimits();\n this.determineDataLimits();\n this.afterDataLimits();\n this._range = _addGrace(this, grace, beginAtZero);\n this._dataLimitsCached = true;\n }\n\n this.beforeBuildTicks();\n\n this.ticks = this.buildTicks() || [];\n\n // Allow modification of ticks in callback.\n this.afterBuildTicks();\n\n // Compute tick rotation and fit using a sampled subset of labels\n // We generally don't need to compute the size of every single label for determining scale size\n const samplingEnabled = sampleSize < this.ticks.length;\n this._convertTicksToLabels(samplingEnabled ? sample(this.ticks, sampleSize) : this.ticks);\n\n // configure is called twice, once here, once from core.controller.updateLayout.\n // Here we haven't been positioned yet, but dimensions are correct.\n // Variables set in configure are needed for calculateLabelRotation, and\n // it's ok that coordinates are not correct there, only dimensions matter.\n this.configure();\n\n // Tick Rotation\n this.beforeCalculateLabelRotation();\n this.calculateLabelRotation(); // Preconditions: number of ticks and sizes of largest labels must be calculated beforehand\n this.afterCalculateLabelRotation();\n\n // Auto-skip\n if (tickOpts.display && (tickOpts.autoSkip || tickOpts.source === 'auto')) {\n this.ticks = autoSkip(this, this.ticks);\n this._labelSizes = null;\n this.afterAutoSkip();\n }\n\n if (samplingEnabled) {\n // Generate labels using all non-skipped ticks\n this._convertTicksToLabels(this.ticks);\n }\n\n this.beforeFit();\n this.fit(); // Preconditions: label rotation and label sizes must be calculated beforehand\n this.afterFit();\n\n // IMPORTANT: after this point, we consider that `this.ticks` will NEVER change!\n\n this.afterUpdate();\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n let reversePixels = this.options.reverse;\n let startPixel, endPixel;\n\n if (this.isHorizontal()) {\n startPixel = this.left;\n endPixel = this.right;\n } else {\n startPixel = this.top;\n endPixel = this.bottom;\n // by default vertical scales are from bottom to top, so pixels are reversed\n reversePixels = !reversePixels;\n }\n this._startPixel = startPixel;\n this._endPixel = endPixel;\n this._reversePixels = reversePixels;\n this._length = endPixel - startPixel;\n this._alignToPixels = this.options.alignToPixels;\n }\n\n afterUpdate() {\n call(this.options.afterUpdate, [this]);\n }\n\n //\n\n beforeSetDimensions() {\n call(this.options.beforeSetDimensions, [this]);\n }\n setDimensions() {\n // Set the unconstrained dimension before label rotation\n if (this.isHorizontal()) {\n // Reset position before calculating rotation\n this.width = this.maxWidth;\n this.left = 0;\n this.right = this.width;\n } else {\n this.height = this.maxHeight;\n\n // Reset position before calculating rotation\n this.top = 0;\n this.bottom = this.height;\n }\n\n // Reset padding\n this.paddingLeft = 0;\n this.paddingTop = 0;\n this.paddingRight = 0;\n this.paddingBottom = 0;\n }\n afterSetDimensions() {\n call(this.options.afterSetDimensions, [this]);\n }\n\n _callHooks(name) {\n this.chart.notifyPlugins(name, this.getContext());\n call(this.options[name], [this]);\n }\n\n // Data limits\n beforeDataLimits() {\n this._callHooks('beforeDataLimits');\n }\n determineDataLimits() {}\n afterDataLimits() {\n this._callHooks('afterDataLimits');\n }\n\n //\n beforeBuildTicks() {\n this._callHooks('beforeBuildTicks');\n }\n /**\n\t * @return {object[]} the ticks\n\t */\n buildTicks() {\n return [];\n }\n afterBuildTicks() {\n this._callHooks('afterBuildTicks');\n }\n\n beforeTickToLabelConversion() {\n call(this.options.beforeTickToLabelConversion, [this]);\n }\n /**\n\t * Convert ticks to label strings\n\t * @param {Tick[]} ticks\n\t */\n generateTickLabels(ticks) {\n const tickOpts = this.options.ticks;\n let i, ilen, tick;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n tick = ticks[i];\n tick.label = call(tickOpts.callback, [tick.value, i, ticks], this);\n }\n }\n afterTickToLabelConversion() {\n call(this.options.afterTickToLabelConversion, [this]);\n }\n\n //\n\n beforeCalculateLabelRotation() {\n call(this.options.beforeCalculateLabelRotation, [this]);\n }\n calculateLabelRotation() {\n const options = this.options;\n const tickOpts = options.ticks;\n const numTicks = this.ticks.length;\n const minRotation = tickOpts.minRotation || 0;\n const maxRotation = tickOpts.maxRotation;\n let labelRotation = minRotation;\n let tickWidth, maxHeight, maxLabelDiagonal;\n\n if (!this._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !this.isHorizontal()) {\n this.labelRotation = minRotation;\n return;\n }\n\n const labelSizes = this._getLabelSizes();\n const maxLabelWidth = labelSizes.widest.width;\n const maxLabelHeight = labelSizes.highest.height;\n\n // Estimate the width of each grid based on the canvas width, the maximum\n // label width and the number of tick intervals\n const maxWidth = _limitValue(this.chart.width - maxLabelWidth, 0, this.maxWidth);\n tickWidth = options.offset ? this.maxWidth / numTicks : maxWidth / (numTicks - 1);\n\n // Allow 3 pixels x2 padding either side for label readability\n if (maxLabelWidth + 6 > tickWidth) {\n tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));\n maxHeight = this.maxHeight - getTickMarkLength(options.grid)\n\t\t\t\t- tickOpts.padding - getTitleHeight(options.title, this.chart.options.font);\n maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);\n labelRotation = toDegrees(Math.min(\n Math.asin(_limitValue((labelSizes.highest.height + 6) / tickWidth, -1, 1)),\n Math.asin(_limitValue(maxHeight / maxLabelDiagonal, -1, 1)) - Math.asin(_limitValue(maxLabelHeight / maxLabelDiagonal, -1, 1))\n ));\n labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));\n }\n\n this.labelRotation = labelRotation;\n }\n afterCalculateLabelRotation() {\n call(this.options.afterCalculateLabelRotation, [this]);\n }\n afterAutoSkip() {}\n\n //\n\n beforeFit() {\n call(this.options.beforeFit, [this]);\n }\n fit() {\n // Reset\n const minSize = {\n width: 0,\n height: 0\n };\n\n const {chart, options: {ticks: tickOpts, title: titleOpts, grid: gridOpts}} = this;\n const display = this._isVisible();\n const isHorizontal = this.isHorizontal();\n\n if (display) {\n const titleHeight = getTitleHeight(titleOpts, chart.options.font);\n if (isHorizontal) {\n minSize.width = this.maxWidth;\n minSize.height = getTickMarkLength(gridOpts) + titleHeight;\n } else {\n minSize.height = this.maxHeight; // fill all the height\n minSize.width = getTickMarkLength(gridOpts) + titleHeight;\n }\n\n // Don't bother fitting the ticks if we are not showing the labels\n if (tickOpts.display && this.ticks.length) {\n const {first, last, widest, highest} = this._getLabelSizes();\n const tickPadding = tickOpts.padding * 2;\n const angleRadians = toRadians(this.labelRotation);\n const cos = Math.cos(angleRadians);\n const sin = Math.sin(angleRadians);\n\n if (isHorizontal) {\n // A horizontal axis is more constrained by the height.\n const labelHeight = tickOpts.mirror ? 0 : sin * widest.width + cos * highest.height;\n minSize.height = Math.min(this.maxHeight, minSize.height + labelHeight + tickPadding);\n } else {\n // A vertical axis is more constrained by the width. Labels are the\n // dominant factor here, so get that length first and account for padding\n const labelWidth = tickOpts.mirror ? 0 : cos * widest.width + sin * highest.height;\n\n minSize.width = Math.min(this.maxWidth, minSize.width + labelWidth + tickPadding);\n }\n this._calculatePadding(first, last, sin, cos);\n }\n }\n\n this._handleMargins();\n\n if (isHorizontal) {\n this.width = this._length = chart.width - this._margins.left - this._margins.right;\n this.height = minSize.height;\n } else {\n this.width = minSize.width;\n this.height = this._length = chart.height - this._margins.top - this._margins.bottom;\n }\n }\n\n _calculatePadding(first, last, sin, cos) {\n const {ticks: {align, padding}, position} = this.options;\n const isRotated = this.labelRotation !== 0;\n const labelsBelowTicks = position !== 'top' && this.axis === 'x';\n\n if (this.isHorizontal()) {\n const offsetLeft = this.getPixelForTick(0) - this.left;\n const offsetRight = this.right - this.getPixelForTick(this.ticks.length - 1);\n let paddingLeft = 0;\n let paddingRight = 0;\n\n // Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned\n // which means that the right padding is dominated by the font height\n if (isRotated) {\n if (labelsBelowTicks) {\n paddingLeft = cos * first.width;\n paddingRight = sin * last.height;\n } else {\n paddingLeft = sin * first.height;\n paddingRight = cos * last.width;\n }\n } else if (align === 'start') {\n paddingRight = last.width;\n } else if (align === 'end') {\n paddingLeft = first.width;\n } else if (align !== 'inner') {\n paddingLeft = first.width / 2;\n paddingRight = last.width / 2;\n }\n\n // Adjust padding taking into account changes in offsets\n this.paddingLeft = Math.max((paddingLeft - offsetLeft + padding) * this.width / (this.width - offsetLeft), 0);\n this.paddingRight = Math.max((paddingRight - offsetRight + padding) * this.width / (this.width - offsetRight), 0);\n } else {\n let paddingTop = last.height / 2;\n let paddingBottom = first.height / 2;\n\n if (align === 'start') {\n paddingTop = 0;\n paddingBottom = first.height;\n } else if (align === 'end') {\n paddingTop = last.height;\n paddingBottom = 0;\n }\n\n this.paddingTop = paddingTop + padding;\n this.paddingBottom = paddingBottom + padding;\n }\n }\n\n /**\n\t * Handle margins and padding interactions\n\t * @private\n\t */\n _handleMargins() {\n if (this._margins) {\n this._margins.left = Math.max(this.paddingLeft, this._margins.left);\n this._margins.top = Math.max(this.paddingTop, this._margins.top);\n this._margins.right = Math.max(this.paddingRight, this._margins.right);\n this._margins.bottom = Math.max(this.paddingBottom, this._margins.bottom);\n }\n }\n\n afterFit() {\n call(this.options.afterFit, [this]);\n }\n\n // Shared Methods\n /**\n\t * @return {boolean}\n\t */\n isHorizontal() {\n const {axis, position} = this.options;\n return position === 'top' || position === 'bottom' || axis === 'x';\n }\n /**\n\t * @return {boolean}\n\t */\n isFullSize() {\n return this.options.fullSize;\n }\n\n /**\n\t * @param {Tick[]} ticks\n\t * @private\n\t */\n _convertTicksToLabels(ticks) {\n this.beforeTickToLabelConversion();\n\n this.generateTickLabels(ticks);\n\n // Ticks should be skipped when callback returns null or undef, so lets remove those.\n let i, ilen;\n for (i = 0, ilen = ticks.length; i < ilen; i++) {\n if (isNullOrUndef(ticks[i].label)) {\n ticks.splice(i, 1);\n ilen--;\n i--;\n }\n }\n\n this.afterTickToLabelConversion();\n }\n\n /**\n\t * @return {{ first: object, last: object, widest: object, highest: object, widths: Array, heights: array }}\n\t * @private\n\t */\n _getLabelSizes() {\n let labelSizes = this._labelSizes;\n\n if (!labelSizes) {\n const sampleSize = this.options.ticks.sampleSize;\n let ticks = this.ticks;\n if (sampleSize < ticks.length) {\n ticks = sample(ticks, sampleSize);\n }\n\n this._labelSizes = labelSizes = this._computeLabelSizes(ticks, ticks.length);\n }\n\n return labelSizes;\n }\n\n /**\n\t * Returns {width, height, offset} objects for the first, last, widest, highest tick\n\t * labels where offset indicates the anchor point offset from the top in pixels.\n\t * @return {{ first: object, last: object, widest: object, highest: object, widths: Array, heights: array }}\n\t * @private\n\t */\n _computeLabelSizes(ticks, length) {\n const {ctx, _longestTextCache: caches} = this;\n const widths = [];\n const heights = [];\n let widestLabelSize = 0;\n let highestLabelSize = 0;\n let i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel;\n\n for (i = 0; i < length; ++i) {\n label = ticks[i].label;\n tickFont = this._resolveTickFontOptions(i);\n ctx.font = fontString = tickFont.string;\n cache = caches[fontString] = caches[fontString] || {data: {}, gc: []};\n lineHeight = tickFont.lineHeight;\n width = height = 0;\n // Undefined labels and arrays should not be measured\n if (!isNullOrUndef(label) && !isArray(label)) {\n width = _measureText(ctx, cache.data, cache.gc, width, label);\n height = lineHeight;\n } else if (isArray(label)) {\n // if it is an array let's measure each element\n for (j = 0, jlen = label.length; j < jlen; ++j) {\n nestedLabel = label[j];\n // Undefined labels and arrays should not be measured\n if (!isNullOrUndef(nestedLabel) && !isArray(nestedLabel)) {\n width = _measureText(ctx, cache.data, cache.gc, width, nestedLabel);\n height += lineHeight;\n }\n }\n }\n widths.push(width);\n heights.push(height);\n widestLabelSize = Math.max(width, widestLabelSize);\n highestLabelSize = Math.max(height, highestLabelSize);\n }\n garbageCollect(caches, length);\n\n const widest = widths.indexOf(widestLabelSize);\n const highest = heights.indexOf(highestLabelSize);\n\n const valueAt = (idx) => ({width: widths[idx] || 0, height: heights[idx] || 0});\n\n return {\n first: valueAt(0),\n last: valueAt(length - 1),\n widest: valueAt(widest),\n highest: valueAt(highest),\n widths,\n heights,\n };\n }\n\n /**\n\t * Used to get the label to display in the tooltip for the given value\n\t * @param {*} value\n\t * @return {string}\n\t */\n getLabelForValue(value) {\n return value;\n }\n\n /**\n\t * Returns the location of the given data point. Value can either be an index or a numerical value\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {*} value\n\t * @param {number} [index]\n\t * @return {number}\n\t */\n getPixelForValue(value, index) { // eslint-disable-line no-unused-vars\n return NaN;\n }\n\n /**\n\t * Used to get the data value from a given pixel. This is the inverse of getPixelForValue\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {number} pixel\n\t * @return {*}\n\t */\n getValueForPixel(pixel) {} // eslint-disable-line no-unused-vars\n\n /**\n\t * Returns the location of the tick at the given index\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {number} index\n\t * @return {number}\n\t */\n getPixelForTick(index) {\n const ticks = this.ticks;\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n return this.getPixelForValue(ticks[index].value);\n }\n\n /**\n\t * Utility for getting the pixel location of a percentage of scale\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @param {number} decimal\n\t * @return {number}\n\t */\n getPixelForDecimal(decimal) {\n if (this._reversePixels) {\n decimal = 1 - decimal;\n }\n\n const pixel = this._startPixel + decimal * this._length;\n return _int16Range(this._alignToPixels ? _alignPixel(this.chart, pixel, 0) : pixel);\n }\n\n /**\n\t * @param {number} pixel\n\t * @return {number}\n\t */\n getDecimalForPixel(pixel) {\n const decimal = (pixel - this._startPixel) / this._length;\n return this._reversePixels ? 1 - decimal : decimal;\n }\n\n /**\n\t * Returns the pixel for the minimum chart value\n\t * The coordinate (0, 0) is at the upper-left corner of the canvas\n\t * @return {number}\n\t */\n getBasePixel() {\n return this.getPixelForValue(this.getBaseValue());\n }\n\n /**\n\t * @return {number}\n\t */\n getBaseValue() {\n const {min, max} = this;\n\n return min < 0 && max < 0 ? max :\n min > 0 && max > 0 ? min :\n 0;\n }\n\n /**\n\t * @protected\n\t */\n getContext(index) {\n const ticks = this.ticks || [];\n\n if (index >= 0 && index < ticks.length) {\n const tick = ticks[index];\n return tick.$context ||\n\t\t\t\t(tick.$context = createTickContext(this.getContext(), index, tick));\n }\n return this.$context ||\n\t\t\t(this.$context = createScaleContext(this.chart.getContext(), this));\n }\n\n /**\n\t * @return {number}\n\t * @private\n\t */\n _tickSize() {\n const optionTicks = this.options.ticks;\n\n // Calculate space needed by label in axis direction.\n const rot = toRadians(this.labelRotation);\n const cos = Math.abs(Math.cos(rot));\n const sin = Math.abs(Math.sin(rot));\n\n const labelSizes = this._getLabelSizes();\n const padding = optionTicks.autoSkipPadding || 0;\n const w = labelSizes ? labelSizes.widest.width + padding : 0;\n const h = labelSizes ? labelSizes.highest.height + padding : 0;\n\n // Calculate space needed for 1 tick in axis direction.\n return this.isHorizontal()\n ? h * cos > w * sin ? w / cos : h / sin\n : h * sin < w * cos ? h / cos : w / sin;\n }\n\n /**\n\t * @return {boolean}\n\t * @private\n\t */\n _isVisible() {\n const display = this.options.display;\n\n if (display !== 'auto') {\n return !!display;\n }\n\n return this.getMatchingVisibleMetas().length > 0;\n }\n\n /**\n\t * @private\n\t */\n _computeGridLineItems(chartArea) {\n const axis = this.axis;\n const chart = this.chart;\n const options = this.options;\n const {grid, position, border} = options;\n const offset = grid.offset;\n const isHorizontal = this.isHorizontal();\n const ticks = this.ticks;\n const ticksLength = ticks.length + (offset ? 1 : 0);\n const tl = getTickMarkLength(grid);\n const items = [];\n\n const borderOpts = border.setContext(this.getContext());\n const axisWidth = borderOpts.display ? borderOpts.width : 0;\n const axisHalfWidth = axisWidth / 2;\n const alignBorderValue = function(pixel) {\n return _alignPixel(chart, pixel, axisWidth);\n };\n let borderValue, i, lineValue, alignedLineValue;\n let tx1, ty1, tx2, ty2, x1, y1, x2, y2;\n\n if (position === 'top') {\n borderValue = alignBorderValue(this.bottom);\n ty1 = this.bottom - tl;\n ty2 = borderValue - axisHalfWidth;\n y1 = alignBorderValue(chartArea.top) + axisHalfWidth;\n y2 = chartArea.bottom;\n } else if (position === 'bottom') {\n borderValue = alignBorderValue(this.top);\n y1 = chartArea.top;\n y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;\n ty1 = borderValue + axisHalfWidth;\n ty2 = this.top + tl;\n } else if (position === 'left') {\n borderValue = alignBorderValue(this.right);\n tx1 = this.right - tl;\n tx2 = borderValue - axisHalfWidth;\n x1 = alignBorderValue(chartArea.left) + axisHalfWidth;\n x2 = chartArea.right;\n } else if (position === 'right') {\n borderValue = alignBorderValue(this.left);\n x1 = chartArea.left;\n x2 = alignBorderValue(chartArea.right) - axisHalfWidth;\n tx1 = borderValue + axisHalfWidth;\n tx2 = this.left + tl;\n } else if (axis === 'x') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.top + chartArea.bottom) / 2 + 0.5);\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value));\n }\n\n y1 = chartArea.top;\n y2 = chartArea.bottom;\n ty1 = borderValue + axisHalfWidth;\n ty2 = ty1 + tl;\n } else if (axis === 'y') {\n if (position === 'center') {\n borderValue = alignBorderValue((chartArea.left + chartArea.right) / 2);\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value));\n }\n\n tx1 = borderValue - axisHalfWidth;\n tx2 = tx1 - tl;\n x1 = chartArea.left;\n x2 = chartArea.right;\n }\n\n const limit = valueOrDefault(options.ticks.maxTicksLimit, ticksLength);\n const step = Math.max(1, Math.ceil(ticksLength / limit));\n for (i = 0; i < ticksLength; i += step) {\n const context = this.getContext(i);\n const optsAtIndex = grid.setContext(context);\n const optsAtIndexBorder = border.setContext(context);\n\n const lineWidth = optsAtIndex.lineWidth;\n const lineColor = optsAtIndex.color;\n const borderDash = optsAtIndexBorder.dash || [];\n const borderDashOffset = optsAtIndexBorder.dashOffset;\n\n const tickWidth = optsAtIndex.tickWidth;\n const tickColor = optsAtIndex.tickColor;\n const tickBorderDash = optsAtIndex.tickBorderDash || [];\n const tickBorderDashOffset = optsAtIndex.tickBorderDashOffset;\n\n lineValue = getPixelForGridLine(this, i, offset);\n\n // Skip if the pixel is out of the range\n if (lineValue === undefined) {\n continue;\n }\n\n alignedLineValue = _alignPixel(chart, lineValue, lineWidth);\n\n if (isHorizontal) {\n tx1 = tx2 = x1 = x2 = alignedLineValue;\n } else {\n ty1 = ty2 = y1 = y2 = alignedLineValue;\n }\n\n items.push({\n tx1,\n ty1,\n tx2,\n ty2,\n x1,\n y1,\n x2,\n y2,\n width: lineWidth,\n color: lineColor,\n borderDash,\n borderDashOffset,\n tickWidth,\n tickColor,\n tickBorderDash,\n tickBorderDashOffset,\n });\n }\n\n this._ticksLength = ticksLength;\n this._borderValue = borderValue;\n\n return items;\n }\n\n /**\n\t * @private\n\t */\n _computeLabelItems(chartArea) {\n const axis = this.axis;\n const options = this.options;\n const {position, ticks: optionTicks} = options;\n const isHorizontal = this.isHorizontal();\n const ticks = this.ticks;\n const {align, crossAlign, padding, mirror} = optionTicks;\n const tl = getTickMarkLength(options.grid);\n const tickAndPadding = tl + padding;\n const hTickAndPadding = mirror ? -padding : tickAndPadding;\n const rotation = -toRadians(this.labelRotation);\n const items = [];\n let i, ilen, tick, label, x, y, textAlign, pixel, font, lineHeight, lineCount, textOffset;\n let textBaseline = 'middle';\n\n if (position === 'top') {\n y = this.bottom - hTickAndPadding;\n textAlign = this._getXAxisLabelAlignment();\n } else if (position === 'bottom') {\n y = this.top + hTickAndPadding;\n textAlign = this._getXAxisLabelAlignment();\n } else if (position === 'left') {\n const ret = this._getYAxisLabelAlignment(tl);\n textAlign = ret.textAlign;\n x = ret.x;\n } else if (position === 'right') {\n const ret = this._getYAxisLabelAlignment(tl);\n textAlign = ret.textAlign;\n x = ret.x;\n } else if (axis === 'x') {\n if (position === 'center') {\n y = ((chartArea.top + chartArea.bottom) / 2) + tickAndPadding;\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n y = this.chart.scales[positionAxisID].getPixelForValue(value) + tickAndPadding;\n }\n textAlign = this._getXAxisLabelAlignment();\n } else if (axis === 'y') {\n if (position === 'center') {\n x = ((chartArea.left + chartArea.right) / 2) - tickAndPadding;\n } else if (isObject(position)) {\n const positionAxisID = Object.keys(position)[0];\n const value = position[positionAxisID];\n x = this.chart.scales[positionAxisID].getPixelForValue(value);\n }\n textAlign = this._getYAxisLabelAlignment(tl).textAlign;\n }\n\n if (axis === 'y') {\n if (align === 'start') {\n textBaseline = 'top';\n } else if (align === 'end') {\n textBaseline = 'bottom';\n }\n }\n\n const labelSizes = this._getLabelSizes();\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n label = tick.label;\n\n const optsAtIndex = optionTicks.setContext(this.getContext(i));\n pixel = this.getPixelForTick(i) + optionTicks.labelOffset;\n font = this._resolveTickFontOptions(i);\n lineHeight = font.lineHeight;\n lineCount = isArray(label) ? label.length : 1;\n const halfCount = lineCount / 2;\n const color = optsAtIndex.color;\n const strokeColor = optsAtIndex.textStrokeColor;\n const strokeWidth = optsAtIndex.textStrokeWidth;\n let tickTextAlign = textAlign;\n\n if (isHorizontal) {\n x = pixel;\n\n if (textAlign === 'inner') {\n if (i === ilen - 1) {\n tickTextAlign = !this.options.reverse ? 'right' : 'left';\n } else if (i === 0) {\n tickTextAlign = !this.options.reverse ? 'left' : 'right';\n } else {\n tickTextAlign = 'center';\n }\n }\n\n if (position === 'top') {\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = -lineCount * lineHeight + lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight + lineHeight;\n } else {\n textOffset = -labelSizes.highest.height + lineHeight / 2;\n }\n } else {\n // eslint-disable-next-line no-lonely-if\n if (crossAlign === 'near' || rotation !== 0) {\n textOffset = lineHeight / 2;\n } else if (crossAlign === 'center') {\n textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight;\n } else {\n textOffset = labelSizes.highest.height - lineCount * lineHeight;\n }\n }\n if (mirror) {\n textOffset *= -1;\n }\n if (rotation !== 0 && !optsAtIndex.showLabelBackdrop) {\n x += (lineHeight / 2) * Math.sin(rotation);\n }\n } else {\n y = pixel;\n textOffset = (1 - lineCount) * lineHeight / 2;\n }\n\n let backdrop;\n\n if (optsAtIndex.showLabelBackdrop) {\n const labelPadding = toPadding(optsAtIndex.backdropPadding);\n const height = labelSizes.heights[i];\n const width = labelSizes.widths[i];\n\n let top = textOffset - labelPadding.top;\n let left = 0 - labelPadding.left;\n\n switch (textBaseline) {\n case 'middle':\n top -= height / 2;\n break;\n case 'bottom':\n top -= height;\n break;\n default:\n break;\n }\n\n switch (textAlign) {\n case 'center':\n left -= width / 2;\n break;\n case 'right':\n left -= width;\n break;\n default:\n break;\n }\n\n backdrop = {\n left,\n top,\n width: width + labelPadding.width,\n height: height + labelPadding.height,\n\n color: optsAtIndex.backdropColor,\n };\n }\n\n items.push({\n rotation,\n label,\n font,\n color,\n strokeColor,\n strokeWidth,\n textOffset,\n textAlign: tickTextAlign,\n textBaseline,\n translation: [x, y],\n backdrop,\n });\n }\n\n return items;\n }\n\n _getXAxisLabelAlignment() {\n const {position, ticks} = this.options;\n const rotation = -toRadians(this.labelRotation);\n\n if (rotation) {\n return position === 'top' ? 'left' : 'right';\n }\n\n let align = 'center';\n\n if (ticks.align === 'start') {\n align = 'left';\n } else if (ticks.align === 'end') {\n align = 'right';\n } else if (ticks.align === 'inner') {\n align = 'inner';\n }\n\n return align;\n }\n\n _getYAxisLabelAlignment(tl) {\n const {position, ticks: {crossAlign, mirror, padding}} = this.options;\n const labelSizes = this._getLabelSizes();\n const tickAndPadding = tl + padding;\n const widest = labelSizes.widest.width;\n\n let textAlign;\n let x;\n\n if (position === 'left') {\n if (mirror) {\n x = this.right + padding;\n\n if (crossAlign === 'near') {\n textAlign = 'left';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x += (widest / 2);\n } else {\n textAlign = 'right';\n x += widest;\n }\n } else {\n x = this.right - tickAndPadding;\n\n if (crossAlign === 'near') {\n textAlign = 'right';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x -= (widest / 2);\n } else {\n textAlign = 'left';\n x = this.left;\n }\n }\n } else if (position === 'right') {\n if (mirror) {\n x = this.left + padding;\n\n if (crossAlign === 'near') {\n textAlign = 'right';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x -= (widest / 2);\n } else {\n textAlign = 'left';\n x -= widest;\n }\n } else {\n x = this.left + tickAndPadding;\n\n if (crossAlign === 'near') {\n textAlign = 'left';\n } else if (crossAlign === 'center') {\n textAlign = 'center';\n x += widest / 2;\n } else {\n textAlign = 'right';\n x = this.right;\n }\n }\n } else {\n textAlign = 'right';\n }\n\n return {textAlign, x};\n }\n\n /**\n\t * @private\n\t */\n _computeLabelArea() {\n if (this.options.ticks.mirror) {\n return;\n }\n\n const chart = this.chart;\n const position = this.options.position;\n\n if (position === 'left' || position === 'right') {\n return {top: 0, left: this.left, bottom: chart.height, right: this.right};\n } if (position === 'top' || position === 'bottom') {\n return {top: this.top, left: 0, bottom: this.bottom, right: chart.width};\n }\n }\n\n /**\n * @protected\n */\n drawBackground() {\n const {ctx, options: {backgroundColor}, left, top, width, height} = this;\n if (backgroundColor) {\n ctx.save();\n ctx.fillStyle = backgroundColor;\n ctx.fillRect(left, top, width, height);\n ctx.restore();\n }\n }\n\n getLineWidthForValue(value) {\n const grid = this.options.grid;\n if (!this._isVisible() || !grid.display) {\n return 0;\n }\n const ticks = this.ticks;\n const index = ticks.findIndex(t => t.value === value);\n if (index >= 0) {\n const opts = grid.setContext(this.getContext(index));\n return opts.lineWidth;\n }\n return 0;\n }\n\n /**\n\t * @protected\n\t */\n drawGrid(chartArea) {\n const grid = this.options.grid;\n const ctx = this.ctx;\n const items = this._gridLineItems || (this._gridLineItems = this._computeGridLineItems(chartArea));\n let i, ilen;\n\n const drawLine = (p1, p2, style) => {\n if (!style.width || !style.color) {\n return;\n }\n ctx.save();\n ctx.lineWidth = style.width;\n ctx.strokeStyle = style.color;\n ctx.setLineDash(style.borderDash || []);\n ctx.lineDashOffset = style.borderDashOffset;\n\n ctx.beginPath();\n ctx.moveTo(p1.x, p1.y);\n ctx.lineTo(p2.x, p2.y);\n ctx.stroke();\n ctx.restore();\n };\n\n if (grid.display) {\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n const item = items[i];\n\n if (grid.drawOnChartArea) {\n drawLine(\n {x: item.x1, y: item.y1},\n {x: item.x2, y: item.y2},\n item\n );\n }\n\n if (grid.drawTicks) {\n drawLine(\n {x: item.tx1, y: item.ty1},\n {x: item.tx2, y: item.ty2},\n {\n color: item.tickColor,\n width: item.tickWidth,\n borderDash: item.tickBorderDash,\n borderDashOffset: item.tickBorderDashOffset\n }\n );\n }\n }\n }\n }\n\n /**\n\t * @protected\n\t */\n drawBorder() {\n const {chart, ctx, options: {border, grid}} = this;\n const borderOpts = border.setContext(this.getContext());\n const axisWidth = border.display ? borderOpts.width : 0;\n if (!axisWidth) {\n return;\n }\n const lastLineWidth = grid.setContext(this.getContext(0)).lineWidth;\n const borderValue = this._borderValue;\n let x1, x2, y1, y2;\n\n if (this.isHorizontal()) {\n x1 = _alignPixel(chart, this.left, axisWidth) - axisWidth / 2;\n x2 = _alignPixel(chart, this.right, lastLineWidth) + lastLineWidth / 2;\n y1 = y2 = borderValue;\n } else {\n y1 = _alignPixel(chart, this.top, axisWidth) - axisWidth / 2;\n y2 = _alignPixel(chart, this.bottom, lastLineWidth) + lastLineWidth / 2;\n x1 = x2 = borderValue;\n }\n ctx.save();\n ctx.lineWidth = borderOpts.width;\n ctx.strokeStyle = borderOpts.color;\n\n ctx.beginPath();\n ctx.moveTo(x1, y1);\n ctx.lineTo(x2, y2);\n ctx.stroke();\n\n ctx.restore();\n }\n\n /**\n\t * @protected\n\t */\n drawLabels(chartArea) {\n const optionTicks = this.options.ticks;\n\n if (!optionTicks.display) {\n return;\n }\n\n const ctx = this.ctx;\n\n const area = this._computeLabelArea();\n if (area) {\n clipArea(ctx, area);\n }\n\n const items = this._labelItems || (this._labelItems = this._computeLabelItems(chartArea));\n let i, ilen;\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n const item = items[i];\n const tickFont = item.font;\n const label = item.label;\n\n let y = item.textOffset;\n renderText(ctx, label, 0, y, tickFont, item);\n }\n\n if (area) {\n unclipArea(ctx);\n }\n }\n\n /**\n\t * @protected\n\t */\n drawTitle() {\n const {ctx, options: {position, title, reverse}} = this;\n\n if (!title.display) {\n return;\n }\n\n const font = toFont(title.font);\n const padding = toPadding(title.padding);\n const align = title.align;\n let offset = font.lineHeight / 2;\n\n if (position === 'bottom' || position === 'center' || isObject(position)) {\n offset += padding.bottom;\n if (isArray(title.text)) {\n offset += font.lineHeight * (title.text.length - 1);\n }\n } else {\n offset += padding.top;\n }\n\n const {titleX, titleY, maxWidth, rotation} = titleArgs(this, offset, position, align);\n\n renderText(ctx, title.text, 0, 0, font, {\n color: title.color,\n maxWidth,\n rotation,\n textAlign: titleAlign(align, position, reverse),\n textBaseline: 'middle',\n translation: [titleX, titleY],\n });\n }\n\n draw(chartArea) {\n if (!this._isVisible()) {\n return;\n }\n\n this.drawBackground();\n this.drawGrid(chartArea);\n this.drawBorder();\n this.drawTitle();\n this.drawLabels(chartArea);\n }\n\n /**\n\t * @return {object[]}\n\t * @private\n\t */\n _layers() {\n const opts = this.options;\n const tz = opts.ticks && opts.ticks.z || 0;\n const gz = valueOrDefault(opts.grid && opts.grid.z, -1);\n const bz = valueOrDefault(opts.border && opts.border.z, 0);\n\n if (!this._isVisible() || this.draw !== Scale.prototype.draw) {\n // backward compatibility: draw has been overridden by custom scale\n return [{\n z: tz,\n draw: (chartArea) => {\n this.draw(chartArea);\n }\n }];\n }\n\n return [{\n z: gz,\n draw: (chartArea) => {\n this.drawBackground();\n this.drawGrid(chartArea);\n this.drawTitle();\n }\n }, {\n z: bz,\n draw: () => {\n this.drawBorder();\n }\n }, {\n z: tz,\n draw: (chartArea) => {\n this.drawLabels(chartArea);\n }\n }];\n }\n\n /**\n\t * Returns visible dataset metas that are attached to this scale\n\t * @param {string} [type] - if specified, also filter by dataset type\n\t * @return {object[]}\n\t */\n getMatchingVisibleMetas(type) {\n const metas = this.chart.getSortedVisibleDatasetMetas();\n const axisID = this.axis + 'AxisID';\n const result = [];\n let i, ilen;\n\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n const meta = metas[i];\n if (meta[axisID] === this.id && (!type || meta.type === type)) {\n result.push(meta);\n }\n }\n return result;\n }\n\n /**\n\t * @param {number} index\n\t * @return {object}\n\t * @protected\n \t */\n _resolveTickFontOptions(index) {\n const opts = this.options.ticks.setContext(this.getContext(index));\n return toFont(opts.font);\n }\n\n /**\n * @protected\n */\n _maxDigits() {\n const fontSize = this._resolveTickFontOptions(0).lineHeight;\n return (this.isHorizontal() ? this.width : this.height) / fontSize;\n }\n}\n","import {merge} from '../helpers';\nimport defaults, {overrides} from './core.defaults';\n\n/**\n * @typedef {{id: string, defaults: any, overrides?: any, defaultRoutes: any}} IChartComponent\n */\n\nexport default class TypedRegistry {\n constructor(type, scope, override) {\n this.type = type;\n this.scope = scope;\n this.override = override;\n this.items = Object.create(null);\n }\n\n isForType(type) {\n return Object.prototype.isPrototypeOf.call(this.type.prototype, type.prototype);\n }\n\n /**\n\t * @param {IChartComponent} item\n\t * @returns {string} The scope where items defaults were registered to.\n\t */\n register(item) {\n const proto = Object.getPrototypeOf(item);\n let parentScope;\n\n if (isIChartComponent(proto)) {\n // Make sure the parent is registered and note the scope where its defaults are.\n parentScope = this.register(proto);\n }\n\n const items = this.items;\n const id = item.id;\n const scope = this.scope + '.' + id;\n\n if (!id) {\n throw new Error('class does not have id: ' + item);\n }\n\n if (id in items) {\n // already registered\n return scope;\n }\n\n items[id] = item;\n registerDefaults(item, scope, parentScope);\n if (this.override) {\n defaults.override(item.id, item.overrides);\n }\n\n return scope;\n }\n\n /**\n\t * @param {string} id\n\t * @returns {object?}\n\t */\n get(id) {\n return this.items[id];\n }\n\n /**\n\t * @param {IChartComponent} item\n\t */\n unregister(item) {\n const items = this.items;\n const id = item.id;\n const scope = this.scope;\n\n if (id in items) {\n delete items[id];\n }\n\n if (scope && id in defaults[scope]) {\n delete defaults[scope][id];\n if (this.override) {\n delete overrides[id];\n }\n }\n }\n}\n\nfunction registerDefaults(item, scope, parentScope) {\n // Inherit the parent's defaults and keep existing defaults\n const itemDefaults = merge(Object.create(null), [\n parentScope ? defaults.get(parentScope) : {},\n defaults.get(scope),\n item.defaults\n ]);\n\n defaults.set(scope, itemDefaults);\n\n if (item.defaultRoutes) {\n routeDefaults(scope, item.defaultRoutes);\n }\n\n if (item.descriptors) {\n defaults.describe(scope, item.descriptors);\n }\n}\n\nfunction routeDefaults(scope, routes) {\n Object.keys(routes).forEach(property => {\n const propertyParts = property.split('.');\n const sourceName = propertyParts.pop();\n const sourceScope = [scope].concat(propertyParts).join('.');\n const parts = routes[property].split('.');\n const targetName = parts.pop();\n const targetScope = parts.join('.');\n defaults.route(sourceScope, sourceName, targetScope, targetName);\n });\n}\n\nfunction isIChartComponent(proto) {\n return 'id' in proto && 'defaults' in proto;\n}\n","import DatasetController from './core.datasetController';\nimport Element from './core.element';\nimport Scale from './core.scale';\nimport TypedRegistry from './core.typedRegistry';\nimport {each, callback as call, _capitalize} from '../helpers/helpers.core';\n\n/**\n * Please use the module's default export which provides a singleton instance\n * Note: class is exported for typedoc\n */\nexport class Registry {\n constructor() {\n this.controllers = new TypedRegistry(DatasetController, 'datasets', true);\n this.elements = new TypedRegistry(Element, 'elements');\n this.plugins = new TypedRegistry(Object, 'plugins');\n this.scales = new TypedRegistry(Scale, 'scales');\n // Order is important, Scale has Element in prototype chain,\n // so Scales must be before Elements. Plugins are a fallback, so not listed here.\n this._typedRegistries = [this.controllers, this.scales, this.elements];\n }\n\n /**\n\t * @param {...any} args\n\t */\n add(...args) {\n this._each('register', args);\n }\n\n remove(...args) {\n this._each('unregister', args);\n }\n\n /**\n\t * @param {...typeof DatasetController} args\n\t */\n addControllers(...args) {\n this._each('register', args, this.controllers);\n }\n\n /**\n\t * @param {...typeof Element} args\n\t */\n addElements(...args) {\n this._each('register', args, this.elements);\n }\n\n /**\n\t * @param {...any} args\n\t */\n addPlugins(...args) {\n this._each('register', args, this.plugins);\n }\n\n /**\n\t * @param {...typeof Scale} args\n\t */\n addScales(...args) {\n this._each('register', args, this.scales);\n }\n\n /**\n\t * @param {string} id\n\t * @returns {typeof DatasetController}\n\t */\n getController(id) {\n return this._get(id, this.controllers, 'controller');\n }\n\n /**\n\t * @param {string} id\n\t * @returns {typeof Element}\n\t */\n getElement(id) {\n return this._get(id, this.elements, 'element');\n }\n\n /**\n\t * @param {string} id\n\t * @returns {object}\n\t */\n getPlugin(id) {\n return this._get(id, this.plugins, 'plugin');\n }\n\n /**\n\t * @param {string} id\n\t * @returns {typeof Scale}\n\t */\n getScale(id) {\n return this._get(id, this.scales, 'scale');\n }\n\n /**\n\t * @param {...typeof DatasetController} args\n\t */\n removeControllers(...args) {\n this._each('unregister', args, this.controllers);\n }\n\n /**\n\t * @param {...typeof Element} args\n\t */\n removeElements(...args) {\n this._each('unregister', args, this.elements);\n }\n\n /**\n\t * @param {...any} args\n\t */\n removePlugins(...args) {\n this._each('unregister', args, this.plugins);\n }\n\n /**\n\t * @param {...typeof Scale} args\n\t */\n removeScales(...args) {\n this._each('unregister', args, this.scales);\n }\n\n /**\n\t * @private\n\t */\n _each(method, args, typedRegistry) {\n [...args].forEach(arg => {\n const reg = typedRegistry || this._getRegistryForType(arg);\n if (typedRegistry || reg.isForType(arg) || (reg === this.plugins && arg.id)) {\n this._exec(method, reg, arg);\n } else {\n // Handle loopable args\n // Use case:\n // import * as plugins from './plugins';\n // Chart.register(plugins);\n each(arg, item => {\n // If there are mixed types in the loopable, make sure those are\n // registered in correct registry\n // Use case: (treemap exporting controller, elements etc)\n // import * as treemap from 'chartjs-chart-treemap';\n // Chart.register(treemap);\n\n const itemReg = typedRegistry || this._getRegistryForType(item);\n this._exec(method, itemReg, item);\n });\n }\n });\n }\n\n /**\n\t * @private\n\t */\n _exec(method, registry, component) {\n const camelMethod = _capitalize(method);\n call(component['before' + camelMethod], [], component); // beforeRegister / beforeUnregister\n registry[method](component);\n call(component['after' + camelMethod], [], component); // afterRegister / afterUnregister\n }\n\n /**\n\t * @private\n\t */\n _getRegistryForType(type) {\n for (let i = 0; i < this._typedRegistries.length; i++) {\n const reg = this._typedRegistries[i];\n if (reg.isForType(type)) {\n return reg;\n }\n }\n // plugins is the fallback registry\n return this.plugins;\n }\n\n /**\n\t * @private\n\t */\n _get(id, typedRegistry, type) {\n const item = typedRegistry.get(id);\n if (item === undefined) {\n throw new Error('\"' + id + '\" is not a registered ' + type + '.');\n }\n return item;\n }\n\n}\n\n// singleton instance\nexport default /* #__PURE__ */ new Registry();\n","import registry from './core.registry';\nimport {callback as callCallback, isNullOrUndef, valueOrDefault} from '../helpers/helpers.core';\n\n/**\n * @typedef { import(\"./core.controller\").default } Chart\n * @typedef { import(\"../../types\").ChartEvent } ChartEvent\n * @typedef { import(\"../plugins/plugin.tooltip\").default } Tooltip\n */\n\n/**\n * @callback filterCallback\n * @param {{plugin: object, options: object}} value\n * @param {number} [index]\n * @param {array} [array]\n * @param {object} [thisArg]\n * @return {boolean}\n */\n\n\nexport default class PluginService {\n constructor() {\n this._init = [];\n }\n\n /**\n\t * Calls enabled plugins for `chart` on the specified hook and with the given args.\n\t * This method immediately returns as soon as a plugin explicitly returns false. The\n\t * returned value can be used, for instance, to interrupt the current action.\n\t * @param {Chart} chart - The chart instance for which plugins should be called.\n\t * @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate').\n\t * @param {object} [args] - Extra arguments to apply to the hook call.\n * @param {filterCallback} [filter] - Filtering function for limiting which plugins are notified\n\t * @returns {boolean} false if any of the plugins return false, else returns true.\n\t */\n notify(chart, hook, args, filter) {\n if (hook === 'beforeInit') {\n this._init = this._createDescriptors(chart, true);\n this._notify(this._init, chart, 'install');\n }\n\n const descriptors = filter ? this._descriptors(chart).filter(filter) : this._descriptors(chart);\n const result = this._notify(descriptors, chart, hook, args);\n\n if (hook === 'afterDestroy') {\n this._notify(descriptors, chart, 'stop');\n this._notify(this._init, chart, 'uninstall');\n }\n return result;\n }\n\n /**\n\t * @private\n\t */\n _notify(descriptors, chart, hook, args) {\n args = args || {};\n for (const descriptor of descriptors) {\n const plugin = descriptor.plugin;\n const method = plugin[hook];\n const params = [chart, args, descriptor.options];\n if (callCallback(method, params, plugin) === false && args.cancelable) {\n return false;\n }\n }\n\n return true;\n }\n\n invalidate() {\n // When plugins are registered, there is the possibility of a double\n // invalidate situation. In this case, we only want to invalidate once.\n // If we invalidate multiple times, the `_oldCache` is lost and all of the\n // plugins are restarted without being correctly stopped.\n // See https://github.com/chartjs/Chart.js/issues/8147\n if (!isNullOrUndef(this._cache)) {\n this._oldCache = this._cache;\n this._cache = undefined;\n }\n }\n\n /**\n\t * @param {Chart} chart\n\t * @private\n\t */\n _descriptors(chart) {\n if (this._cache) {\n return this._cache;\n }\n\n const descriptors = this._cache = this._createDescriptors(chart);\n\n this._notifyStateChanges(chart);\n\n return descriptors;\n }\n\n _createDescriptors(chart, all) {\n const config = chart && chart.config;\n const options = valueOrDefault(config.options && config.options.plugins, {});\n const plugins = allPlugins(config);\n // options === false => all plugins are disabled\n return options === false && !all ? [] : createDescriptors(chart, plugins, options, all);\n }\n\n /**\n\t * @param {Chart} chart\n\t * @private\n\t */\n _notifyStateChanges(chart) {\n const previousDescriptors = this._oldCache || [];\n const descriptors = this._cache;\n const diff = (a, b) => a.filter(x => !b.some(y => x.plugin.id === y.plugin.id));\n this._notify(diff(previousDescriptors, descriptors), chart, 'stop');\n this._notify(diff(descriptors, previousDescriptors), chart, 'start');\n }\n}\n\n/**\n * @param {import(\"./core.config\").default} config\n */\nfunction allPlugins(config) {\n const localIds = {};\n const plugins = [];\n const keys = Object.keys(registry.plugins.items);\n for (let i = 0; i < keys.length; i++) {\n plugins.push(registry.getPlugin(keys[i]));\n }\n\n const local = config.plugins || [];\n for (let i = 0; i < local.length; i++) {\n const plugin = local[i];\n\n if (plugins.indexOf(plugin) === -1) {\n plugins.push(plugin);\n localIds[plugin.id] = true;\n }\n }\n\n return {plugins, localIds};\n}\n\nfunction getOpts(options, all) {\n if (!all && options === false) {\n return null;\n }\n if (options === true) {\n return {};\n }\n return options;\n}\n\nfunction createDescriptors(chart, {plugins, localIds}, options, all) {\n const result = [];\n const context = chart.getContext();\n\n for (const plugin of plugins) {\n const id = plugin.id;\n const opts = getOpts(options[id], all);\n if (opts === null) {\n continue;\n }\n result.push({\n plugin,\n options: pluginOpts(chart.config, {plugin, local: localIds[id]}, opts, context)\n });\n }\n\n return result;\n}\n\nfunction pluginOpts(config, {plugin, local}, opts, context) {\n const keys = config.pluginScopeKeys(plugin);\n const scopes = config.getOptionScopes(opts, keys);\n if (local && plugin.defaults) {\n // make sure plugin defaults are in scopes for local (not registered) plugins\n scopes.push(plugin.defaults);\n }\n return config.createResolver(scopes, context, [''], {\n // These are just defaults that plugins can override\n scriptable: false,\n indexable: false,\n allKeys: true\n });\n}\n","import defaults, {overrides, descriptors} from './core.defaults';\nimport {mergeIf, resolveObjectKey, isArray, isFunction, valueOrDefault, isObject} from '../helpers/helpers.core';\nimport {_attachContext, _createResolver, _descriptors} from '../helpers/helpers.config';\n\nexport function getIndexAxis(type, options) {\n const datasetDefaults = defaults.datasets[type] || {};\n const datasetOptions = (options.datasets || {})[type] || {};\n return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || 'x';\n}\n\nfunction getAxisFromDefaultScaleID(id, indexAxis) {\n let axis = id;\n if (id === '_index_') {\n axis = indexAxis;\n } else if (id === '_value_') {\n axis = indexAxis === 'x' ? 'y' : 'x';\n }\n return axis;\n}\n\nfunction getDefaultScaleIDFromAxis(axis, indexAxis) {\n return axis === indexAxis ? '_index_' : '_value_';\n}\n\nfunction axisFromPosition(position) {\n if (position === 'top' || position === 'bottom') {\n return 'x';\n }\n if (position === 'left' || position === 'right') {\n return 'y';\n }\n}\n\nexport function determineAxis(id, scaleOptions) {\n if (id === 'x' || id === 'y' || id === 'r') {\n return id;\n }\n\n id = scaleOptions.axis\n || axisFromPosition(scaleOptions.position)\n || id.length > 1 && determineAxis(id[0].toLowerCase(), scaleOptions);\n\n if (id) {\n return id;\n }\n\n throw new Error(`Cannot determine type of '${name}' axis. Please provide 'axis' or 'position' option.`);\n}\n\nfunction mergeScaleConfig(config, options) {\n const chartDefaults = overrides[config.type] || {scales: {}};\n const configScales = options.scales || {};\n const chartIndexAxis = getIndexAxis(config.type, options);\n const scales = Object.create(null);\n\n // First figure out first scale id's per axis.\n Object.keys(configScales).forEach(id => {\n const scaleConf = configScales[id];\n if (!isObject(scaleConf)) {\n return console.error(`Invalid scale configuration for scale: ${id}`);\n }\n if (scaleConf._proxy) {\n return console.warn(`Ignoring resolver passed as options for scale: ${id}`);\n }\n const axis = determineAxis(id, scaleConf);\n const defaultId = getDefaultScaleIDFromAxis(axis, chartIndexAxis);\n const defaultScaleOptions = chartDefaults.scales || {};\n scales[id] = mergeIf(Object.create(null), [{axis}, scaleConf, defaultScaleOptions[axis], defaultScaleOptions[defaultId]]);\n });\n\n // Then merge dataset defaults to scale configs\n config.data.datasets.forEach(dataset => {\n const type = dataset.type || config.type;\n const indexAxis = dataset.indexAxis || getIndexAxis(type, options);\n const datasetDefaults = overrides[type] || {};\n const defaultScaleOptions = datasetDefaults.scales || {};\n Object.keys(defaultScaleOptions).forEach(defaultID => {\n const axis = getAxisFromDefaultScaleID(defaultID, indexAxis);\n const id = dataset[axis + 'AxisID'] || axis;\n scales[id] = scales[id] || Object.create(null);\n mergeIf(scales[id], [{axis}, configScales[id], defaultScaleOptions[defaultID]]);\n });\n });\n\n // apply scale defaults, if not overridden by dataset defaults\n Object.keys(scales).forEach(key => {\n const scale = scales[key];\n mergeIf(scale, [defaults.scales[scale.type], defaults.scale]);\n });\n\n return scales;\n}\n\nfunction initOptions(config) {\n const options = config.options || (config.options = {});\n\n options.plugins = valueOrDefault(options.plugins, {});\n options.scales = mergeScaleConfig(config, options);\n}\n\nfunction initData(data) {\n data = data || {};\n data.datasets = data.datasets || [];\n data.labels = data.labels || [];\n return data;\n}\n\nfunction initConfig(config) {\n config = config || {};\n config.data = initData(config.data);\n\n initOptions(config);\n\n return config;\n}\n\nconst keyCache = new Map();\nconst keysCached = new Set();\n\nfunction cachedKeys(cacheKey, generate) {\n let keys = keyCache.get(cacheKey);\n if (!keys) {\n keys = generate();\n keyCache.set(cacheKey, keys);\n keysCached.add(keys);\n }\n return keys;\n}\n\nconst addIfFound = (set, obj, key) => {\n const opts = resolveObjectKey(obj, key);\n if (opts !== undefined) {\n set.add(opts);\n }\n};\n\nexport default class Config {\n constructor(config) {\n this._config = initConfig(config);\n this._scopeCache = new Map();\n this._resolverCache = new Map();\n }\n\n get platform() {\n return this._config.platform;\n }\n\n get type() {\n return this._config.type;\n }\n\n set type(type) {\n this._config.type = type;\n }\n\n get data() {\n return this._config.data;\n }\n\n set data(data) {\n this._config.data = initData(data);\n }\n\n get options() {\n return this._config.options;\n }\n\n set options(options) {\n this._config.options = options;\n }\n\n get plugins() {\n return this._config.plugins;\n }\n\n update() {\n const config = this._config;\n this.clearCache();\n initOptions(config);\n }\n\n clearCache() {\n this._scopeCache.clear();\n this._resolverCache.clear();\n }\n\n /**\n * Returns the option scope keys for resolving dataset options.\n * These keys do not include the dataset itself, because it is not under options.\n * @param {string} datasetType\n * @return {string[][]}\n */\n datasetScopeKeys(datasetType) {\n return cachedKeys(datasetType,\n () => [[\n `datasets.${datasetType}`,\n ''\n ]]);\n }\n\n /**\n * Returns the option scope keys for resolving dataset animation options.\n * These keys do not include the dataset itself, because it is not under options.\n * @param {string} datasetType\n * @param {string} transition\n * @return {string[][]}\n */\n datasetAnimationScopeKeys(datasetType, transition) {\n return cachedKeys(`${datasetType}.transition.${transition}`,\n () => [\n [\n `datasets.${datasetType}.transitions.${transition}`,\n `transitions.${transition}`,\n ],\n // The following are used for looking up the `animations` and `animation` keys\n [\n `datasets.${datasetType}`,\n ''\n ]\n ]);\n }\n\n /**\n * Returns the options scope keys for resolving element options that belong\n * to an dataset. These keys do not include the dataset itself, because it\n * is not under options.\n * @param {string} datasetType\n * @param {string} elementType\n * @return {string[][]}\n */\n datasetElementScopeKeys(datasetType, elementType) {\n return cachedKeys(`${datasetType}-${elementType}`,\n () => [[\n `datasets.${datasetType}.elements.${elementType}`,\n `datasets.${datasetType}`,\n `elements.${elementType}`,\n ''\n ]]);\n }\n\n /**\n * Returns the options scope keys for resolving plugin options.\n * @param {{id: string, additionalOptionScopes?: string[]}} plugin\n * @return {string[][]}\n */\n pluginScopeKeys(plugin) {\n const id = plugin.id;\n const type = this.type;\n return cachedKeys(`${type}-plugin-${id}`,\n () => [[\n `plugins.${id}`,\n ...plugin.additionalOptionScopes || [],\n ]]);\n }\n\n /**\n * @private\n */\n _cachedScopes(mainScope, resetCache) {\n const _scopeCache = this._scopeCache;\n let cache = _scopeCache.get(mainScope);\n if (!cache || resetCache) {\n cache = new Map();\n _scopeCache.set(mainScope, cache);\n }\n return cache;\n }\n\n /**\n * Resolves the objects from options and defaults for option value resolution.\n * @param {object} mainScope - The main scope object for options\n * @param {string[][]} keyLists - The arrays of keys in resolution order\n * @param {boolean} [resetCache] - reset the cache for this mainScope\n */\n getOptionScopes(mainScope, keyLists, resetCache) {\n const {options, type} = this;\n const cache = this._cachedScopes(mainScope, resetCache);\n const cached = cache.get(keyLists);\n if (cached) {\n return cached;\n }\n\n const scopes = new Set();\n\n keyLists.forEach(keys => {\n if (mainScope) {\n scopes.add(mainScope);\n keys.forEach(key => addIfFound(scopes, mainScope, key));\n }\n keys.forEach(key => addIfFound(scopes, options, key));\n keys.forEach(key => addIfFound(scopes, overrides[type] || {}, key));\n keys.forEach(key => addIfFound(scopes, defaults, key));\n keys.forEach(key => addIfFound(scopes, descriptors, key));\n });\n\n const array = Array.from(scopes);\n if (array.length === 0) {\n array.push(Object.create(null));\n }\n if (keysCached.has(keyLists)) {\n cache.set(keyLists, array);\n }\n return array;\n }\n\n /**\n * Returns the option scopes for resolving chart options\n * @return {object[]}\n */\n chartOptionScopes() {\n const {options, type} = this;\n\n return [\n options,\n overrides[type] || {},\n defaults.datasets[type] || {}, // https://github.com/chartjs/Chart.js/issues/8531\n {type},\n defaults,\n descriptors\n ];\n }\n\n /**\n * @param {object[]} scopes\n * @param {string[]} names\n * @param {function|object} context\n * @param {string[]} [prefixes]\n * @return {object}\n */\n resolveNamedOptions(scopes, names, context, prefixes = ['']) {\n const result = {$shared: true};\n const {resolver, subPrefixes} = getResolver(this._resolverCache, scopes, prefixes);\n let options = resolver;\n if (needContext(resolver, names)) {\n result.$shared = false;\n context = isFunction(context) ? context() : context;\n // subResolver is passed to scriptable options. It should not resolve to hover options.\n const subResolver = this.createResolver(scopes, context, subPrefixes);\n options = _attachContext(resolver, context, subResolver);\n }\n\n for (const prop of names) {\n result[prop] = options[prop];\n }\n return result;\n }\n\n /**\n * @param {object[]} scopes\n * @param {object} [context]\n * @param {string[]} [prefixes]\n * @param {{scriptable: boolean, indexable: boolean, allKeys?: boolean}} [descriptorDefaults]\n */\n createResolver(scopes, context, prefixes = [''], descriptorDefaults) {\n const {resolver} = getResolver(this._resolverCache, scopes, prefixes);\n return isObject(context)\n ? _attachContext(resolver, context, undefined, descriptorDefaults)\n : resolver;\n }\n}\n\nfunction getResolver(resolverCache, scopes, prefixes) {\n let cache = resolverCache.get(scopes);\n if (!cache) {\n cache = new Map();\n resolverCache.set(scopes, cache);\n }\n const cacheKey = prefixes.join();\n let cached = cache.get(cacheKey);\n if (!cached) {\n const resolver = _createResolver(scopes, prefixes);\n cached = {\n resolver,\n subPrefixes: prefixes.filter(p => !p.toLowerCase().includes('hover'))\n };\n cache.set(cacheKey, cached);\n }\n return cached;\n}\n\nconst hasFunction = value => isObject(value)\n && Object.getOwnPropertyNames(value).reduce((acc, key) => acc || isFunction(value[key]), false);\n\nfunction needContext(proxy, names) {\n const {isScriptable, isIndexable} = _descriptors(proxy);\n\n for (const prop of names) {\n const scriptable = isScriptable(prop);\n const indexable = isIndexable(prop);\n const value = (indexable || scriptable) && proxy[prop];\n if ((scriptable && (isFunction(value) || hasFunction(value)))\n || (indexable && isArray(value))) {\n return true;\n }\n }\n return false;\n}\n","import animator from './core.animator';\nimport defaults, {overrides} from './core.defaults';\nimport Interaction from './core.interaction';\nimport layouts from './core.layouts';\nimport {_detectPlatform} from '../platform';\nimport PluginService from './core.plugins';\nimport registry from './core.registry';\nimport Config, {determineAxis, getIndexAxis} from './core.config';\nimport {retinaScale, _isDomSupported} from '../helpers/helpers.dom';\nimport {each, callback as callCallback, uid, valueOrDefault, _elementsEqual, isNullOrUndef, setsEqual, defined, isFunction, _isClickEvent} from '../helpers/helpers.core';\nimport {clearCanvas, clipArea, createContext, unclipArea, _isPointInArea} from '../helpers';\n// @ts-ignore\nimport {version} from '../../package.json';\nimport {debounce} from '../helpers/helpers.extras';\n\n/**\n * @typedef { import('../../types').ChartEvent } ChartEvent\n * @typedef { import(\"../../types\").Point } Point\n */\n\nconst KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];\nfunction positionIsHorizontal(position, axis) {\n return position === 'top' || position === 'bottom' || (KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x');\n}\n\nfunction compare2Level(l1, l2) {\n return function(a, b) {\n return a[l1] === b[l1]\n ? a[l2] - b[l2]\n : a[l1] - b[l1];\n };\n}\n\nfunction onAnimationsComplete(context) {\n const chart = context.chart;\n const animationOptions = chart.options.animation;\n\n chart.notifyPlugins('afterRender');\n callCallback(animationOptions && animationOptions.onComplete, [context], chart);\n}\n\nfunction onAnimationProgress(context) {\n const chart = context.chart;\n const animationOptions = chart.options.animation;\n callCallback(animationOptions && animationOptions.onProgress, [context], chart);\n}\n\n/**\n * Chart.js can take a string id of a canvas element, a 2d context, or a canvas element itself.\n * Attempt to unwrap the item passed into the chart constructor so that it is a canvas element (if possible).\n */\nfunction getCanvas(item) {\n if (_isDomSupported() && typeof item === 'string') {\n item = document.getElementById(item);\n } else if (item && item.length) {\n // Support for array based queries (such as jQuery)\n item = item[0];\n }\n\n if (item && item.canvas) {\n // Support for any object associated to a canvas (including a context2d)\n item = item.canvas;\n }\n return item;\n}\n\nconst instances = {};\nconst getChart = (key) => {\n const canvas = getCanvas(key);\n return Object.values(instances).filter((c) => c.canvas === canvas).pop();\n};\n\nfunction moveNumericKeys(obj, start, move) {\n const keys = Object.keys(obj);\n for (const key of keys) {\n const intKey = +key;\n if (intKey >= start) {\n const value = obj[key];\n delete obj[key];\n if (move > 0 || intKey > start) {\n obj[intKey + move] = value;\n }\n }\n }\n}\n\n/**\n * @param {ChartEvent} e\n * @param {ChartEvent|null} lastEvent\n * @param {boolean} inChartArea\n * @param {boolean} isClick\n * @returns {ChartEvent|null}\n */\nfunction determineLastEvent(e, lastEvent, inChartArea, isClick) {\n if (!inChartArea || e.type === 'mouseout') {\n return null;\n }\n if (isClick) {\n return lastEvent;\n }\n return e;\n}\n\nfunction getDatasetArea(meta) {\n const {xScale, yScale} = meta;\n if (xScale && yScale) {\n return {\n left: xScale.left,\n right: xScale.right,\n top: yScale.top,\n bottom: yScale.bottom\n };\n }\n}\n\nclass Chart {\n\n static defaults = defaults;\n static instances = instances;\n static overrides = overrides;\n static registry = registry;\n static version = version;\n static getChart = getChart;\n\n static register(...items) {\n registry.add(...items);\n invalidatePlugins();\n }\n\n static unregister(...items) {\n registry.remove(...items);\n invalidatePlugins();\n }\n\n // eslint-disable-next-line max-statements\n constructor(item, userConfig) {\n const config = this.config = new Config(userConfig);\n const initialCanvas = getCanvas(item);\n const existingChart = getChart(initialCanvas);\n if (existingChart) {\n throw new Error(\n 'Canvas is already in use. Chart with ID \\'' + existingChart.id + '\\'' +\n\t\t\t\t' must be destroyed before the canvas with ID \\'' + existingChart.canvas.id + '\\' can be reused.'\n );\n }\n\n const options = config.createResolver(config.chartOptionScopes(), this.getContext());\n\n this.platform = new (config.platform || _detectPlatform(initialCanvas))();\n this.platform.updateConfig(config);\n\n const context = this.platform.acquireContext(initialCanvas, options.aspectRatio);\n const canvas = context && context.canvas;\n const height = canvas && canvas.height;\n const width = canvas && canvas.width;\n\n this.id = uid();\n this.ctx = context;\n this.canvas = canvas;\n this.width = width;\n this.height = height;\n this._options = options;\n // Store the previously used aspect ratio to determine if a resize\n // is needed during updates. Do this after _options is set since\n // aspectRatio uses a getter\n this._aspectRatio = this.aspectRatio;\n this._layers = [];\n this._metasets = [];\n this._stacks = undefined;\n this.boxes = [];\n this.currentDevicePixelRatio = undefined;\n this.chartArea = undefined;\n this._active = [];\n this._lastEvent = undefined;\n this._listeners = {};\n /** @type {?{attach?: function, detach?: function, resize?: function}} */\n this._responsiveListeners = undefined;\n this._sortedMetasets = [];\n this.scales = {};\n this._plugins = new PluginService();\n this.$proxies = {};\n this._hiddenIndices = {};\n this.attached = false;\n this._animationsDisabled = undefined;\n this.$context = undefined;\n this._doResize = debounce(mode => this.update(mode), options.resizeDelay || 0);\n this._dataChanges = [];\n\n // Add the chart instance to the global namespace\n instances[this.id] = this;\n\n if (!context || !canvas) {\n // The given item is not a compatible context2d element, let's return before finalizing\n // the chart initialization but after setting basic chart / controller properties that\n // can help to figure out that the chart is not valid (e.g chart.canvas !== null);\n // https://github.com/chartjs/Chart.js/issues/2807\n console.error(\"Failed to create chart: can't acquire context from the given item\");\n return;\n }\n\n animator.listen(this, 'complete', onAnimationsComplete);\n animator.listen(this, 'progress', onAnimationProgress);\n\n this._initialize();\n if (this.attached) {\n this.update();\n }\n }\n\n get aspectRatio() {\n const {options: {aspectRatio, maintainAspectRatio}, width, height, _aspectRatio} = this;\n if (!isNullOrUndef(aspectRatio)) {\n // If aspectRatio is defined in options, use that.\n return aspectRatio;\n }\n\n if (maintainAspectRatio && _aspectRatio) {\n // If maintainAspectRatio is truthly and we had previously determined _aspectRatio, use that\n return _aspectRatio;\n }\n\n // Calculate\n return height ? width / height : null;\n }\n\n get data() {\n return this.config.data;\n }\n\n set data(data) {\n this.config.data = data;\n }\n\n get options() {\n return this._options;\n }\n\n set options(options) {\n this.config.options = options;\n }\n\n get registry() {\n return registry;\n }\n\n /**\n\t * @private\n\t */\n _initialize() {\n // Before init plugin notification\n this.notifyPlugins('beforeInit');\n\n if (this.options.responsive) {\n this.resize();\n } else {\n retinaScale(this, this.options.devicePixelRatio);\n }\n\n this.bindEvents();\n\n // After init plugin notification\n this.notifyPlugins('afterInit');\n\n return this;\n }\n\n clear() {\n clearCanvas(this.canvas, this.ctx);\n return this;\n }\n\n stop() {\n animator.stop(this);\n return this;\n }\n\n /**\n\t * Resize the chart to its container or to explicit dimensions.\n\t * @param {number} [width]\n\t * @param {number} [height]\n\t */\n resize(width, height) {\n if (!animator.running(this)) {\n this._resize(width, height);\n } else {\n this._resizeBeforeDraw = {width, height};\n }\n }\n\n _resize(width, height) {\n const options = this.options;\n const canvas = this.canvas;\n const aspectRatio = options.maintainAspectRatio && this.aspectRatio;\n const newSize = this.platform.getMaximumSize(canvas, width, height, aspectRatio);\n const newRatio = options.devicePixelRatio || this.platform.getDevicePixelRatio();\n const mode = this.width ? 'resize' : 'attach';\n\n this.width = newSize.width;\n this.height = newSize.height;\n this._aspectRatio = this.aspectRatio;\n if (!retinaScale(this, newRatio, true)) {\n return;\n }\n\n this.notifyPlugins('resize', {size: newSize});\n\n callCallback(options.onResize, [this, newSize], this);\n\n if (this.attached) {\n if (this._doResize(mode)) {\n // The resize update is delayed, only draw without updating.\n this.render();\n }\n }\n }\n\n ensureScalesHaveIDs() {\n const options = this.options;\n const scalesOptions = options.scales || {};\n\n each(scalesOptions, (axisOptions, axisID) => {\n axisOptions.id = axisID;\n });\n }\n\n /**\n\t * Builds a map of scale ID to scale object for future lookup.\n\t */\n buildOrUpdateScales() {\n const options = this.options;\n const scaleOpts = options.scales;\n const scales = this.scales;\n const updated = Object.keys(scales).reduce((obj, id) => {\n obj[id] = false;\n return obj;\n }, {});\n let items = [];\n\n if (scaleOpts) {\n items = items.concat(\n Object.keys(scaleOpts).map((id) => {\n const scaleOptions = scaleOpts[id];\n const axis = determineAxis(id, scaleOptions);\n const isRadial = axis === 'r';\n const isHorizontal = axis === 'x';\n return {\n options: scaleOptions,\n dposition: isRadial ? 'chartArea' : isHorizontal ? 'bottom' : 'left',\n dtype: isRadial ? 'radialLinear' : isHorizontal ? 'category' : 'linear'\n };\n })\n );\n }\n\n each(items, (item) => {\n const scaleOptions = item.options;\n const id = scaleOptions.id;\n const axis = determineAxis(id, scaleOptions);\n const scaleType = valueOrDefault(scaleOptions.type, item.dtype);\n\n if (scaleOptions.position === undefined || positionIsHorizontal(scaleOptions.position, axis) !== positionIsHorizontal(item.dposition)) {\n scaleOptions.position = item.dposition;\n }\n\n updated[id] = true;\n let scale = null;\n if (id in scales && scales[id].type === scaleType) {\n scale = scales[id];\n } else {\n const scaleClass = registry.getScale(scaleType);\n scale = new scaleClass({\n id,\n type: scaleType,\n ctx: this.ctx,\n chart: this\n });\n scales[scale.id] = scale;\n }\n\n scale.init(scaleOptions, options);\n });\n // clear up discarded scales\n each(updated, (hasUpdated, id) => {\n if (!hasUpdated) {\n delete scales[id];\n }\n });\n\n each(scales, (scale) => {\n layouts.configure(this, scale, scale.options);\n layouts.addBox(this, scale);\n });\n }\n\n /**\n\t * @private\n\t */\n _updateMetasets() {\n const metasets = this._metasets;\n const numData = this.data.datasets.length;\n const numMeta = metasets.length;\n\n metasets.sort((a, b) => a.index - b.index);\n if (numMeta > numData) {\n for (let i = numData; i < numMeta; ++i) {\n this._destroyDatasetMeta(i);\n }\n metasets.splice(numData, numMeta - numData);\n }\n this._sortedMetasets = metasets.slice(0).sort(compare2Level('order', 'index'));\n }\n\n /**\n\t * @private\n\t */\n _removeUnreferencedMetasets() {\n const {_metasets: metasets, data: {datasets}} = this;\n if (metasets.length > datasets.length) {\n delete this._stacks;\n }\n metasets.forEach((meta, index) => {\n if (datasets.filter(x => x === meta._dataset).length === 0) {\n this._destroyDatasetMeta(index);\n }\n });\n }\n\n buildOrUpdateControllers() {\n const newControllers = [];\n const datasets = this.data.datasets;\n let i, ilen;\n\n this._removeUnreferencedMetasets();\n\n for (i = 0, ilen = datasets.length; i < ilen; i++) {\n const dataset = datasets[i];\n let meta = this.getDatasetMeta(i);\n const type = dataset.type || this.config.type;\n\n if (meta.type && meta.type !== type) {\n this._destroyDatasetMeta(i);\n meta = this.getDatasetMeta(i);\n }\n meta.type = type;\n meta.indexAxis = dataset.indexAxis || getIndexAxis(type, this.options);\n meta.order = dataset.order || 0;\n meta.index = i;\n meta.label = '' + dataset.label;\n meta.visible = this.isDatasetVisible(i);\n\n if (meta.controller) {\n meta.controller.updateIndex(i);\n meta.controller.linkScales();\n } else {\n const ControllerClass = registry.getController(type);\n const {datasetElementType, dataElementType} = defaults.datasets[type];\n Object.assign(ControllerClass, {\n dataElementType: registry.getElement(dataElementType),\n datasetElementType: datasetElementType && registry.getElement(datasetElementType)\n });\n meta.controller = new ControllerClass(this, i);\n newControllers.push(meta.controller);\n }\n }\n\n this._updateMetasets();\n return newControllers;\n }\n\n /**\n\t * Reset the elements of all datasets\n\t * @private\n\t */\n _resetElements() {\n each(this.data.datasets, (dataset, datasetIndex) => {\n this.getDatasetMeta(datasetIndex).controller.reset();\n }, this);\n }\n\n /**\n\t* Resets the chart back to its state before the initial animation\n\t*/\n reset() {\n this._resetElements();\n this.notifyPlugins('reset');\n }\n\n update(mode) {\n const config = this.config;\n\n config.update();\n const options = this._options = config.createResolver(config.chartOptionScopes(), this.getContext());\n const animsDisabled = this._animationsDisabled = !options.animation;\n\n this._updateScales();\n this._checkEventBindings();\n this._updateHiddenIndices();\n\n // plugins options references might have change, let's invalidate the cache\n // https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167\n this._plugins.invalidate();\n\n if (this.notifyPlugins('beforeUpdate', {mode, cancelable: true}) === false) {\n return;\n }\n\n // Make sure dataset controllers are updated and new controllers are reset\n const newControllers = this.buildOrUpdateControllers();\n\n this.notifyPlugins('beforeElementsUpdate');\n\n // Make sure all dataset controllers have correct meta data counts\n let minPadding = 0;\n for (let i = 0, ilen = this.data.datasets.length; i < ilen; i++) {\n const {controller} = this.getDatasetMeta(i);\n const reset = !animsDisabled && newControllers.indexOf(controller) === -1;\n // New controllers will be reset after the layout pass, so we only want to modify\n // elements added to new datasets\n controller.buildOrUpdateElements(reset);\n minPadding = Math.max(+controller.getMaxOverflow(), minPadding);\n }\n minPadding = this._minPadding = options.layout.autoPadding ? minPadding : 0;\n this._updateLayout(minPadding);\n\n // Only reset the controllers if we have animations\n if (!animsDisabled) {\n // Can only reset the new controllers after the scales have been updated\n // Reset is done to get the starting point for the initial animation\n each(newControllers, (controller) => {\n controller.reset();\n });\n }\n\n this._updateDatasets(mode);\n\n // Do this before render so that any plugins that need final scale updates can use it\n this.notifyPlugins('afterUpdate', {mode});\n\n this._layers.sort(compare2Level('z', '_idx'));\n\n // Replay last event from before update, or set hover styles on active elements\n const {_active, _lastEvent} = this;\n if (_lastEvent) {\n this._eventHandler(_lastEvent, true);\n } else if (_active.length) {\n this._updateHoverStyles(_active, _active, true);\n }\n\n this.render();\n }\n\n /**\n * @private\n */\n _updateScales() {\n each(this.scales, (scale) => {\n layouts.removeBox(this, scale);\n });\n\n this.ensureScalesHaveIDs();\n this.buildOrUpdateScales();\n }\n\n /**\n * @private\n */\n _checkEventBindings() {\n const options = this.options;\n const existingEvents = new Set(Object.keys(this._listeners));\n const newEvents = new Set(options.events);\n\n if (!setsEqual(existingEvents, newEvents) || !!this._responsiveListeners !== options.responsive) {\n // The configured events have changed. Rebind.\n this.unbindEvents();\n this.bindEvents();\n }\n }\n\n /**\n * @private\n */\n _updateHiddenIndices() {\n const {_hiddenIndices} = this;\n const changes = this._getUniformDataChanges() || [];\n for (const {method, start, count} of changes) {\n const move = method === '_removeElements' ? -count : count;\n moveNumericKeys(_hiddenIndices, start, move);\n }\n }\n\n /**\n * @private\n */\n _getUniformDataChanges() {\n const _dataChanges = this._dataChanges;\n if (!_dataChanges || !_dataChanges.length) {\n return;\n }\n\n this._dataChanges = [];\n const datasetCount = this.data.datasets.length;\n const makeSet = (idx) => new Set(\n _dataChanges\n .filter(c => c[0] === idx)\n .map((c, i) => i + ',' + c.splice(1).join(','))\n );\n\n const changeSet = makeSet(0);\n for (let i = 1; i < datasetCount; i++) {\n if (!setsEqual(changeSet, makeSet(i))) {\n return;\n }\n }\n return Array.from(changeSet)\n .map(c => c.split(','))\n .map(a => ({method: a[1], start: +a[2], count: +a[3]}));\n }\n\n /**\n\t * Updates the chart layout unless a plugin returns `false` to the `beforeLayout`\n\t * hook, in which case, plugins will not be called on `afterLayout`.\n\t * @private\n\t */\n _updateLayout(minPadding) {\n if (this.notifyPlugins('beforeLayout', {cancelable: true}) === false) {\n return;\n }\n\n layouts.update(this, this.width, this.height, minPadding);\n\n const area = this.chartArea;\n const noArea = area.width <= 0 || area.height <= 0;\n\n this._layers = [];\n each(this.boxes, (box) => {\n if (noArea && box.position === 'chartArea') {\n // Skip drawing and configuring chartArea boxes when chartArea is zero or negative\n return;\n }\n\n // configure is called twice, once in core.scale.update and once here.\n // Here the boxes are fully updated and at their final positions.\n if (box.configure) {\n box.configure();\n }\n this._layers.push(...box._layers());\n }, this);\n\n this._layers.forEach((item, index) => {\n item._idx = index;\n });\n\n this.notifyPlugins('afterLayout');\n }\n\n /**\n\t * Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate`\n\t * hook, in which case, plugins will not be called on `afterDatasetsUpdate`.\n\t * @private\n\t */\n _updateDatasets(mode) {\n if (this.notifyPlugins('beforeDatasetsUpdate', {mode, cancelable: true}) === false) {\n return;\n }\n\n for (let i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {\n this.getDatasetMeta(i).controller.configure();\n }\n\n for (let i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {\n this._updateDataset(i, isFunction(mode) ? mode({datasetIndex: i}) : mode);\n }\n\n this.notifyPlugins('afterDatasetsUpdate', {mode});\n }\n\n /**\n\t * Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`\n\t * hook, in which case, plugins will not be called on `afterDatasetUpdate`.\n\t * @private\n\t */\n _updateDataset(index, mode) {\n const meta = this.getDatasetMeta(index);\n const args = {meta, index, mode, cancelable: true};\n\n if (this.notifyPlugins('beforeDatasetUpdate', args) === false) {\n return;\n }\n\n meta.controller._update(mode);\n\n args.cancelable = false;\n this.notifyPlugins('afterDatasetUpdate', args);\n }\n\n render() {\n if (this.notifyPlugins('beforeRender', {cancelable: true}) === false) {\n return;\n }\n\n if (animator.has(this)) {\n if (this.attached && !animator.running(this)) {\n animator.start(this);\n }\n } else {\n this.draw();\n onAnimationsComplete({chart: this});\n }\n }\n\n draw() {\n let i;\n if (this._resizeBeforeDraw) {\n const {width, height} = this._resizeBeforeDraw;\n this._resize(width, height);\n this._resizeBeforeDraw = null;\n }\n this.clear();\n\n if (this.width <= 0 || this.height <= 0) {\n return;\n }\n\n if (this.notifyPlugins('beforeDraw', {cancelable: true}) === false) {\n return;\n }\n\n // Because of plugin hooks (before/afterDatasetsDraw), datasets can't\n // currently be part of layers. Instead, we draw\n // layers <= 0 before(default, backward compat), and the rest after\n const layers = this._layers;\n for (i = 0; i < layers.length && layers[i].z <= 0; ++i) {\n layers[i].draw(this.chartArea);\n }\n\n this._drawDatasets();\n\n // Rest of layers\n for (; i < layers.length; ++i) {\n layers[i].draw(this.chartArea);\n }\n\n this.notifyPlugins('afterDraw');\n }\n\n /**\n\t * @private\n\t */\n _getSortedDatasetMetas(filterVisible) {\n const metasets = this._sortedMetasets;\n const result = [];\n let i, ilen;\n\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n const meta = metasets[i];\n if (!filterVisible || meta.visible) {\n result.push(meta);\n }\n }\n\n return result;\n }\n\n /**\n\t * Gets the visible dataset metas in drawing order\n\t * @return {object[]}\n\t */\n getSortedVisibleDatasetMetas() {\n return this._getSortedDatasetMetas(true);\n }\n\n /**\n\t * Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw`\n\t * hook, in which case, plugins will not be called on `afterDatasetsDraw`.\n\t * @private\n\t */\n _drawDatasets() {\n if (this.notifyPlugins('beforeDatasetsDraw', {cancelable: true}) === false) {\n return;\n }\n\n const metasets = this.getSortedVisibleDatasetMetas();\n for (let i = metasets.length - 1; i >= 0; --i) {\n this._drawDataset(metasets[i]);\n }\n\n this.notifyPlugins('afterDatasetsDraw');\n }\n\n /**\n\t * Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw`\n\t * hook, in which case, plugins will not be called on `afterDatasetDraw`.\n\t * @private\n\t */\n _drawDataset(meta) {\n const ctx = this.ctx;\n const clip = meta._clip;\n const useClip = !clip.disabled;\n const area = getDatasetArea(meta) || this.chartArea;\n const args = {\n meta,\n index: meta.index,\n cancelable: true\n };\n\n if (this.notifyPlugins('beforeDatasetDraw', args) === false) {\n return;\n }\n\n if (useClip) {\n clipArea(ctx, {\n left: clip.left === false ? 0 : area.left - clip.left,\n right: clip.right === false ? this.width : area.right + clip.right,\n top: clip.top === false ? 0 : area.top - clip.top,\n bottom: clip.bottom === false ? this.height : area.bottom + clip.bottom\n });\n }\n\n meta.controller.draw();\n\n if (useClip) {\n unclipArea(ctx);\n }\n\n args.cancelable = false;\n this.notifyPlugins('afterDatasetDraw', args);\n }\n\n /**\n * Checks whether the given point is in the chart area.\n * @param {Point} point - in relative coordinates (see, e.g., getRelativePosition)\n * @returns {boolean}\n */\n isPointInArea(point) {\n return _isPointInArea(point, this.chartArea, this._minPadding);\n }\n\n getElementsAtEventForMode(e, mode, options, useFinalPosition) {\n const method = Interaction.modes[mode];\n if (typeof method === 'function') {\n return method(this, e, options, useFinalPosition);\n }\n\n return [];\n }\n\n getDatasetMeta(datasetIndex) {\n const dataset = this.data.datasets[datasetIndex];\n const metasets = this._metasets;\n let meta = metasets.filter(x => x && x._dataset === dataset).pop();\n\n if (!meta) {\n meta = {\n type: null,\n data: [],\n dataset: null,\n controller: null,\n hidden: null,\t\t\t// See isDatasetVisible() comment\n xAxisID: null,\n yAxisID: null,\n order: dataset && dataset.order || 0,\n index: datasetIndex,\n _dataset: dataset,\n _parsed: [],\n _sorted: false\n };\n metasets.push(meta);\n }\n\n return meta;\n }\n\n getContext() {\n return this.$context || (this.$context = createContext(null, {chart: this, type: 'chart'}));\n }\n\n getVisibleDatasetCount() {\n return this.getSortedVisibleDatasetMetas().length;\n }\n\n isDatasetVisible(datasetIndex) {\n const dataset = this.data.datasets[datasetIndex];\n if (!dataset) {\n return false;\n }\n\n const meta = this.getDatasetMeta(datasetIndex);\n\n // meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false,\n // the dataset.hidden value is ignored, else if null, the dataset hidden state is returned.\n return typeof meta.hidden === 'boolean' ? !meta.hidden : !dataset.hidden;\n }\n\n setDatasetVisibility(datasetIndex, visible) {\n const meta = this.getDatasetMeta(datasetIndex);\n meta.hidden = !visible;\n }\n\n toggleDataVisibility(index) {\n this._hiddenIndices[index] = !this._hiddenIndices[index];\n }\n\n getDataVisibility(index) {\n return !this._hiddenIndices[index];\n }\n\n /**\n\t * @private\n\t */\n _updateVisibility(datasetIndex, dataIndex, visible) {\n const mode = visible ? 'show' : 'hide';\n const meta = this.getDatasetMeta(datasetIndex);\n const anims = meta.controller._resolveAnimations(undefined, mode);\n\n if (defined(dataIndex)) {\n meta.data[dataIndex].hidden = !visible;\n this.update();\n } else {\n this.setDatasetVisibility(datasetIndex, visible);\n // Animate visible state, so hide animation can be seen. This could be handled better if update / updateDataset returned a Promise.\n anims.update(meta, {visible});\n this.update((ctx) => ctx.datasetIndex === datasetIndex ? mode : undefined);\n }\n }\n\n hide(datasetIndex, dataIndex) {\n this._updateVisibility(datasetIndex, dataIndex, false);\n }\n\n show(datasetIndex, dataIndex) {\n this._updateVisibility(datasetIndex, dataIndex, true);\n }\n\n /**\n\t * @private\n\t */\n _destroyDatasetMeta(datasetIndex) {\n const meta = this._metasets[datasetIndex];\n if (meta && meta.controller) {\n meta.controller._destroy();\n }\n delete this._metasets[datasetIndex];\n }\n\n _stop() {\n let i, ilen;\n this.stop();\n animator.remove(this);\n\n for (i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {\n this._destroyDatasetMeta(i);\n }\n }\n\n destroy() {\n this.notifyPlugins('beforeDestroy');\n const {canvas, ctx} = this;\n\n this._stop();\n this.config.clearCache();\n\n if (canvas) {\n this.unbindEvents();\n clearCanvas(canvas, ctx);\n this.platform.releaseContext(ctx);\n this.canvas = null;\n this.ctx = null;\n }\n\n delete instances[this.id];\n\n this.notifyPlugins('afterDestroy');\n }\n\n toBase64Image(...args) {\n return this.canvas.toDataURL(...args);\n }\n\n /**\n\t * @private\n\t */\n bindEvents() {\n this.bindUserEvents();\n if (this.options.responsive) {\n this.bindResponsiveEvents();\n } else {\n this.attached = true;\n }\n }\n\n /**\n * @private\n */\n bindUserEvents() {\n const listeners = this._listeners;\n const platform = this.platform;\n\n const _add = (type, listener) => {\n platform.addEventListener(this, type, listener);\n listeners[type] = listener;\n };\n\n const listener = (e, x, y) => {\n e.offsetX = x;\n e.offsetY = y;\n this._eventHandler(e);\n };\n\n each(this.options.events, (type) => _add(type, listener));\n }\n\n /**\n * @private\n */\n bindResponsiveEvents() {\n if (!this._responsiveListeners) {\n this._responsiveListeners = {};\n }\n const listeners = this._responsiveListeners;\n const platform = this.platform;\n\n const _add = (type, listener) => {\n platform.addEventListener(this, type, listener);\n listeners[type] = listener;\n };\n const _remove = (type, listener) => {\n if (listeners[type]) {\n platform.removeEventListener(this, type, listener);\n delete listeners[type];\n }\n };\n\n const listener = (width, height) => {\n if (this.canvas) {\n this.resize(width, height);\n }\n };\n\n let detached; // eslint-disable-line prefer-const\n const attached = () => {\n _remove('attach', attached);\n\n this.attached = true;\n this.resize();\n\n _add('resize', listener);\n _add('detach', detached);\n };\n\n detached = () => {\n this.attached = false;\n\n _remove('resize', listener);\n\n // Stop animating and remove metasets, so when re-attached, the animations start from beginning.\n this._stop();\n this._resize(0, 0);\n\n _add('attach', attached);\n };\n\n if (platform.isAttached(this.canvas)) {\n attached();\n } else {\n detached();\n }\n }\n\n /**\n\t * @private\n\t */\n unbindEvents() {\n each(this._listeners, (listener, type) => {\n this.platform.removeEventListener(this, type, listener);\n });\n this._listeners = {};\n\n each(this._responsiveListeners, (listener, type) => {\n this.platform.removeEventListener(this, type, listener);\n });\n this._responsiveListeners = undefined;\n }\n\n updateHoverStyle(items, mode, enabled) {\n const prefix = enabled ? 'set' : 'remove';\n let meta, item, i, ilen;\n\n if (mode === 'dataset') {\n meta = this.getDatasetMeta(items[0].datasetIndex);\n meta.controller['_' + prefix + 'DatasetHoverStyle']();\n }\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n item = items[i];\n const controller = item && this.getDatasetMeta(item.datasetIndex).controller;\n if (controller) {\n controller[prefix + 'HoverStyle'](item.element, item.datasetIndex, item.index);\n }\n }\n }\n\n /**\n\t * Get active (hovered) elements\n\t * @returns array\n\t */\n getActiveElements() {\n return this._active || [];\n }\n\n /**\n\t * Set active (hovered) elements\n\t * @param {array} activeElements New active data points\n\t */\n setActiveElements(activeElements) {\n const lastActive = this._active || [];\n const active = activeElements.map(({datasetIndex, index}) => {\n const meta = this.getDatasetMeta(datasetIndex);\n if (!meta) {\n throw new Error('No dataset found at index ' + datasetIndex);\n }\n\n return {\n datasetIndex,\n element: meta.data[index],\n index,\n };\n });\n const changed = !_elementsEqual(active, lastActive);\n\n if (changed) {\n this._active = active;\n // Make sure we don't use the previous mouse event to override the active elements in update.\n this._lastEvent = null;\n this._updateHoverStyles(active, lastActive);\n }\n }\n\n /**\n\t * Calls enabled plugins on the specified hook and with the given args.\n\t * This method immediately returns as soon as a plugin explicitly returns false. The\n\t * returned value can be used, for instance, to interrupt the current action.\n\t * @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate').\n\t * @param {Object} [args] - Extra arguments to apply to the hook call.\n * @param {import('./core.plugins').filterCallback} [filter] - Filtering function for limiting which plugins are notified\n\t * @returns {boolean} false if any of the plugins return false, else returns true.\n\t */\n notifyPlugins(hook, args, filter) {\n return this._plugins.notify(this, hook, args, filter);\n }\n\n /**\n * Check if a plugin with the specific ID is registered and enabled\n * @param {string} pluginId - The ID of the plugin of which to check if it is enabled\n * @returns {boolean}\n */\n isPluginEnabled(pluginId) {\n return this._plugins._cache.filter(p => p.plugin.id === pluginId).length === 1;\n }\n\n /**\n\t * @private\n\t */\n _updateHoverStyles(active, lastActive, replay) {\n const hoverOptions = this.options.hover;\n const diff = (a, b) => a.filter(x => !b.some(y => x.datasetIndex === y.datasetIndex && x.index === y.index));\n const deactivated = diff(lastActive, active);\n const activated = replay ? active : diff(active, lastActive);\n\n if (deactivated.length) {\n this.updateHoverStyle(deactivated, hoverOptions.mode, false);\n }\n\n if (activated.length && hoverOptions.mode) {\n this.updateHoverStyle(activated, hoverOptions.mode, true);\n }\n }\n\n /**\n\t * @private\n\t */\n _eventHandler(e, replay) {\n const args = {\n event: e,\n replay,\n cancelable: true,\n inChartArea: this.isPointInArea(e)\n };\n const eventFilter = (plugin) => (plugin.options.events || this.options.events).includes(e.native.type);\n\n if (this.notifyPlugins('beforeEvent', args, eventFilter) === false) {\n return;\n }\n\n const changed = this._handleEvent(e, replay, args.inChartArea);\n\n args.cancelable = false;\n this.notifyPlugins('afterEvent', args, eventFilter);\n\n if (changed || args.changed) {\n this.render();\n }\n\n return this;\n }\n\n /**\n\t * Handle an event\n\t * @param {ChartEvent} e the event to handle\n\t * @param {boolean} [replay] - true if the event was replayed by `update`\n * @param {boolean} [inChartArea] - true if the event is inside chartArea\n\t * @return {boolean} true if the chart needs to re-render\n\t * @private\n\t */\n _handleEvent(e, replay, inChartArea) {\n const {_active: lastActive = [], options} = this;\n\n // If the event is replayed from `update`, we should evaluate with the final positions.\n //\n // The `replay`:\n // It's the last event (excluding click) that has occurred before `update`.\n // So mouse has not moved. It's also over the chart, because there is a `replay`.\n //\n // The why:\n // If animations are active, the elements haven't moved yet compared to state before update.\n // But if they will, we are activating the elements that would be active, if this check\n // was done after the animations have completed. => \"final positions\".\n // If there is no animations, the \"final\" and \"current\" positions are equal.\n // This is done so we do not have to evaluate the active elements each animation frame\n // - it would be expensive.\n const useFinalPosition = replay;\n const active = this._getActiveElements(e, lastActive, inChartArea, useFinalPosition);\n const isClick = _isClickEvent(e);\n const lastEvent = determineLastEvent(e, this._lastEvent, inChartArea, isClick);\n\n if (inChartArea) {\n // Set _lastEvent to null while we are processing the event handlers.\n // This prevents recursion if the handler calls chart.update()\n this._lastEvent = null;\n\n // Invoke onHover hook\n callCallback(options.onHover, [e, active, this], this);\n\n if (isClick) {\n callCallback(options.onClick, [e, active, this], this);\n }\n }\n\n const changed = !_elementsEqual(active, lastActive);\n if (changed || replay) {\n this._active = active;\n this._updateHoverStyles(active, lastActive, replay);\n }\n\n this._lastEvent = lastEvent;\n\n return changed;\n }\n\n /**\n * @param {ChartEvent} e - The event\n * @param {import('../../types').ActiveElement[]} lastActive - Previously active elements\n * @param {boolean} inChartArea - Is the envent inside chartArea\n * @param {boolean} useFinalPosition - Should the evaluation be done with current or final (after animation) element positions\n * @returns {import('../../types').ActiveElement[]} - The active elements\n * @pravate\n */\n _getActiveElements(e, lastActive, inChartArea, useFinalPosition) {\n if (e.type === 'mouseout') {\n return [];\n }\n\n if (!inChartArea) {\n // Let user control the active elements outside chartArea. Eg. using Legend.\n return lastActive;\n }\n\n const hoverOptions = this.options.hover;\n return this.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions, useFinalPosition);\n }\n}\n\n// @ts-ignore\nfunction invalidatePlugins() {\n return each(Chart.instances, (chart) => chart._plugins.invalidate());\n}\n\nexport default Chart;\n","/**\n * @namespace Chart._adapters\n * @since 2.8.0\n * @private\n */\n\nimport type {AnyObject} from '../../types/basic';\nimport type {ChartOptions} from '../../types';\n\nexport type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';\n\nexport interface DateAdapter {\n readonly options: T;\n /**\n * Will called with chart options after adapter creation.\n */\n init(this: DateAdapter, chartOptions: ChartOptions): void;\n /**\n * Returns a map of time formats for the supported formatting units defined\n * in Unit as well as 'datetime' representing a detailed date/time string.\n */\n formats(this: DateAdapter): Record;\n /**\n * Parses the given `value` and return the associated timestamp.\n * @param value - the value to parse (usually comes from the data)\n * @param [format] - the expected data format\n */\n parse(this: DateAdapter, value: unknown, format?: TimeUnit): number | null;\n /**\n * Returns the formatted date in the specified `format` for a given `timestamp`.\n * @param timestamp - the timestamp to format\n * @param format - the date/time token\n */\n format(this: DateAdapter, timestamp: number, format: TimeUnit): string;\n /**\n * Adds the specified `amount` of `unit` to the given `timestamp`.\n * @param timestamp - the input timestamp\n * @param amount - the amount to add\n * @param unit - the unit as string\n */\n add(this: DateAdapter, timestamp: number, amount: number, unit: TimeUnit): number;\n /**\n * Returns the number of `unit` between the given timestamps.\n * @param a - the input timestamp (reference)\n * @param b - the timestamp to subtract\n * @param unit - the unit as string\n */\n diff(this: DateAdapter, a: number, b: number, unit: TimeUnit): number;\n /**\n * Returns start of `unit` for the given `timestamp`.\n * @param timestamp - the input timestamp\n * @param unit - the unit as string\n * @param [weekday] - the ISO day of the week with 1 being Monday\n * and 7 being Sunday (only needed if param *unit* is `isoWeek`).\n */\n startOf(this: DateAdapter, timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number;\n /**\n * Returns end of `unit` for the given `timestamp`.\n * @param timestamp - the input timestamp\n * @param unit - the unit as string\n */\n endOf(this: DateAdapter, timestamp: number, unit: TimeUnit | 'isoWeek'): number;\n}\n\nfunction abstract(): T {\n throw new Error('This method is not implemented: Check that a complete date adapter is provided.');\n}\n\n/**\n * Date adapter (current used by the time scale)\n * @namespace Chart._adapters._date\n * @memberof Chart._adapters\n * @private\n */\nclass DateAdapterBase implements DateAdapter {\n\n /**\n * Override default date adapter methods.\n * Accepts type parameter to define options type.\n * @example\n * Chart._adapters._date.override<{myAdapterOption: string}>({\n * init() {\n * console.log(this.options.myAdapterOption);\n * }\n * })\n */\n static override(\n members: Partial, 'options'>>\n ) {\n Object.assign(DateAdapterBase.prototype, members);\n }\n\n readonly options: AnyObject;\n\n constructor(options: AnyObject) {\n this.options = options || {};\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n init() {}\n\n formats(): Record {\n return abstract();\n }\n\n parse(): number | null {\n return abstract();\n }\n\n format(): string {\n return abstract();\n }\n\n add(): number {\n return abstract();\n }\n\n diff(): number {\n return abstract();\n }\n\n startOf(): number {\n return abstract();\n }\n\n endOf(): number {\n return abstract();\n }\n}\n\nexport default {\n _date: DateAdapterBase\n};\n","import DatasetController from '../core/core.datasetController';\nimport {\n _arrayUnique, isArray, isNullOrUndef,\n valueOrDefault, resolveObjectKey, sign, defined\n} from '../helpers';\n\nfunction getAllScaleValues(scale, type) {\n if (!scale._cache.$bar) {\n const visibleMetas = scale.getMatchingVisibleMetas(type);\n let values = [];\n\n for (let i = 0, ilen = visibleMetas.length; i < ilen; i++) {\n values = values.concat(visibleMetas[i].controller.getAllParsedValues(scale));\n }\n scale._cache.$bar = _arrayUnique(values.sort((a, b) => a - b));\n }\n return scale._cache.$bar;\n}\n\n/**\n * Computes the \"optimal\" sample size to maintain bars equally sized while preventing overlap.\n * @private\n */\nfunction computeMinSampleSize(meta) {\n const scale = meta.iScale;\n const values = getAllScaleValues(scale, meta.type);\n let min = scale._length;\n let i, ilen, curr, prev;\n const updateMinAndPrev = () => {\n if (curr === 32767 || curr === -32768) {\n // Ignore truncated pixels\n return;\n }\n if (defined(prev)) {\n // curr - prev === 0 is ignored\n min = Math.min(min, Math.abs(curr - prev) || min);\n }\n prev = curr;\n };\n\n for (i = 0, ilen = values.length; i < ilen; ++i) {\n curr = scale.getPixelForValue(values[i]);\n updateMinAndPrev();\n }\n\n prev = undefined;\n for (i = 0, ilen = scale.ticks.length; i < ilen; ++i) {\n curr = scale.getPixelForTick(i);\n updateMinAndPrev();\n }\n\n return min;\n}\n\n/**\n * Computes an \"ideal\" category based on the absolute bar thickness or, if undefined or null,\n * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This\n * mode currently always generates bars equally sized (until we introduce scriptable options?).\n * @private\n */\nfunction computeFitCategoryTraits(index, ruler, options, stackCount) {\n const thickness = options.barThickness;\n let size, ratio;\n\n if (isNullOrUndef(thickness)) {\n size = ruler.min * options.categoryPercentage;\n ratio = options.barPercentage;\n } else {\n // When bar thickness is enforced, category and bar percentages are ignored.\n // Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')\n // and deprecate barPercentage since this value is ignored when thickness is absolute.\n size = thickness * stackCount;\n ratio = 1;\n }\n\n return {\n chunk: size / stackCount,\n ratio,\n start: ruler.pixels[index] - (size / 2)\n };\n}\n\n/**\n * Computes an \"optimal\" category that globally arranges bars side by side (no gap when\n * percentage options are 1), based on the previous and following categories. This mode\n * generates bars with different widths when data are not evenly spaced.\n * @private\n */\nfunction computeFlexCategoryTraits(index, ruler, options, stackCount) {\n const pixels = ruler.pixels;\n const curr = pixels[index];\n let prev = index > 0 ? pixels[index - 1] : null;\n let next = index < pixels.length - 1 ? pixels[index + 1] : null;\n const percent = options.categoryPercentage;\n\n if (prev === null) {\n // first data: its size is double based on the next point or,\n // if it's also the last data, we use the scale size.\n prev = curr - (next === null ? ruler.end - ruler.start : next - curr);\n }\n\n if (next === null) {\n // last data: its size is also double based on the previous point.\n next = curr + curr - prev;\n }\n\n const start = curr - (curr - Math.min(prev, next)) / 2 * percent;\n const size = Math.abs(next - prev) / 2 * percent;\n\n return {\n chunk: size / stackCount,\n ratio: options.barPercentage,\n start\n };\n}\n\nfunction parseFloatBar(entry, item, vScale, i) {\n const startValue = vScale.parse(entry[0], i);\n const endValue = vScale.parse(entry[1], i);\n const min = Math.min(startValue, endValue);\n const max = Math.max(startValue, endValue);\n let barStart = min;\n let barEnd = max;\n\n if (Math.abs(min) > Math.abs(max)) {\n barStart = max;\n barEnd = min;\n }\n\n // Store `barEnd` (furthest away from origin) as parsed value,\n // to make stacking straight forward\n item[vScale.axis] = barEnd;\n\n item._custom = {\n barStart,\n barEnd,\n start: startValue,\n end: endValue,\n min,\n max\n };\n}\n\nfunction parseValue(entry, item, vScale, i) {\n if (isArray(entry)) {\n parseFloatBar(entry, item, vScale, i);\n } else {\n item[vScale.axis] = vScale.parse(entry, i);\n }\n return item;\n}\n\nfunction parseArrayOrPrimitive(meta, data, start, count) {\n const iScale = meta.iScale;\n const vScale = meta.vScale;\n const labels = iScale.getLabels();\n const singleScale = iScale === vScale;\n const parsed = [];\n let i, ilen, item, entry;\n\n for (i = start, ilen = start + count; i < ilen; ++i) {\n entry = data[i];\n item = {};\n item[iScale.axis] = singleScale || iScale.parse(labels[i], i);\n parsed.push(parseValue(entry, item, vScale, i));\n }\n return parsed;\n}\n\nfunction isFloatBar(custom) {\n return custom && custom.barStart !== undefined && custom.barEnd !== undefined;\n}\n\nfunction barSign(size, vScale, actualBase) {\n if (size !== 0) {\n return sign(size);\n }\n return (vScale.isHorizontal() ? 1 : -1) * (vScale.min >= actualBase ? 1 : -1);\n}\n\nfunction borderProps(properties) {\n let reverse, start, end, top, bottom;\n if (properties.horizontal) {\n reverse = properties.base > properties.x;\n start = 'left';\n end = 'right';\n } else {\n reverse = properties.base < properties.y;\n start = 'bottom';\n end = 'top';\n }\n if (reverse) {\n top = 'end';\n bottom = 'start';\n } else {\n top = 'start';\n bottom = 'end';\n }\n return {start, end, reverse, top, bottom};\n}\n\nfunction setBorderSkipped(properties, options, stack, index) {\n let edge = options.borderSkipped;\n const res = {};\n\n if (!edge) {\n properties.borderSkipped = res;\n return;\n }\n\n if (edge === true) {\n properties.borderSkipped = {top: true, right: true, bottom: true, left: true};\n return;\n }\n\n const {start, end, reverse, top, bottom} = borderProps(properties);\n\n if (edge === 'middle' && stack) {\n properties.enableBorderRadius = true;\n if ((stack._top || 0) === index) {\n edge = top;\n } else if ((stack._bottom || 0) === index) {\n edge = bottom;\n } else {\n res[parseEdge(bottom, start, end, reverse)] = true;\n edge = top;\n }\n }\n\n res[parseEdge(edge, start, end, reverse)] = true;\n properties.borderSkipped = res;\n}\n\nfunction parseEdge(edge, a, b, reverse) {\n if (reverse) {\n edge = swap(edge, a, b);\n edge = startEnd(edge, b, a);\n } else {\n edge = startEnd(edge, a, b);\n }\n return edge;\n}\n\nfunction swap(orig, v1, v2) {\n return orig === v1 ? v2 : orig === v2 ? v1 : orig;\n}\n\nfunction startEnd(v, start, end) {\n return v === 'start' ? start : v === 'end' ? end : v;\n}\n\nfunction setInflateAmount(properties, {inflateAmount}, ratio) {\n properties.inflateAmount = inflateAmount === 'auto'\n ? ratio === 1 ? 0.33 : 0\n : inflateAmount;\n}\n\nexport default class BarController extends DatasetController {\n\n static id = 'bar';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'bar',\n\n categoryPercentage: 0.8,\n barPercentage: 0.9,\n grouped: true,\n\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'base', 'width', 'height']\n }\n }\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n scales: {\n _index_: {\n type: 'category',\n offset: true,\n grid: {\n offset: true\n }\n },\n _value_: {\n type: 'linear',\n beginAtZero: true,\n }\n }\n };\n\n\n /**\n\t * Overriding primitive data parsing since we support mixed primitive/array\n\t * data for float bars\n\t * @protected\n\t */\n parsePrimitiveData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n\n /**\n\t * Overriding array data parsing since we support mixed primitive/array\n\t * data for float bars\n\t * @protected\n\t */\n parseArrayData(meta, data, start, count) {\n return parseArrayOrPrimitive(meta, data, start, count);\n }\n\n /**\n\t * Overriding object data parsing since we support mixed primitive/array\n\t * value-scale data for float bars\n\t * @protected\n\t */\n parseObjectData(meta, data, start, count) {\n const {iScale, vScale} = meta;\n const {xAxisKey = 'x', yAxisKey = 'y'} = this._parsing;\n const iAxisKey = iScale.axis === 'x' ? xAxisKey : yAxisKey;\n const vAxisKey = vScale.axis === 'x' ? xAxisKey : yAxisKey;\n const parsed = [];\n let i, ilen, item, obj;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n obj = data[i];\n item = {};\n item[iScale.axis] = iScale.parse(resolveObjectKey(obj, iAxisKey), i);\n parsed.push(parseValue(resolveObjectKey(obj, vAxisKey), item, vScale, i));\n }\n return parsed;\n }\n\n /**\n\t * @protected\n\t */\n updateRangeFromParsed(range, scale, parsed, stack) {\n super.updateRangeFromParsed(range, scale, parsed, stack);\n const custom = parsed._custom;\n if (custom && scale === this._cachedMeta.vScale) {\n // float bar: only one end of the bar is considered by `super`\n range.min = Math.min(range.min, custom.min);\n range.max = Math.max(range.max, custom.max);\n }\n }\n\n /**\n\t * @return {number|boolean}\n\t * @protected\n\t */\n getMaxOverflow() {\n return 0;\n }\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const {iScale, vScale} = meta;\n const parsed = this.getParsed(index);\n const custom = parsed._custom;\n const value = isFloatBar(custom)\n ? '[' + custom.start + ', ' + custom.end + ']'\n : '' + vScale.getLabelForValue(parsed[vScale.axis]);\n\n return {\n label: '' + iScale.getLabelForValue(parsed[iScale.axis]),\n value\n };\n }\n\n initialize() {\n this.enableOptionSharing = true;\n\n super.initialize();\n\n const meta = this._cachedMeta;\n meta.stack = this.getDataset().stack;\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n this.updateElements(meta.data, 0, meta.data.length, mode);\n }\n\n updateElements(bars, start, count, mode) {\n const reset = mode === 'reset';\n const {index, _cachedMeta: {vScale}} = this;\n const base = vScale.getBasePixel();\n const horizontal = vScale.isHorizontal();\n const ruler = this._getRuler();\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n\n for (let i = start; i < start + count; i++) {\n const parsed = this.getParsed(i);\n const vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {base, head: base} : this._calculateBarValuePixels(i);\n const ipixels = this._calculateBarIndexPixels(i, ruler);\n const stack = (parsed._stacks || {})[vScale.axis];\n\n const properties = {\n horizontal,\n base: vpixels.base,\n enableBorderRadius: !stack || isFloatBar(parsed._custom) || (index === stack._top || index === stack._bottom),\n x: horizontal ? vpixels.head : ipixels.center,\n y: horizontal ? ipixels.center : vpixels.head,\n height: horizontal ? ipixels.size : Math.abs(vpixels.size),\n width: horizontal ? Math.abs(vpixels.size) : ipixels.size\n };\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, bars[i].active ? 'active' : mode);\n }\n const options = properties.options || bars[i].options;\n setBorderSkipped(properties, options, stack, index);\n setInflateAmount(properties, options, ruler.ratio);\n this.updateElement(bars[i], i, properties, mode);\n }\n }\n\n /**\n\t * Returns the stacks based on groups and bar visibility.\n\t * @param {number} [last] - The dataset index\n\t * @param {number} [dataIndex] - The data index of the ruler\n\t * @returns {string[]} The list of stack IDs\n\t * @private\n\t */\n _getStacks(last, dataIndex) {\n const {iScale} = this._cachedMeta;\n const metasets = iScale.getMatchingVisibleMetas(this._type)\n .filter(meta => meta.controller.options.grouped);\n const stacked = iScale.options.stacked;\n const stacks = [];\n\n const skipNull = (meta) => {\n const parsed = meta.controller.getParsed(dataIndex);\n const val = parsed && parsed[meta.vScale.axis];\n\n if (isNullOrUndef(val) || isNaN(val)) {\n return true;\n }\n };\n\n for (const meta of metasets) {\n if (dataIndex !== undefined && skipNull(meta)) {\n continue;\n }\n\n // stacked | meta.stack\n // | found | not found | undefined\n // false | x | x | x\n // true | | x |\n // undefined | | x | x\n if (stacked === false || stacks.indexOf(meta.stack) === -1 ||\n\t\t\t\t(stacked === undefined && meta.stack === undefined)) {\n stacks.push(meta.stack);\n }\n if (meta.index === last) {\n break;\n }\n }\n\n // No stacks? that means there is no visible data. Let's still initialize an `undefined`\n // stack where possible invisible bars will be located.\n // https://github.com/chartjs/Chart.js/issues/6368\n if (!stacks.length) {\n stacks.push(undefined);\n }\n\n return stacks;\n }\n\n /**\n\t * Returns the effective number of stacks based on groups and bar visibility.\n\t * @private\n\t */\n _getStackCount(index) {\n return this._getStacks(undefined, index).length;\n }\n\n /**\n\t * Returns the stack index for the given dataset based on groups and bar visibility.\n\t * @param {number} [datasetIndex] - The dataset index\n\t * @param {string} [name] - The stack name to find\n * @param {number} [dataIndex]\n\t * @returns {number} The stack index\n\t * @private\n\t */\n _getStackIndex(datasetIndex, name, dataIndex) {\n const stacks = this._getStacks(datasetIndex, dataIndex);\n const index = (name !== undefined)\n ? stacks.indexOf(name)\n : -1; // indexOf returns -1 if element is not present\n\n return (index === -1)\n ? stacks.length - 1\n : index;\n }\n\n /**\n\t * @private\n\t */\n _getRuler() {\n const opts = this.options;\n const meta = this._cachedMeta;\n const iScale = meta.iScale;\n const pixels = [];\n let i, ilen;\n\n for (i = 0, ilen = meta.data.length; i < ilen; ++i) {\n pixels.push(iScale.getPixelForValue(this.getParsed(i)[iScale.axis], i));\n }\n\n const barThickness = opts.barThickness;\n const min = barThickness || computeMinSampleSize(meta);\n\n return {\n min,\n pixels,\n start: iScale._startPixel,\n end: iScale._endPixel,\n stackCount: this._getStackCount(),\n scale: iScale,\n grouped: opts.grouped,\n // bar thickness ratio used for non-grouped bars\n ratio: barThickness ? 1 : opts.categoryPercentage * opts.barPercentage\n };\n }\n\n /**\n\t * Note: pixel values are not clamped to the scale area.\n\t * @private\n\t */\n _calculateBarValuePixels(index) {\n const {_cachedMeta: {vScale, _stacked}, options: {base: baseValue, minBarLength}} = this;\n const actualBase = baseValue || 0;\n const parsed = this.getParsed(index);\n const custom = parsed._custom;\n const floating = isFloatBar(custom);\n let value = parsed[vScale.axis];\n let start = 0;\n let length = _stacked ? this.applyStack(vScale, parsed, _stacked) : value;\n let head, size;\n\n if (length !== value) {\n start = length - value;\n length = value;\n }\n\n if (floating) {\n value = custom.barStart;\n length = custom.barEnd - custom.barStart;\n // bars crossing origin are not stacked\n if (value !== 0 && sign(value) !== sign(custom.barEnd)) {\n start = 0;\n }\n start += value;\n }\n\n const startValue = !isNullOrUndef(baseValue) && !floating ? baseValue : start;\n let base = vScale.getPixelForValue(startValue);\n\n if (this.chart.getDataVisibility(index)) {\n head = vScale.getPixelForValue(start + length);\n } else {\n // When not visible, no height\n head = base;\n }\n\n size = head - base;\n\n if (Math.abs(size) < minBarLength) {\n size = barSign(size, vScale, actualBase) * minBarLength;\n if (value === actualBase) {\n base -= size / 2;\n }\n const startPixel = vScale.getPixelForDecimal(0);\n const endPixel = vScale.getPixelForDecimal(1);\n const min = Math.min(startPixel, endPixel);\n const max = Math.max(startPixel, endPixel);\n base = Math.max(Math.min(base, max), min);\n head = base + size;\n }\n\n if (base === vScale.getPixelForValue(actualBase)) {\n const halfGrid = sign(size) * vScale.getLineWidthForValue(actualBase) / 2;\n base += halfGrid;\n size -= halfGrid;\n }\n\n return {\n size,\n base,\n head,\n center: head + size / 2\n };\n }\n\n /**\n\t * @private\n\t */\n _calculateBarIndexPixels(index, ruler) {\n const scale = ruler.scale;\n const options = this.options;\n const skipNull = options.skipNull;\n const maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);\n let center, size;\n if (ruler.grouped) {\n const stackCount = skipNull ? this._getStackCount(index) : ruler.stackCount;\n const range = options.barThickness === 'flex'\n ? computeFlexCategoryTraits(index, ruler, options, stackCount)\n : computeFitCategoryTraits(index, ruler, options, stackCount);\n\n const stackIndex = this._getStackIndex(this.index, this._cachedMeta.stack, skipNull ? index : undefined);\n center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);\n size = Math.min(maxBarThickness, range.chunk * range.ratio);\n } else {\n // For non-grouped bar charts, exact pixel values are used\n center = scale.getPixelForValue(this.getParsed(index)[scale.axis], index);\n size = Math.min(maxBarThickness, ruler.min * ruler.ratio);\n }\n\n return {\n base: center - size / 2,\n head: center + size / 2,\n center,\n size\n };\n }\n\n draw() {\n const meta = this._cachedMeta;\n const vScale = meta.vScale;\n const rects = meta.data;\n const ilen = rects.length;\n let i = 0;\n\n for (; i < ilen; ++i) {\n if (this.getParsed(i)[vScale.axis] !== null) {\n rects[i].draw(this._ctx);\n }\n }\n }\n\n}\n","import DatasetController from '../core/core.datasetController';\nimport {isObject, resolveObjectKey, toPercentage, toDimension, valueOrDefault} from '../helpers/helpers.core';\nimport {formatNumber} from '../helpers/helpers.intl';\nimport {toRadians, PI, TAU, HALF_PI, _angleBetween} from '../helpers/helpers.math';\n\n/**\n * @typedef { import(\"../core/core.controller\").default } Chart\n */\n\nfunction getRatioAndOffset(rotation, circumference, cutout) {\n let ratioX = 1;\n let ratioY = 1;\n let offsetX = 0;\n let offsetY = 0;\n // If the chart's circumference isn't a full circle, calculate size as a ratio of the width/height of the arc\n if (circumference < TAU) {\n const startAngle = rotation;\n const endAngle = startAngle + circumference;\n const startX = Math.cos(startAngle);\n const startY = Math.sin(startAngle);\n const endX = Math.cos(endAngle);\n const endY = Math.sin(endAngle);\n const calcMax = (angle, a, b) => _angleBetween(angle, startAngle, endAngle, true) ? 1 : Math.max(a, a * cutout, b, b * cutout);\n const calcMin = (angle, a, b) => _angleBetween(angle, startAngle, endAngle, true) ? -1 : Math.min(a, a * cutout, b, b * cutout);\n const maxX = calcMax(0, startX, endX);\n const maxY = calcMax(HALF_PI, startY, endY);\n const minX = calcMin(PI, startX, endX);\n const minY = calcMin(PI + HALF_PI, startY, endY);\n ratioX = (maxX - minX) / 2;\n ratioY = (maxY - minY) / 2;\n offsetX = -(maxX + minX) / 2;\n offsetY = -(maxY + minY) / 2;\n }\n return {ratioX, ratioY, offsetX, offsetY};\n}\n\nexport default class DoughnutController extends DatasetController {\n\n static id = 'doughnut';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'arc',\n animation: {\n // Boolean - Whether we animate the rotation of the Doughnut\n animateRotate: true,\n // Boolean - Whether we animate scaling the Doughnut from the centre\n animateScale: false\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['circumference', 'endAngle', 'innerRadius', 'outerRadius', 'startAngle', 'x', 'y', 'offset', 'borderWidth', 'spacing']\n },\n },\n // The percentage of the chart that we cut out of the middle.\n cutout: '50%',\n\n // The rotation of the chart, where the first data arc begins.\n rotation: 0,\n\n // The total circumference of the chart.\n circumference: 360,\n\n // The outr radius of the chart\n radius: '100%',\n\n // Spacing between arcs\n spacing: 0,\n\n indexAxis: 'r',\n };\n\n static descriptors = {\n _scriptable: (name) => name !== 'spacing',\n _indexable: (name) => name !== 'spacing',\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n aspectRatio: 1,\n\n // Need to override these to give a nice default\n plugins: {\n legend: {\n labels: {\n generateLabels(chart) {\n const data = chart.data;\n if (data.labels.length && data.datasets.length) {\n const {labels: {pointStyle, color}} = chart.legend.options;\n\n return data.labels.map((label, i) => {\n const meta = chart.getDatasetMeta(0);\n const style = meta.controller.getStyle(i);\n\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n fontColor: color,\n lineWidth: style.borderWidth,\n pointStyle: pointStyle,\n hidden: !chart.getDataVisibility(i),\n\n // Extra data used for toggling the correct item\n index: i\n };\n });\n }\n return [];\n }\n },\n\n onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n }\n }\n };\n\n constructor(chart, datasetIndex) {\n super(chart, datasetIndex);\n\n this.enableOptionSharing = true;\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n this.offsetX = undefined;\n this.offsetY = undefined;\n }\n\n linkScales() {}\n\n /**\n\t * Override data parsing, since we are not using scales\n\t */\n parse(start, count) {\n const data = this.getDataset().data;\n const meta = this._cachedMeta;\n\n if (this._parsing === false) {\n meta._parsed = data;\n } else {\n let getter = (i) => +data[i];\n\n if (isObject(data[start])) {\n const {key = 'value'} = this._parsing;\n getter = (i) => +resolveObjectKey(data[i], key);\n }\n\n let i, ilen;\n for (i = start, ilen = start + count; i < ilen; ++i) {\n meta._parsed[i] = getter(i);\n }\n }\n }\n\n /**\n\t * @private\n\t */\n _getRotation() {\n return toRadians(this.options.rotation - 90);\n }\n\n /**\n\t * @private\n\t */\n _getCircumference() {\n return toRadians(this.options.circumference);\n }\n\n /**\n\t * Get the maximal rotation & circumference extents\n\t * across all visible datasets.\n\t */\n _getRotationExtents() {\n let min = TAU;\n let max = -TAU;\n\n for (let i = 0; i < this.chart.data.datasets.length; ++i) {\n if (this.chart.isDatasetVisible(i) && this.chart.getDatasetMeta(i).type === this._type) {\n const controller = this.chart.getDatasetMeta(i).controller;\n const rotation = controller._getRotation();\n const circumference = controller._getCircumference();\n\n min = Math.min(min, rotation);\n max = Math.max(max, rotation + circumference);\n }\n }\n\n return {\n rotation: min,\n circumference: max - min,\n };\n }\n\n /**\n\t * @param {string} mode\n\t */\n update(mode) {\n const chart = this.chart;\n const {chartArea} = chart;\n const meta = this._cachedMeta;\n const arcs = meta.data;\n const spacing = this.getMaxBorderWidth() + this.getMaxOffset(arcs) + this.options.spacing;\n const maxSize = Math.max((Math.min(chartArea.width, chartArea.height) - spacing) / 2, 0);\n const cutout = Math.min(toPercentage(this.options.cutout, maxSize), 1);\n const chartWeight = this._getRingWeight(this.index);\n\n // Compute the maximal rotation & circumference limits.\n // If we only consider our dataset, this can cause problems when two datasets\n // are both less than a circle with different rotations (starting angles)\n const {circumference, rotation} = this._getRotationExtents();\n const {ratioX, ratioY, offsetX, offsetY} = getRatioAndOffset(rotation, circumference, cutout);\n const maxWidth = (chartArea.width - spacing) / ratioX;\n const maxHeight = (chartArea.height - spacing) / ratioY;\n const maxRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);\n const outerRadius = toDimension(this.options.radius, maxRadius);\n const innerRadius = Math.max(outerRadius * cutout, 0);\n const radiusLength = (outerRadius - innerRadius) / this._getVisibleDatasetWeightTotal();\n this.offsetX = offsetX * outerRadius;\n this.offsetY = offsetY * outerRadius;\n\n meta.total = this.calculateTotal();\n\n this.outerRadius = outerRadius - radiusLength * this._getRingWeightOffset(this.index);\n this.innerRadius = Math.max(this.outerRadius - radiusLength * chartWeight, 0);\n\n this.updateElements(arcs, 0, arcs.length, mode);\n }\n\n /**\n * @private\n */\n _circumference(i, reset) {\n const opts = this.options;\n const meta = this._cachedMeta;\n const circumference = this._getCircumference();\n if ((reset && opts.animation.animateRotate) || !this.chart.getDataVisibility(i) || meta._parsed[i] === null || meta.data[i].hidden) {\n return 0;\n }\n return this.calculateCircumference(meta._parsed[i] * circumference / TAU);\n }\n\n updateElements(arcs, start, count, mode) {\n const reset = mode === 'reset';\n const chart = this.chart;\n const chartArea = chart.chartArea;\n const opts = chart.options;\n const animationOpts = opts.animation;\n const centerX = (chartArea.left + chartArea.right) / 2;\n const centerY = (chartArea.top + chartArea.bottom) / 2;\n const animateScale = reset && animationOpts.animateScale;\n const innerRadius = animateScale ? 0 : this.innerRadius;\n const outerRadius = animateScale ? 0 : this.outerRadius;\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n let startAngle = this._getRotation();\n let i;\n\n for (i = 0; i < start; ++i) {\n startAngle += this._circumference(i, reset);\n }\n\n for (i = start; i < start + count; ++i) {\n const circumference = this._circumference(i, reset);\n const arc = arcs[i];\n const properties = {\n x: centerX + this.offsetX,\n y: centerY + this.offsetY,\n startAngle,\n endAngle: startAngle + circumference,\n circumference,\n outerRadius,\n innerRadius\n };\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, arc.active ? 'active' : mode);\n }\n startAngle += circumference;\n\n this.updateElement(arc, i, properties, mode);\n }\n }\n\n calculateTotal() {\n const meta = this._cachedMeta;\n const metaData = meta.data;\n let total = 0;\n let i;\n\n for (i = 0; i < metaData.length; i++) {\n const value = meta._parsed[i];\n if (value !== null && !isNaN(value) && this.chart.getDataVisibility(i) && !metaData[i].hidden) {\n total += Math.abs(value);\n }\n }\n\n return total;\n }\n\n calculateCircumference(value) {\n const total = this._cachedMeta.total;\n if (total > 0 && !isNaN(value)) {\n return TAU * (Math.abs(value) / total);\n }\n return 0;\n }\n\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const chart = this.chart;\n const labels = chart.data.labels || [];\n const value = formatNumber(meta._parsed[index], chart.options.locale);\n\n return {\n label: labels[index] || '',\n value,\n };\n }\n\n getMaxBorderWidth(arcs) {\n let max = 0;\n const chart = this.chart;\n let i, ilen, meta, controller, options;\n\n if (!arcs) {\n // Find the outmost visible dataset\n for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {\n if (chart.isDatasetVisible(i)) {\n meta = chart.getDatasetMeta(i);\n arcs = meta.data;\n controller = meta.controller;\n break;\n }\n }\n }\n\n if (!arcs) {\n return 0;\n }\n\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n options = controller.resolveDataElementOptions(i);\n if (options.borderAlign !== 'inner') {\n max = Math.max(max, options.borderWidth || 0, options.hoverBorderWidth || 0);\n }\n }\n return max;\n }\n\n getMaxOffset(arcs) {\n let max = 0;\n\n for (let i = 0, ilen = arcs.length; i < ilen; ++i) {\n const options = this.resolveDataElementOptions(i);\n max = Math.max(max, options.offset || 0, options.hoverOffset || 0);\n }\n return max;\n }\n\n /**\n\t * Get radius length offset of the dataset in relation to the visible datasets weights. This allows determining the inner and outer radius correctly\n\t * @private\n\t */\n _getRingWeightOffset(datasetIndex) {\n let ringWeightOffset = 0;\n\n for (let i = 0; i < datasetIndex; ++i) {\n if (this.chart.isDatasetVisible(i)) {\n ringWeightOffset += this._getRingWeight(i);\n }\n }\n\n return ringWeightOffset;\n }\n\n /**\n\t * @private\n\t */\n _getRingWeight(datasetIndex) {\n return Math.max(valueOrDefault(this.chart.data.datasets[datasetIndex].weight, 1), 0);\n }\n\n /**\n\t * Returns the sum of all visible data set weights.\n\t * @private\n\t */\n _getVisibleDatasetWeightTotal() {\n return this._getRingWeightOffset(this.chart.data.datasets.length) || 1;\n }\n}\n","import DatasetController from '../core/core.datasetController';\nimport {valueOrDefault} from '../helpers/helpers.core';\n\nexport default class BubbleController extends DatasetController {\n\n static id = 'bubble';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'point',\n\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'borderWidth', 'radius']\n }\n }\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n }\n };\n\n initialize() {\n this.enableOptionSharing = true;\n super.initialize();\n }\n\n /**\n\t * Parse array of primitive values\n\t * @protected\n\t */\n parsePrimitiveData(meta, data, start, count) {\n const parsed = super.parsePrimitiveData(meta, data, start, count);\n for (let i = 0; i < parsed.length; i++) {\n parsed[i]._custom = this.resolveDataElementOptions(i + start).radius;\n }\n return parsed;\n }\n\n /**\n\t * Parse array of arrays\n\t * @protected\n\t */\n parseArrayData(meta, data, start, count) {\n const parsed = super.parseArrayData(meta, data, start, count);\n for (let i = 0; i < parsed.length; i++) {\n const item = data[start + i];\n parsed[i]._custom = valueOrDefault(item[2], this.resolveDataElementOptions(i + start).radius);\n }\n return parsed;\n }\n\n /**\n\t * Parse array of objects\n\t * @protected\n\t */\n parseObjectData(meta, data, start, count) {\n const parsed = super.parseObjectData(meta, data, start, count);\n for (let i = 0; i < parsed.length; i++) {\n const item = data[start + i];\n parsed[i]._custom = valueOrDefault(item && item.r && +item.r, this.resolveDataElementOptions(i + start).radius);\n }\n return parsed;\n }\n\n /**\n\t * @protected\n\t */\n getMaxOverflow() {\n const data = this._cachedMeta.data;\n\n let max = 0;\n for (let i = data.length - 1; i >= 0; --i) {\n max = Math.max(max, data[i].size(this.resolveDataElementOptions(i)) / 2);\n }\n return max > 0 && max;\n }\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const labels = this.chart.data.labels || [];\n const {xScale, yScale} = meta;\n const parsed = this.getParsed(index);\n const x = xScale.getLabelForValue(parsed.x);\n const y = yScale.getLabelForValue(parsed.y);\n const r = parsed._custom;\n\n return {\n label: labels[index] || '',\n value: '(' + x + ', ' + y + (r ? ', ' + r : '') + ')'\n };\n }\n\n update(mode) {\n const points = this._cachedMeta.data;\n\n // Update Points\n this.updateElements(points, 0, points.length, mode);\n }\n\n updateElements(points, start, count, mode) {\n const reset = mode === 'reset';\n const {iScale, vScale} = this._cachedMeta;\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n\n for (let i = start; i < start + count; i++) {\n const point = points[i];\n const parsed = !reset && this.getParsed(i);\n const properties = {};\n const iPixel = properties[iAxis] = reset ? iScale.getPixelForDecimal(0.5) : iScale.getPixelForValue(parsed[iAxis]);\n const vPixel = properties[vAxis] = reset ? vScale.getBasePixel() : vScale.getPixelForValue(parsed[vAxis]);\n\n properties.skip = isNaN(iPixel) || isNaN(vPixel);\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n\n if (reset) {\n properties.options.radius = 0;\n }\n }\n\n this.updateElement(point, i, properties, mode);\n }\n }\n\n /**\n\t * @param {number} index\n\t * @param {string} [mode]\n\t * @protected\n\t */\n resolveDataElementOptions(index, mode) {\n const parsed = this.getParsed(index);\n let values = super.resolveDataElementOptions(index, mode);\n\n // In case values were cached (and thus frozen), we need to clone the values\n if (values.$shared) {\n values = Object.assign({}, values, {$shared: false});\n }\n\n // Custom radius resolution\n const radius = values.radius;\n if (mode !== 'active') {\n values.radius = 0;\n }\n values.radius += valueOrDefault(parsed && parsed._custom, radius);\n\n return values;\n }\n}\n","import DatasetController from '../core/core.datasetController';\nimport {isNullOrUndef} from '../helpers';\nimport {isNumber} from '../helpers/helpers.math';\nimport {_getStartAndCountOfVisiblePoints, _scaleRangesChanged} from '../helpers/helpers.extras';\n\nexport default class LineController extends DatasetController {\n\n static id = 'line';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n\n showLine: true,\n spanGaps: false,\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n scales: {\n _index_: {\n type: 'category',\n },\n _value_: {\n type: 'linear',\n },\n }\n };\n\n initialize() {\n this.enableOptionSharing = true;\n this.supportsDecimation = true;\n super.initialize();\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n const {dataset: line, data: points = [], _dataset} = meta;\n // @ts-ignore\n const animationsDisabled = this.chart._animationsDisabled;\n let {start, count} = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);\n\n this._drawStart = start;\n this._drawCount = count;\n\n if (_scaleRangesChanged(meta)) {\n start = 0;\n count = points.length;\n }\n\n // Update Line\n line._chart = this.chart;\n line._datasetIndex = this.index;\n line._decimated = !!_dataset._decimated;\n line.points = points;\n\n const options = this.resolveDatasetElementOptions(mode);\n if (!this.options.showLine) {\n options.borderWidth = 0;\n }\n options.segment = this.options.segment;\n this.updateElement(line, undefined, {\n animated: !animationsDisabled,\n options\n }, mode);\n\n // Update Points\n this.updateElements(points, start, count, mode);\n }\n\n updateElements(points, start, count, mode) {\n const reset = mode === 'reset';\n const {iScale, vScale, _stacked, _dataset} = this._cachedMeta;\n const {sharedOptions, includeOptions} = this._getSharedOptions(start, mode);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const {spanGaps, segment} = this.options;\n const maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;\n const directUpdate = this.chart._animationsDisabled || reset || mode === 'none';\n const end = start + count;\n const pointsCount = points.length;\n let prevParsed = start > 0 && this.getParsed(start - 1);\n\n for (let i = 0; i < pointsCount; ++i) {\n const point = points[i];\n const properties = directUpdate ? point : {};\n\n if (i < start || i >= end) {\n properties.skip = true;\n continue;\n }\n\n const parsed = this.getParsed(i);\n const nullData = isNullOrUndef(parsed[vAxis]);\n const iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);\n const vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);\n\n properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;\n properties.stop = i > 0 && (Math.abs(parsed[iAxis] - prevParsed[iAxis])) > maxGapLength;\n if (segment) {\n properties.parsed = parsed;\n properties.raw = _dataset.data[i];\n }\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n }\n\n if (!directUpdate) {\n this.updateElement(point, i, properties, mode);\n }\n\n prevParsed = parsed;\n }\n }\n\n /**\n\t * @protected\n\t */\n getMaxOverflow() {\n const meta = this._cachedMeta;\n const dataset = meta.dataset;\n const border = dataset.options && dataset.options.borderWidth || 0;\n const data = meta.data || [];\n if (!data.length) {\n return border;\n }\n const firstPoint = data[0].size(this.resolveDataElementOptions(0));\n const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));\n return Math.max(border, firstPoint, lastPoint) / 2;\n }\n\n draw() {\n const meta = this._cachedMeta;\n meta.dataset.updateControlPoints(this.chart.chartArea, meta.iScale.axis);\n super.draw();\n }\n}\n","import DatasetController from '../core/core.datasetController';\nimport {toRadians, PI, formatNumber, _parseObjectDataRadialScale} from '../helpers/index';\n\nexport default class PolarAreaController extends DatasetController {\n\n static id = 'polarArea';\n\n /**\n * @type {any}\n */\n static defaults = {\n dataElementType: 'arc',\n animation: {\n animateRotate: true,\n animateScale: true\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'startAngle', 'endAngle', 'innerRadius', 'outerRadius']\n },\n },\n indexAxis: 'r',\n startAngle: 0,\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n aspectRatio: 1,\n\n plugins: {\n legend: {\n labels: {\n generateLabels(chart) {\n const data = chart.data;\n if (data.labels.length && data.datasets.length) {\n const {labels: {pointStyle, color}} = chart.legend.options;\n\n return data.labels.map((label, i) => {\n const meta = chart.getDatasetMeta(0);\n const style = meta.controller.getStyle(i);\n\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n fontColor: color,\n lineWidth: style.borderWidth,\n pointStyle: pointStyle,\n hidden: !chart.getDataVisibility(i),\n\n // Extra data used for toggling the correct item\n index: i\n };\n });\n }\n return [];\n }\n },\n\n onClick(e, legendItem, legend) {\n legend.chart.toggleDataVisibility(legendItem.index);\n legend.chart.update();\n }\n }\n },\n\n scales: {\n r: {\n type: 'radialLinear',\n angleLines: {\n display: false\n },\n beginAtZero: true,\n grid: {\n circular: true\n },\n pointLabels: {\n display: false\n },\n startAngle: 0\n }\n }\n };\n\n constructor(chart, datasetIndex) {\n super(chart, datasetIndex);\n\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n }\n\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const chart = this.chart;\n const labels = chart.data.labels || [];\n const value = formatNumber(meta._parsed[index].r, chart.options.locale);\n\n return {\n label: labels[index] || '',\n value,\n };\n }\n\n parseObjectData(meta, data, start, count) {\n return _parseObjectDataRadialScale.bind(this)(meta, data, start, count);\n }\n\n update(mode) {\n const arcs = this._cachedMeta.data;\n\n this._updateRadius();\n this.updateElements(arcs, 0, arcs.length, mode);\n }\n\n /**\n * @protected\n */\n getMinMax() {\n const meta = this._cachedMeta;\n const range = {min: Number.POSITIVE_INFINITY, max: Number.NEGATIVE_INFINITY};\n\n meta.data.forEach((element, index) => {\n const parsed = this.getParsed(index).r;\n\n if (!isNaN(parsed) && this.chart.getDataVisibility(index)) {\n if (parsed < range.min) {\n range.min = parsed;\n }\n\n if (parsed > range.max) {\n range.max = parsed;\n }\n }\n });\n\n return range;\n }\n\n /**\n\t * @private\n\t */\n _updateRadius() {\n const chart = this.chart;\n const chartArea = chart.chartArea;\n const opts = chart.options;\n const minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);\n\n const outerRadius = Math.max(minSize / 2, 0);\n const innerRadius = Math.max(opts.cutoutPercentage ? (outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);\n const radiusLength = (outerRadius - innerRadius) / chart.getVisibleDatasetCount();\n\n this.outerRadius = outerRadius - (radiusLength * this.index);\n this.innerRadius = this.outerRadius - radiusLength;\n }\n\n updateElements(arcs, start, count, mode) {\n const reset = mode === 'reset';\n const chart = this.chart;\n const opts = chart.options;\n const animationOpts = opts.animation;\n const scale = this._cachedMeta.rScale;\n const centerX = scale.xCenter;\n const centerY = scale.yCenter;\n const datasetStartAngle = scale.getIndexAngle(0) - 0.5 * PI;\n let angle = datasetStartAngle;\n let i;\n\n const defaultAngle = 360 / this.countVisibleElements();\n\n for (i = 0; i < start; ++i) {\n angle += this._computeAngle(i, mode, defaultAngle);\n }\n for (i = start; i < start + count; i++) {\n const arc = arcs[i];\n let startAngle = angle;\n let endAngle = angle + this._computeAngle(i, mode, defaultAngle);\n let outerRadius = chart.getDataVisibility(i) ? scale.getDistanceFromCenterForValue(this.getParsed(i).r) : 0;\n angle = endAngle;\n\n if (reset) {\n if (animationOpts.animateScale) {\n outerRadius = 0;\n }\n if (animationOpts.animateRotate) {\n startAngle = endAngle = datasetStartAngle;\n }\n }\n\n const properties = {\n x: centerX,\n y: centerY,\n innerRadius: 0,\n outerRadius,\n startAngle,\n endAngle,\n options: this.resolveDataElementOptions(i, arc.active ? 'active' : mode)\n };\n\n this.updateElement(arc, i, properties, mode);\n }\n }\n\n countVisibleElements() {\n const meta = this._cachedMeta;\n let count = 0;\n\n meta.data.forEach((element, index) => {\n if (!isNaN(this.getParsed(index).r) && this.chart.getDataVisibility(index)) {\n count++;\n }\n });\n\n return count;\n }\n\n /**\n\t * @private\n\t */\n _computeAngle(index, mode, defaultAngle) {\n return this.chart.getDataVisibility(index)\n ? toRadians(this.resolveDataElementOptions(index, mode).angle || defaultAngle)\n : 0;\n }\n}\n","import DoughnutController from './controller.doughnut';\n\n// Pie charts are Doughnut chart with different defaults\nexport default class PieController extends DoughnutController {\n\n static id = 'pie';\n\n /**\n * @type {any}\n */\n static defaults = {\n // The percentage of the chart that we cut out of the middle.\n cutout: 0,\n\n // The rotation of the chart, where the first data arc begins.\n rotation: 0,\n\n // The total circumference of the chart.\n circumference: 360,\n\n // The outr radius of the chart\n radius: '100%'\n };\n}\n","import DatasetController from '../core/core.datasetController';\nimport {_parseObjectDataRadialScale} from '../helpers/index';\n\nexport default class RadarController extends DatasetController {\n\n static id = 'radar';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: 'line',\n dataElementType: 'point',\n indexAxis: 'r',\n showLine: true,\n elements: {\n line: {\n fill: 'start'\n }\n },\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n aspectRatio: 1,\n\n scales: {\n r: {\n type: 'radialLinear',\n }\n }\n };\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const vScale = this._cachedMeta.vScale;\n const parsed = this.getParsed(index);\n\n return {\n label: vScale.getLabels()[index],\n value: '' + vScale.getLabelForValue(parsed[vScale.axis])\n };\n }\n\n parseObjectData(meta, data, start, count) {\n return _parseObjectDataRadialScale.bind(this)(meta, data, start, count);\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n const line = meta.dataset;\n const points = meta.data || [];\n const labels = meta.iScale.getLabels();\n\n // Update Line\n line.points = points;\n // In resize mode only point locations change, so no need to set the points or options.\n if (mode !== 'resize') {\n const options = this.resolveDatasetElementOptions(mode);\n if (!this.options.showLine) {\n options.borderWidth = 0;\n }\n\n const properties = {\n _loop: true,\n _fullLoop: labels.length === points.length,\n options\n };\n\n this.updateElement(line, undefined, properties, mode);\n }\n\n // Update Points\n this.updateElements(points, 0, points.length, mode);\n }\n\n updateElements(points, start, count, mode) {\n const scale = this._cachedMeta.rScale;\n const reset = mode === 'reset';\n\n for (let i = start; i < start + count; i++) {\n const point = points[i];\n const options = this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n const pointPosition = scale.getPointPositionForValue(i, this.getParsed(i).r);\n\n const x = reset ? scale.xCenter : pointPosition.x;\n const y = reset ? scale.yCenter : pointPosition.y;\n\n const properties = {\n x,\n y,\n angle: pointPosition.angle,\n skip: isNaN(x) || isNaN(y),\n options\n };\n\n this.updateElement(point, i, properties, mode);\n }\n }\n}\n","import DatasetController from '../core/core.datasetController';\nimport {isNullOrUndef} from '../helpers';\nimport {isNumber} from '../helpers/helpers.math';\nimport {_getStartAndCountOfVisiblePoints, _scaleRangesChanged} from '../helpers/helpers.extras';\n\nexport default class ScatterController extends DatasetController {\n\n static id = 'scatter';\n\n /**\n * @type {any}\n */\n static defaults = {\n datasetElementType: false,\n dataElementType: 'point',\n showLine: false,\n fill: false\n };\n\n /**\n * @type {any}\n */\n static overrides = {\n\n interaction: {\n mode: 'point'\n },\n\n scales: {\n x: {\n type: 'linear'\n },\n y: {\n type: 'linear'\n }\n }\n };\n\n /**\n\t * @protected\n\t */\n getLabelAndValue(index) {\n const meta = this._cachedMeta;\n const labels = this.chart.data.labels || [];\n const {xScale, yScale} = meta;\n const parsed = this.getParsed(index);\n const x = xScale.getLabelForValue(parsed.x);\n const y = yScale.getLabelForValue(parsed.y);\n\n return {\n label: labels[index] || '',\n value: '(' + x + ', ' + y + ')'\n };\n }\n\n update(mode) {\n const meta = this._cachedMeta;\n const {data: points = []} = meta;\n // @ts-ignore\n const animationsDisabled = this.chart._animationsDisabled;\n let {start, count} = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);\n\n this._drawStart = start;\n this._drawCount = count;\n\n if (_scaleRangesChanged(meta)) {\n start = 0;\n count = points.length;\n }\n\n if (this.options.showLine) {\n\n const {dataset: line, _dataset} = meta;\n\n // Update Line\n line._chart = this.chart;\n line._datasetIndex = this.index;\n line._decimated = !!_dataset._decimated;\n line.points = points;\n\n const options = this.resolveDatasetElementOptions(mode);\n options.segment = this.options.segment;\n this.updateElement(line, undefined, {\n animated: !animationsDisabled,\n options\n }, mode);\n }\n\n // Update Points\n this.updateElements(points, start, count, mode);\n }\n\n addElements() {\n const {showLine} = this.options;\n\n if (!this.datasetElementType && showLine) {\n this.datasetElementType = this.chart.registry.getElement('line');\n }\n\n super.addElements();\n }\n\n updateElements(points, start, count, mode) {\n const reset = mode === 'reset';\n const {iScale, vScale, _stacked, _dataset} = this._cachedMeta;\n const firstOpts = this.resolveDataElementOptions(start, mode);\n const sharedOptions = this.getSharedOptions(firstOpts);\n const includeOptions = this.includeOptions(mode, sharedOptions);\n const iAxis = iScale.axis;\n const vAxis = vScale.axis;\n const {spanGaps, segment} = this.options;\n const maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;\n const directUpdate = this.chart._animationsDisabled || reset || mode === 'none';\n let prevParsed = start > 0 && this.getParsed(start - 1);\n\n for (let i = start; i < start + count; ++i) {\n const point = points[i];\n const parsed = this.getParsed(i);\n const properties = directUpdate ? point : {};\n const nullData = isNullOrUndef(parsed[vAxis]);\n const iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i);\n const vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i);\n\n properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;\n properties.stop = i > 0 && (Math.abs(parsed[iAxis] - prevParsed[iAxis])) > maxGapLength;\n if (segment) {\n properties.parsed = parsed;\n properties.raw = _dataset.data[i];\n }\n\n if (includeOptions) {\n properties.options = sharedOptions || this.resolveDataElementOptions(i, point.active ? 'active' : mode);\n }\n\n if (!directUpdate) {\n this.updateElement(point, i, properties, mode);\n }\n\n prevParsed = parsed;\n }\n\n this.updateSharedOptions(sharedOptions, mode, firstOpts);\n }\n\n /**\n\t * @protected\n\t */\n getMaxOverflow() {\n const meta = this._cachedMeta;\n const data = meta.data || [];\n\n if (!this.options.showLine) {\n let max = 0;\n for (let i = data.length - 1; i >= 0; --i) {\n max = Math.max(max, data[i].size(this.resolveDataElementOptions(i)) / 2);\n }\n return max > 0 && max;\n }\n\n const dataset = meta.dataset;\n const border = dataset.options && dataset.options.borderWidth || 0;\n\n if (!data.length) {\n return border;\n }\n\n const firstPoint = data[0].size(this.resolveDataElementOptions(0));\n const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));\n return Math.max(border, firstPoint, lastPoint) / 2;\n }\n}\n","import Element from '../core/core.element';\nimport {_angleBetween, getAngleFromPoint, TAU, HALF_PI, valueOrDefault} from '../helpers/index';\nimport {PI, _isBetween, _limitValue} from '../helpers/helpers.math';\nimport {_readValueToProps} from '../helpers/helpers.options';\nimport type {ArcOptions, Point} from '../../types';\n\n\nfunction clipArc(ctx: CanvasRenderingContext2D, element: ArcElement, endAngle: number) {\n const {startAngle, pixelMargin, x, y, outerRadius, innerRadius} = element;\n let angleMargin = pixelMargin / outerRadius;\n\n // Draw an inner border by clipping the arc and drawing a double-width border\n // Enlarge the clipping arc by 0.33 pixels to eliminate glitches between borders\n ctx.beginPath();\n ctx.arc(x, y, outerRadius, startAngle - angleMargin, endAngle + angleMargin);\n if (innerRadius > pixelMargin) {\n angleMargin = pixelMargin / innerRadius;\n ctx.arc(x, y, innerRadius, endAngle + angleMargin, startAngle - angleMargin, true);\n } else {\n ctx.arc(x, y, pixelMargin, endAngle + HALF_PI, startAngle - HALF_PI);\n }\n ctx.closePath();\n ctx.clip();\n}\n\nfunction toRadiusCorners(value) {\n return _readValueToProps(value, ['outerStart', 'outerEnd', 'innerStart', 'innerEnd']);\n}\n\n/**\n * Parse border radius from the provided options\n */\nfunction parseBorderRadius(arc: ArcElement, innerRadius: number, outerRadius: number, angleDelta: number) {\n const o = toRadiusCorners(arc.options.borderRadius);\n const halfThickness = (outerRadius - innerRadius) / 2;\n const innerLimit = Math.min(halfThickness, angleDelta * innerRadius / 2);\n\n // Outer limits are complicated. We want to compute the available angular distance at\n // a radius of outerRadius - borderRadius because for small angular distances, this term limits.\n // We compute at r = outerRadius - borderRadius because this circle defines the center of the border corners.\n //\n // If the borderRadius is large, that value can become negative.\n // This causes the outer borders to lose their radius entirely, which is rather unexpected. To solve that, if borderRadius > outerRadius\n // we know that the thickness term will dominate and compute the limits at that point\n const computeOuterLimit = (val) => {\n const outerArcLimit = (outerRadius - Math.min(halfThickness, val)) * angleDelta / 2;\n return _limitValue(val, 0, Math.min(halfThickness, outerArcLimit));\n };\n\n return {\n outerStart: computeOuterLimit(o.outerStart),\n outerEnd: computeOuterLimit(o.outerEnd),\n innerStart: _limitValue(o.innerStart, 0, innerLimit),\n innerEnd: _limitValue(o.innerEnd, 0, innerLimit),\n };\n}\n\n/**\n * Convert (r, 𝜃) to (x, y)\n */\nfunction rThetaToXY(r: number, theta: number, x: number, y: number) {\n return {\n x: x + r * Math.cos(theta),\n y: y + r * Math.sin(theta),\n };\n}\n\n\n/**\n * Path the arc, respecting border radius by separating into left and right halves.\n *\n * Start End\n *\n * 1--->a--->2 Outer\n * / \\\n * 8 3\n * | |\n * | |\n * 7 4\n * \\ /\n * 6<---b<---5 Inner\n */\nfunction pathArc(\n ctx: CanvasRenderingContext2D,\n element: ArcElement,\n offset: number,\n spacing: number,\n end: number,\n circular: boolean,\n) {\n const {x, y, startAngle: start, pixelMargin, innerRadius: innerR} = element;\n\n const outerRadius = Math.max(element.outerRadius + spacing + offset - pixelMargin, 0);\n const innerRadius = innerR > 0 ? innerR + spacing + offset + pixelMargin : 0;\n\n let spacingOffset = 0;\n const alpha = end - start;\n\n if (spacing) {\n // When spacing is present, it is the same for all items\n // So we adjust the start and end angle of the arc such that\n // the distance is the same as it would be without the spacing\n const noSpacingInnerRadius = innerR > 0 ? innerR - spacing : 0;\n const noSpacingOuterRadius = outerRadius > 0 ? outerRadius - spacing : 0;\n const avNogSpacingRadius = (noSpacingInnerRadius + noSpacingOuterRadius) / 2;\n const adjustedAngle = avNogSpacingRadius !== 0 ? (alpha * avNogSpacingRadius) / (avNogSpacingRadius + spacing) : alpha;\n spacingOffset = (alpha - adjustedAngle) / 2;\n }\n\n const beta = Math.max(0.001, alpha * outerRadius - offset / PI) / outerRadius;\n const angleOffset = (alpha - beta) / 2;\n const startAngle = start + angleOffset + spacingOffset;\n const endAngle = end - angleOffset - spacingOffset;\n const {outerStart, outerEnd, innerStart, innerEnd} = parseBorderRadius(element, innerRadius, outerRadius, endAngle - startAngle);\n\n const outerStartAdjustedRadius = outerRadius - outerStart;\n const outerEndAdjustedRadius = outerRadius - outerEnd;\n const outerStartAdjustedAngle = startAngle + outerStart / outerStartAdjustedRadius;\n const outerEndAdjustedAngle = endAngle - outerEnd / outerEndAdjustedRadius;\n\n const innerStartAdjustedRadius = innerRadius + innerStart;\n const innerEndAdjustedRadius = innerRadius + innerEnd;\n const innerStartAdjustedAngle = startAngle + innerStart / innerStartAdjustedRadius;\n const innerEndAdjustedAngle = endAngle - innerEnd / innerEndAdjustedRadius;\n\n ctx.beginPath();\n\n if (circular) {\n // The first arc segments from point 1 to point a to point 2\n const outerMidAdjustedAngle = (outerStartAdjustedAngle + outerEndAdjustedAngle) / 2;\n ctx.arc(x, y, outerRadius, outerStartAdjustedAngle, outerMidAdjustedAngle);\n ctx.arc(x, y, outerRadius, outerMidAdjustedAngle, outerEndAdjustedAngle);\n\n // The corner segment from point 2 to point 3\n if (outerEnd > 0) {\n const pCenter = rThetaToXY(outerEndAdjustedRadius, outerEndAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, outerEnd, outerEndAdjustedAngle, endAngle + HALF_PI);\n }\n\n // The line from point 3 to point 4\n const p4 = rThetaToXY(innerEndAdjustedRadius, endAngle, x, y);\n ctx.lineTo(p4.x, p4.y);\n\n // The corner segment from point 4 to point 5\n if (innerEnd > 0) {\n const pCenter = rThetaToXY(innerEndAdjustedRadius, innerEndAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, innerEnd, endAngle + HALF_PI, innerEndAdjustedAngle + Math.PI);\n }\n\n // The inner arc from point 5 to point b to point 6\n const innerMidAdjustedAngle = ((endAngle - (innerEnd / innerRadius)) + (startAngle + (innerStart / innerRadius))) / 2;\n ctx.arc(x, y, innerRadius, endAngle - (innerEnd / innerRadius), innerMidAdjustedAngle, true);\n ctx.arc(x, y, innerRadius, innerMidAdjustedAngle, startAngle + (innerStart / innerRadius), true);\n\n // The corner segment from point 6 to point 7\n if (innerStart > 0) {\n const pCenter = rThetaToXY(innerStartAdjustedRadius, innerStartAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, innerStart, innerStartAdjustedAngle + Math.PI, startAngle - HALF_PI);\n }\n\n // The line from point 7 to point 8\n const p8 = rThetaToXY(outerStartAdjustedRadius, startAngle, x, y);\n ctx.lineTo(p8.x, p8.y);\n\n // The corner segment from point 8 to point 1\n if (outerStart > 0) {\n const pCenter = rThetaToXY(outerStartAdjustedRadius, outerStartAdjustedAngle, x, y);\n ctx.arc(pCenter.x, pCenter.y, outerStart, startAngle - HALF_PI, outerStartAdjustedAngle);\n }\n } else {\n ctx.moveTo(x, y);\n\n const outerStartX = Math.cos(outerStartAdjustedAngle) * outerRadius + x;\n const outerStartY = Math.sin(outerStartAdjustedAngle) * outerRadius + y;\n ctx.lineTo(outerStartX, outerStartY);\n\n const outerEndX = Math.cos(outerEndAdjustedAngle) * outerRadius + x;\n const outerEndY = Math.sin(outerEndAdjustedAngle) * outerRadius + y;\n ctx.lineTo(outerEndX, outerEndY);\n }\n\n ctx.closePath();\n}\n\nfunction drawArc(\n ctx: CanvasRenderingContext2D,\n element: ArcElement,\n offset: number,\n spacing: number,\n circular: boolean,\n) {\n const {fullCircles, startAngle, circumference} = element;\n let endAngle = element.endAngle;\n if (fullCircles) {\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n for (let i = 0; i < fullCircles; ++i) {\n ctx.fill();\n }\n if (!isNaN(circumference)) {\n endAngle = startAngle + (circumference % TAU || TAU);\n }\n }\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n ctx.fill();\n return endAngle;\n}\n\nfunction drawBorder(\n ctx: CanvasRenderingContext2D,\n element: ArcElement,\n offset: number,\n spacing: number,\n circular: boolean,\n) {\n const {fullCircles, startAngle, circumference, options} = element;\n const {borderWidth, borderJoinStyle} = options;\n const inner = options.borderAlign === 'inner';\n\n if (!borderWidth) {\n return;\n }\n\n if (inner) {\n ctx.lineWidth = borderWidth * 2;\n ctx.lineJoin = borderJoinStyle || 'round';\n } else {\n ctx.lineWidth = borderWidth;\n ctx.lineJoin = borderJoinStyle || 'bevel';\n }\n\n let endAngle = element.endAngle;\n if (fullCircles) {\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n for (let i = 0; i < fullCircles; ++i) {\n ctx.stroke();\n }\n if (!isNaN(circumference)) {\n endAngle = startAngle + (circumference % TAU || TAU);\n }\n }\n\n if (inner) {\n clipArc(ctx, element, endAngle);\n }\n\n if (!fullCircles) {\n pathArc(ctx, element, offset, spacing, endAngle, circular);\n ctx.stroke();\n }\n}\n\nexport interface ArcProps extends Point {\n startAngle: number;\n endAngle: number;\n innerRadius: number;\n outerRadius: number;\n circumference: number;\n}\n\nexport default class ArcElement extends Element {\n\n static id = 'arc';\n\n static defaults = {\n borderAlign: 'center',\n borderColor: '#fff',\n borderJoinStyle: undefined,\n borderRadius: 0,\n borderWidth: 2,\n offset: 0,\n spacing: 0,\n angle: undefined,\n circular: true,\n };\n\n static defaultRoutes = {\n backgroundColor: 'backgroundColor'\n };\n\n circumference: number;\n endAngle: number;\n fullCircles: number;\n innerRadius: number;\n outerRadius: number;\n pixelMargin: number;\n startAngle: number;\n\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.circumference = undefined;\n this.startAngle = undefined;\n this.endAngle = undefined;\n this.innerRadius = undefined;\n this.outerRadius = undefined;\n this.pixelMargin = 0;\n this.fullCircles = 0;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n inRange(chartX: number, chartY: number, useFinalPosition: boolean) {\n const point = this.getProps(['x', 'y'], useFinalPosition);\n const {angle, distance} = getAngleFromPoint(point, {x: chartX, y: chartY});\n const {startAngle, endAngle, innerRadius, outerRadius, circumference} = this.getProps([\n 'startAngle',\n 'endAngle',\n 'innerRadius',\n 'outerRadius',\n 'circumference'\n ], useFinalPosition);\n const rAdjust = this.options.spacing / 2;\n const _circumference = valueOrDefault(circumference, endAngle - startAngle);\n const betweenAngles = _circumference >= TAU || _angleBetween(angle, startAngle, endAngle);\n const withinRadius = _isBetween(distance, innerRadius + rAdjust, outerRadius + rAdjust);\n\n return (betweenAngles && withinRadius);\n }\n\n getCenterPoint(useFinalPosition: boolean) {\n const {x, y, startAngle, endAngle, innerRadius, outerRadius} = this.getProps([\n 'x',\n 'y',\n 'startAngle',\n 'endAngle',\n 'innerRadius',\n 'outerRadius',\n 'circumference',\n ], useFinalPosition);\n const {offset, spacing} = this.options;\n const halfAngle = (startAngle + endAngle) / 2;\n const halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;\n return {\n x: x + Math.cos(halfAngle) * halfRadius,\n y: y + Math.sin(halfAngle) * halfRadius\n };\n }\n\n tooltipPosition(useFinalPosition: boolean) {\n return this.getCenterPoint(useFinalPosition);\n }\n\n draw(ctx: CanvasRenderingContext2D) {\n const {options, circumference} = this;\n const offset = (options.offset || 0) / 4;\n const spacing = (options.spacing || 0) / 2;\n const circular = options.circular;\n this.pixelMargin = (options.borderAlign === 'inner') ? 0.33 : 0;\n this.fullCircles = circumference > TAU ? Math.floor(circumference / TAU) : 0;\n\n if (circumference === 0 || this.innerRadius < 0 || this.outerRadius < 0) {\n return;\n }\n\n ctx.save();\n\n const halfAngle = (this.startAngle + this.endAngle) / 2;\n ctx.translate(Math.cos(halfAngle) * offset, Math.sin(halfAngle) * offset);\n const fix = 1 - Math.sin(Math.min(PI, circumference || 0));\n const radiusOffset = offset * fix;\n\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n\n drawArc(ctx, this, radiusOffset, spacing, circular);\n drawBorder(ctx, this, radiusOffset, spacing, circular);\n\n ctx.restore();\n }\n}\n","import Element from '../core/core.element';\nimport {_bezierInterpolation, _pointInLine, _steppedInterpolation} from '../helpers/helpers.interpolation';\nimport {_computeSegments, _boundSegments} from '../helpers/helpers.segment';\nimport {_steppedLineTo, _bezierCurveTo} from '../helpers/helpers.canvas';\nimport {_updateBezierControlPoints} from '../helpers/helpers.curve';\nimport {valueOrDefault} from '../helpers';\n\n/**\n * @typedef { import(\"./element.point\").default } PointElement\n */\n\nfunction setStyle(ctx, options, style = options) {\n ctx.lineCap = valueOrDefault(style.borderCapStyle, options.borderCapStyle);\n ctx.setLineDash(valueOrDefault(style.borderDash, options.borderDash));\n ctx.lineDashOffset = valueOrDefault(style.borderDashOffset, options.borderDashOffset);\n ctx.lineJoin = valueOrDefault(style.borderJoinStyle, options.borderJoinStyle);\n ctx.lineWidth = valueOrDefault(style.borderWidth, options.borderWidth);\n ctx.strokeStyle = valueOrDefault(style.borderColor, options.borderColor);\n}\n\nfunction lineTo(ctx, previous, target) {\n ctx.lineTo(target.x, target.y);\n}\n\nfunction getLineMethod(options) {\n if (options.stepped) {\n return _steppedLineTo;\n }\n\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierCurveTo;\n }\n\n return lineTo;\n}\n\nfunction pathVars(points, segment, params = {}) {\n const count = points.length;\n const {start: paramsStart = 0, end: paramsEnd = count - 1} = params;\n const {start: segmentStart, end: segmentEnd} = segment;\n const start = Math.max(paramsStart, segmentStart);\n const end = Math.min(paramsEnd, segmentEnd);\n const outside = paramsStart < segmentStart && paramsEnd < segmentStart || paramsStart > segmentEnd && paramsEnd > segmentEnd;\n\n return {\n count,\n start,\n loop: segment.loop,\n ilen: end < start && !outside ? count + end - start : end - start\n };\n}\n\n/**\n * Create path from points, grouping by truncated x-coordinate\n * Points need to be in order by x-coordinate for this to work efficiently\n * @param {CanvasRenderingContext2D|Path2D} ctx - Context\n * @param {LineElement} line\n * @param {object} segment\n * @param {number} segment.start - start index of the segment, referring the points array\n * @param {number} segment.end - end index of the segment, referring the points array\n * @param {boolean} segment.loop - indicates that the segment is a loop\n * @param {object} params\n * @param {boolean} params.move - move to starting point (vs line to it)\n * @param {boolean} params.reverse - path the segment from end to start\n * @param {number} params.start - limit segment to points starting from `start` index\n * @param {number} params.end - limit segment to points ending at `start` + `count` index\n */\nfunction pathSegment(ctx, line, segment, params) {\n const {points, options} = line;\n const {count, start, loop, ilen} = pathVars(points, segment, params);\n const lineMethod = getLineMethod(options);\n // eslint-disable-next-line prefer-const\n let {move = true, reverse} = params || {};\n let i, point, prev;\n\n for (i = 0; i <= ilen; ++i) {\n point = points[(start + (reverse ? ilen - i : i)) % count];\n\n if (point.skip) {\n // If there is a skipped point inside a segment, spanGaps must be true\n continue;\n } else if (move) {\n ctx.moveTo(point.x, point.y);\n move = false;\n } else {\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n\n prev = point;\n }\n\n if (loop) {\n point = points[(start + (reverse ? ilen : 0)) % count];\n lineMethod(ctx, prev, point, reverse, options.stepped);\n }\n\n return !!loop;\n}\n\n/**\n * Create path from points, grouping by truncated x-coordinate\n * Points need to be in order by x-coordinate for this to work efficiently\n * @param {CanvasRenderingContext2D|Path2D} ctx - Context\n * @param {LineElement} line\n * @param {object} segment\n * @param {number} segment.start - start index of the segment, referring the points array\n * @param {number} segment.end - end index of the segment, referring the points array\n * @param {boolean} segment.loop - indicates that the segment is a loop\n * @param {object} params\n * @param {boolean} params.move - move to starting point (vs line to it)\n * @param {boolean} params.reverse - path the segment from end to start\n * @param {number} params.start - limit segment to points starting from `start` index\n * @param {number} params.end - limit segment to points ending at `start` + `count` index\n */\nfunction fastPathSegment(ctx, line, segment, params) {\n const points = line.points;\n const {count, start, ilen} = pathVars(points, segment, params);\n const {move = true, reverse} = params || {};\n let avgX = 0;\n let countX = 0;\n let i, point, prevX, minY, maxY, lastY;\n\n const pointIndex = (index) => (start + (reverse ? ilen - index : index)) % count;\n const drawX = () => {\n if (minY !== maxY) {\n // Draw line to maxY and minY, using the average x-coordinate\n ctx.lineTo(avgX, maxY);\n ctx.lineTo(avgX, minY);\n // Line to y-value of last point in group. So the line continues\n // from correct position. Not using move, to have solid path.\n ctx.lineTo(avgX, lastY);\n }\n };\n\n if (move) {\n point = points[pointIndex(0)];\n ctx.moveTo(point.x, point.y);\n }\n\n for (i = 0; i <= ilen; ++i) {\n point = points[pointIndex(i)];\n\n if (point.skip) {\n // If there is a skipped point inside a segment, spanGaps must be true\n continue;\n }\n\n const x = point.x;\n const y = point.y;\n const truncX = x | 0; // truncated x-coordinate\n\n if (truncX === prevX) {\n // Determine `minY` / `maxY` and `avgX` while we stay within same x-position\n if (y < minY) {\n minY = y;\n } else if (y > maxY) {\n maxY = y;\n }\n // For first point in group, countX is `0`, so average will be `x` / 1.\n avgX = (countX * avgX + x) / ++countX;\n } else {\n drawX();\n // Draw line to next x-position, using the first (or only)\n // y-value in that group\n ctx.lineTo(x, y);\n\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n }\n // Keep track of the last y-value in group\n lastY = y;\n }\n drawX();\n}\n\n/**\n * @param {LineElement} line - the line\n * @returns {function}\n * @private\n */\nfunction _getSegmentMethod(line) {\n const opts = line.options;\n const borderDash = opts.borderDash && opts.borderDash.length;\n const useFastPath = !line._decimated && !line._loop && !opts.tension && opts.cubicInterpolationMode !== 'monotone' && !opts.stepped && !borderDash;\n return useFastPath ? fastPathSegment : pathSegment;\n}\n\n/**\n * @private\n */\nfunction _getInterpolationMethod(options) {\n if (options.stepped) {\n return _steppedInterpolation;\n }\n\n if (options.tension || options.cubicInterpolationMode === 'monotone') {\n return _bezierInterpolation;\n }\n\n return _pointInLine;\n}\n\nfunction strokePathWithCache(ctx, line, start, count) {\n let path = line._path;\n if (!path) {\n path = line._path = new Path2D();\n if (line.path(path, start, count)) {\n path.closePath();\n }\n }\n setStyle(ctx, line.options);\n ctx.stroke(path);\n}\n\nfunction strokePathDirect(ctx, line, start, count) {\n const {segments, options} = line;\n const segmentMethod = _getSegmentMethod(line);\n\n for (const segment of segments) {\n setStyle(ctx, options, segment.style);\n ctx.beginPath();\n if (segmentMethod(ctx, line, segment, {start, end: start + count - 1})) {\n ctx.closePath();\n }\n ctx.stroke();\n }\n}\n\nconst usePath2D = typeof Path2D === 'function';\n\nfunction draw(ctx, line, start, count) {\n if (usePath2D && !line.options.segment) {\n strokePathWithCache(ctx, line, start, count);\n } else {\n strokePathDirect(ctx, line, start, count);\n }\n}\n\nexport default class LineElement extends Element {\n\n static id = 'line';\n\n /**\n * @type {any}\n */\n static defaults = {\n borderCapStyle: 'butt',\n borderDash: [],\n borderDashOffset: 0,\n borderJoinStyle: 'miter',\n borderWidth: 3,\n capBezierPoints: true,\n cubicInterpolationMode: 'default',\n fill: false,\n spanGaps: false,\n stepped: false,\n tension: 0,\n };\n\n /**\n * @type {any}\n */\n static defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n };\n\n\n static descriptors = {\n _scriptable: true,\n _indexable: (name) => name !== 'borderDash' && name !== 'fill',\n };\n\n\n constructor(cfg) {\n super();\n\n this.animated = true;\n this.options = undefined;\n this._chart = undefined;\n this._loop = undefined;\n this._fullLoop = undefined;\n this._path = undefined;\n this._points = undefined;\n this._segments = undefined;\n this._decimated = false;\n this._pointsUpdated = false;\n this._datasetIndex = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n updateControlPoints(chartArea, indexAxis) {\n const options = this.options;\n if ((options.tension || options.cubicInterpolationMode === 'monotone') && !options.stepped && !this._pointsUpdated) {\n const loop = options.spanGaps ? this._loop : this._fullLoop;\n _updateBezierControlPoints(this._points, options, chartArea, loop, indexAxis);\n this._pointsUpdated = true;\n }\n }\n\n set points(points) {\n this._points = points;\n delete this._segments;\n delete this._path;\n this._pointsUpdated = false;\n }\n\n get points() {\n return this._points;\n }\n\n get segments() {\n return this._segments || (this._segments = _computeSegments(this, this.options.segment));\n }\n\n /**\n\t * First non-skipped point on this line\n\t * @returns {PointElement|undefined}\n\t */\n first() {\n const segments = this.segments;\n const points = this.points;\n return segments.length && points[segments[0].start];\n }\n\n /**\n\t * Last non-skipped point on this line\n\t * @returns {PointElement|undefined}\n\t */\n last() {\n const segments = this.segments;\n const points = this.points;\n const count = segments.length;\n return count && points[segments[count - 1].end];\n }\n\n /**\n\t * Interpolate a point in this line at the same value on `property` as\n\t * the reference `point` provided\n\t * @param {PointElement} point - the reference point\n\t * @param {string} property - the property to match on\n\t * @returns {PointElement|undefined}\n\t */\n interpolate(point, property) {\n const options = this.options;\n const value = point[property];\n const points = this.points;\n const segments = _boundSegments(this, {property, start: value, end: value});\n\n if (!segments.length) {\n return;\n }\n\n const result = [];\n const _interpolate = _getInterpolationMethod(options);\n let i, ilen;\n for (i = 0, ilen = segments.length; i < ilen; ++i) {\n const {start, end} = segments[i];\n const p1 = points[start];\n const p2 = points[end];\n if (p1 === p2) {\n result.push(p1);\n continue;\n }\n const t = Math.abs((value - p1[property]) / (p2[property] - p1[property]));\n const interpolated = _interpolate(p1, p2, t, options.stepped);\n interpolated[property] = point[property];\n result.push(interpolated);\n }\n return result.length === 1 ? result[0] : result;\n }\n\n /**\n\t * Append a segment of this line to current path.\n\t * @param {CanvasRenderingContext2D} ctx\n\t * @param {object} segment\n\t * @param {number} segment.start - start index of the segment, referring the points array\n \t * @param {number} segment.end - end index of the segment, referring the points array\n \t * @param {boolean} segment.loop - indicates that the segment is a loop\n\t * @param {object} params\n\t * @param {boolean} params.move - move to starting point (vs line to it)\n\t * @param {boolean} params.reverse - path the segment from end to start\n\t * @param {number} params.start - limit segment to points starting from `start` index\n\t * @param {number} params.end - limit segment to points ending at `start` + `count` index\n\t * @returns {undefined|boolean} - true if the segment is a full loop (path should be closed)\n\t */\n pathSegment(ctx, segment, params) {\n const segmentMethod = _getSegmentMethod(this);\n return segmentMethod(ctx, this, segment, params);\n }\n\n /**\n\t * Append all segments of this line to current path.\n\t * @param {CanvasRenderingContext2D|Path2D} ctx\n\t * @param {number} [start]\n\t * @param {number} [count]\n\t * @returns {undefined|boolean} - true if line is a full loop (path should be closed)\n\t */\n path(ctx, start, count) {\n const segments = this.segments;\n const segmentMethod = _getSegmentMethod(this);\n let loop = this._loop;\n\n start = start || 0;\n count = count || (this.points.length - start);\n\n for (const segment of segments) {\n loop &= segmentMethod(ctx, this, segment, {start, end: start + count - 1});\n }\n return !!loop;\n }\n\n /**\n\t * Draw\n\t * @param {CanvasRenderingContext2D} ctx\n\t * @param {object} chartArea\n\t * @param {number} [start]\n\t * @param {number} [count]\n\t */\n draw(ctx, chartArea, start, count) {\n const options = this.options || {};\n const points = this.points || [];\n\n if (points.length && options.borderWidth) {\n ctx.save();\n\n draw(ctx, this, start, count);\n\n ctx.restore();\n }\n\n if (this.animated) {\n // When line is animated, the control points and path are not cached.\n this._pointsUpdated = false;\n this._path = undefined;\n }\n }\n}\n","import Element from '../core/core.element';\nimport {drawPoint, _isPointInArea} from '../helpers/helpers.canvas';\nimport {\n type CartesianParsedData,\n type ChartArea,\n type Point,\n type PointHoverOptions,\n type PointOptions,\n} from '../../types';\n\nfunction inRange(el: PointElement, pos: number, axis: 'x' | 'y', useFinalPosition?: boolean) {\n const options = el.options;\n const {[axis]: value} = el.getProps([axis], useFinalPosition);\n\n return (Math.abs(pos - value) < options.radius + options.hitRadius);\n}\n\nexport type PointProps = Point\n\nexport default class PointElement extends Element {\n\n static id = 'point';\n\n parsed: CartesianParsedData;\n skip?: boolean;\n stop?: boolean;\n\n /**\n * @type {any}\n */\n static defaults = {\n borderWidth: 1,\n hitRadius: 1,\n hoverBorderWidth: 1,\n hoverRadius: 4,\n pointStyle: 'circle',\n radius: 3,\n rotation: 0\n };\n\n /**\n * @type {any}\n */\n static defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n };\n\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.parsed = undefined;\n this.skip = undefined;\n this.stop = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n inRange(mouseX: number, mouseY: number, useFinalPosition?: boolean) {\n const options = this.options;\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return ((Math.pow(mouseX - x, 2) + Math.pow(mouseY - y, 2)) < Math.pow(options.hitRadius + options.radius, 2));\n }\n\n inXRange(mouseX: number, useFinalPosition?: boolean) {\n return inRange(this, mouseX, 'x', useFinalPosition);\n }\n\n inYRange(mouseY: number, useFinalPosition?: boolean) {\n return inRange(this, mouseY, 'y', useFinalPosition);\n }\n\n getCenterPoint(useFinalPosition?: boolean) {\n const {x, y} = this.getProps(['x', 'y'], useFinalPosition);\n return {x, y};\n }\n\n size(options?: Partial) {\n options = options || this.options || {};\n let radius = options.radius || 0;\n radius = Math.max(radius, radius && options.hoverRadius || 0);\n const borderWidth = radius && options.borderWidth || 0;\n return (radius + borderWidth) * 2;\n }\n\n draw(ctx: CanvasRenderingContext2D, area: ChartArea) {\n const options = this.options;\n\n if (this.skip || options.radius < 0.1 || !_isPointInArea(this, area, this.size(options) / 2)) {\n return;\n }\n\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n ctx.fillStyle = options.backgroundColor;\n drawPoint(ctx, options, this.x, this.y);\n }\n\n getRange() {\n const options = this.options || {};\n // @ts-expect-error Fallbacks should never be hit in practice\n return options.radius + options.hitRadius;\n }\n}\n","import Element from '../core/core.element';\nimport {isObject, _isBetween, _limitValue} from '../helpers';\nimport {addRoundedRectPath} from '../helpers/helpers.canvas';\nimport {toTRBL, toTRBLCorners} from '../helpers/helpers.options';\n\n/** @typedef {{ x: number, y: number, base: number, horizontal: boolean, width: number, height: number }} BarProps */\n\n/**\n * Helper function to get the bounds of the bar regardless of the orientation\n * @param {BarElement} bar the bar\n * @param {boolean} [useFinalPosition]\n * @return {object} bounds of the bar\n * @private\n */\nfunction getBarBounds(bar, useFinalPosition) {\n const {x, y, base, width, height} = /** @type {BarProps} */ (bar.getProps(['x', 'y', 'base', 'width', 'height'], useFinalPosition));\n\n let left, right, top, bottom, half;\n\n if (bar.horizontal) {\n half = height / 2;\n left = Math.min(x, base);\n right = Math.max(x, base);\n top = y - half;\n bottom = y + half;\n } else {\n half = width / 2;\n left = x - half;\n right = x + half;\n top = Math.min(y, base);\n bottom = Math.max(y, base);\n }\n\n return {left, top, right, bottom};\n}\n\nfunction skipOrLimit(skip, value, min, max) {\n return skip ? 0 : _limitValue(value, min, max);\n}\n\nfunction parseBorderWidth(bar, maxW, maxH) {\n const value = bar.options.borderWidth;\n const skip = bar.borderSkipped;\n const o = toTRBL(value);\n\n return {\n t: skipOrLimit(skip.top, o.top, 0, maxH),\n r: skipOrLimit(skip.right, o.right, 0, maxW),\n b: skipOrLimit(skip.bottom, o.bottom, 0, maxH),\n l: skipOrLimit(skip.left, o.left, 0, maxW)\n };\n}\n\nfunction parseBorderRadius(bar, maxW, maxH) {\n const {enableBorderRadius} = bar.getProps(['enableBorderRadius']);\n const value = bar.options.borderRadius;\n const o = toTRBLCorners(value);\n const maxR = Math.min(maxW, maxH);\n const skip = bar.borderSkipped;\n\n // If the value is an object, assume the user knows what they are doing\n // and apply as directed.\n const enableBorder = enableBorderRadius || isObject(value);\n\n return {\n topLeft: skipOrLimit(!enableBorder || skip.top || skip.left, o.topLeft, 0, maxR),\n topRight: skipOrLimit(!enableBorder || skip.top || skip.right, o.topRight, 0, maxR),\n bottomLeft: skipOrLimit(!enableBorder || skip.bottom || skip.left, o.bottomLeft, 0, maxR),\n bottomRight: skipOrLimit(!enableBorder || skip.bottom || skip.right, o.bottomRight, 0, maxR)\n };\n}\n\nfunction boundingRects(bar) {\n const bounds = getBarBounds(bar);\n const width = bounds.right - bounds.left;\n const height = bounds.bottom - bounds.top;\n const border = parseBorderWidth(bar, width / 2, height / 2);\n const radius = parseBorderRadius(bar, width / 2, height / 2);\n\n return {\n outer: {\n x: bounds.left,\n y: bounds.top,\n w: width,\n h: height,\n radius\n },\n inner: {\n x: bounds.left + border.l,\n y: bounds.top + border.t,\n w: width - border.l - border.r,\n h: height - border.t - border.b,\n radius: {\n topLeft: Math.max(0, radius.topLeft - Math.max(border.t, border.l)),\n topRight: Math.max(0, radius.topRight - Math.max(border.t, border.r)),\n bottomLeft: Math.max(0, radius.bottomLeft - Math.max(border.b, border.l)),\n bottomRight: Math.max(0, radius.bottomRight - Math.max(border.b, border.r)),\n }\n }\n };\n}\n\nfunction inRange(bar, x, y, useFinalPosition) {\n const skipX = x === null;\n const skipY = y === null;\n const skipBoth = skipX && skipY;\n const bounds = bar && !skipBoth && getBarBounds(bar, useFinalPosition);\n\n return bounds\n\t\t&& (skipX || _isBetween(x, bounds.left, bounds.right))\n\t\t&& (skipY || _isBetween(y, bounds.top, bounds.bottom));\n}\n\nfunction hasRadius(radius) {\n return radius.topLeft || radius.topRight || radius.bottomLeft || radius.bottomRight;\n}\n\n/**\n * Add a path of a rectangle to the current sub-path\n * @param {CanvasRenderingContext2D} ctx Context\n * @param {*} rect Bounding rect\n */\nfunction addNormalRectPath(ctx, rect) {\n ctx.rect(rect.x, rect.y, rect.w, rect.h);\n}\n\nfunction inflateRect(rect, amount, refRect = {}) {\n const x = rect.x !== refRect.x ? -amount : 0;\n const y = rect.y !== refRect.y ? -amount : 0;\n const w = (rect.x + rect.w !== refRect.x + refRect.w ? amount : 0) - x;\n const h = (rect.y + rect.h !== refRect.y + refRect.h ? amount : 0) - y;\n return {\n x: rect.x + x,\n y: rect.y + y,\n w: rect.w + w,\n h: rect.h + h,\n radius: rect.radius\n };\n}\n\nexport default class BarElement extends Element {\n\n static id = 'bar';\n\n /**\n * @type {any}\n */\n static defaults = {\n borderSkipped: 'start',\n borderWidth: 0,\n borderRadius: 0,\n inflateAmount: 'auto',\n pointStyle: undefined\n };\n\n /**\n * @type {any}\n */\n static defaultRoutes = {\n backgroundColor: 'backgroundColor',\n borderColor: 'borderColor'\n };\n\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.horizontal = undefined;\n this.base = undefined;\n this.width = undefined;\n this.height = undefined;\n this.inflateAmount = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n draw(ctx) {\n const {inflateAmount, options: {borderColor, backgroundColor}} = this;\n const {inner, outer} = boundingRects(this);\n const addRectPath = hasRadius(outer.radius) ? addRoundedRectPath : addNormalRectPath;\n\n ctx.save();\n\n if (outer.w !== inner.w || outer.h !== inner.h) {\n ctx.beginPath();\n addRectPath(ctx, inflateRect(outer, inflateAmount, inner));\n ctx.clip();\n addRectPath(ctx, inflateRect(inner, -inflateAmount, outer));\n ctx.fillStyle = borderColor;\n ctx.fill('evenodd');\n }\n\n ctx.beginPath();\n addRectPath(ctx, inflateRect(inner, inflateAmount));\n ctx.fillStyle = backgroundColor;\n ctx.fill();\n\n ctx.restore();\n }\n\n inRange(mouseX, mouseY, useFinalPosition) {\n return inRange(this, mouseX, mouseY, useFinalPosition);\n }\n\n inXRange(mouseX, useFinalPosition) {\n return inRange(this, mouseX, null, useFinalPosition);\n }\n\n inYRange(mouseY, useFinalPosition) {\n return inRange(this, null, mouseY, useFinalPosition);\n }\n\n getCenterPoint(useFinalPosition) {\n const {x, y, base, horizontal} = /** @type {BarProps} */ (this.getProps(['x', 'y', 'base', 'horizontal'], useFinalPosition));\n return {\n x: horizontal ? (x + base) / 2 : x,\n y: horizontal ? y : (y + base) / 2\n };\n }\n\n getRange(axis) {\n return axis === 'x' ? this.width / 2 : this.height / 2;\n }\n}\n","import type {Chart, ChartConfiguration, ChartDataset} from '../types';\n\nexport interface ColorsPluginOptions {\n enabled?: boolean;\n}\n\ntype DatasetColorizer = (dataset: ChartDataset, i: number) => void;\n\ninterface ColorsDescriptor {\n backgroundColor?: unknown;\n borderColor?: unknown;\n}\n\nconst BORDER_COLORS = [\n 'rgb(54, 162, 235)', // blue\n 'rgb(255, 99, 132)', // red\n 'rgb(255, 159, 64)', // orange\n 'rgb(255, 205, 86)', // yellow\n 'rgb(75, 192, 192)', // green\n 'rgb(153, 102, 255)', // purple\n 'rgb(201, 203, 207)' // grey\n];\n\n// Border colors with 50% transparency\nconst BACKGROUND_COLORS = /* #__PURE__ */ BORDER_COLORS.map(color => color.replace('rgb(', 'rgba(').replace(')', ', 0.5)'));\n\nfunction getBorderColor(i: number) {\n return BORDER_COLORS[i % BORDER_COLORS.length];\n}\n\nfunction getBackgroundColor(i: number) {\n return BACKGROUND_COLORS[i % BACKGROUND_COLORS.length];\n}\n\nfunction createDefaultDatasetColorizer() {\n return (dataset: ChartDataset, i: number) => {\n dataset.borderColor = getBorderColor(i);\n dataset.backgroundColor = getBackgroundColor(i);\n };\n}\n\nfunction createDoughnutDatasetColorizer() {\n let i = 0;\n\n return (dataset: ChartDataset) => {\n dataset.backgroundColor = dataset.data.map(() => getBorderColor(i++));\n };\n}\n\nfunction createPolarAreaDatasetColorizer() {\n let i = 0;\n\n return (dataset: ChartDataset) => {\n dataset.backgroundColor = dataset.data.map(() => getBackgroundColor(i++));\n };\n}\n\nfunction getColorizer(type: string) {\n if (type === 'doughnut' || type === 'pie') {\n return createDoughnutDatasetColorizer();\n } else if (type === 'polarArea') {\n return createPolarAreaDatasetColorizer();\n }\n return createDefaultDatasetColorizer();\n}\n\nfunction containsColorsDefinitions(\n descriptors: ColorsDescriptor[] | Record\n) {\n let k: number | string;\n\n for (k in descriptors) {\n if (descriptors[k].borderColor || descriptors[k].backgroundColor) {\n return true;\n }\n }\n\n return false;\n}\n\nexport default {\n id: 'colors',\n\n defaults: {\n enabled: true,\n },\n\n beforeLayout(chart: Chart, _args, options: ColorsPluginOptions) {\n if (!options.enabled) {\n return;\n }\n\n const {\n type,\n options: {elements},\n data: {datasets}\n } = chart.config as ChartConfiguration;\n\n if (containsColorsDefinitions(datasets) || elements && containsColorsDefinitions(elements)) {\n return;\n }\n\n const colorizer: DatasetColorizer = getColorizer(type);\n datasets.forEach(colorizer);\n }\n};\n","import {_limitValue, _lookupByKey, isNullOrUndef, resolve} from '../helpers';\n\nfunction lttbDecimation(data, start, count, availableWidth, options) {\n /**\n * Implementation of the Largest Triangle Three Buckets algorithm.\n *\n * This implementation is based on the original implementation by Sveinn Steinarsson\n * in https://github.com/sveinn-steinarsson/flot-downsample/blob/master/jquery.flot.downsample.js\n *\n * The original implementation is MIT licensed.\n */\n const samples = options.samples || availableWidth;\n // There are less points than the threshold, returning the whole array\n if (samples >= count) {\n return data.slice(start, start + count);\n }\n\n const decimated = [];\n\n const bucketWidth = (count - 2) / (samples - 2);\n let sampledIndex = 0;\n const endIndex = start + count - 1;\n // Starting from offset\n let a = start;\n let i, maxAreaPoint, maxArea, area, nextA;\n\n decimated[sampledIndex++] = data[a];\n\n for (i = 0; i < samples - 2; i++) {\n let avgX = 0;\n let avgY = 0;\n let j;\n\n // Adding offset\n const avgRangeStart = Math.floor((i + 1) * bucketWidth) + 1 + start;\n const avgRangeEnd = Math.min(Math.floor((i + 2) * bucketWidth) + 1, count) + start;\n const avgRangeLength = avgRangeEnd - avgRangeStart;\n\n for (j = avgRangeStart; j < avgRangeEnd; j++) {\n avgX += data[j].x;\n avgY += data[j].y;\n }\n\n avgX /= avgRangeLength;\n avgY /= avgRangeLength;\n\n // Adding offset\n const rangeOffs = Math.floor(i * bucketWidth) + 1 + start;\n const rangeTo = Math.min(Math.floor((i + 1) * bucketWidth) + 1, count) + start;\n const {x: pointAx, y: pointAy} = data[a];\n\n // Note that this is changed from the original algorithm which initializes these\n // values to 1. The reason for this change is that if the area is small, nextA\n // would never be set and thus a crash would occur in the next loop as `a` would become\n // `undefined`. Since the area is always positive, but could be 0 in the case of a flat trace,\n // initializing with a negative number is the correct solution.\n maxArea = area = -1;\n\n for (j = rangeOffs; j < rangeTo; j++) {\n area = 0.5 * Math.abs(\n (pointAx - avgX) * (data[j].y - pointAy) -\n (pointAx - data[j].x) * (avgY - pointAy)\n );\n\n if (area > maxArea) {\n maxArea = area;\n maxAreaPoint = data[j];\n nextA = j;\n }\n }\n\n decimated[sampledIndex++] = maxAreaPoint;\n a = nextA;\n }\n\n // Include the last point\n decimated[sampledIndex++] = data[endIndex];\n\n return decimated;\n}\n\nfunction minMaxDecimation(data, start, count, availableWidth) {\n let avgX = 0;\n let countX = 0;\n let i, point, x, y, prevX, minIndex, maxIndex, startIndex, minY, maxY;\n const decimated = [];\n const endIndex = start + count - 1;\n\n const xMin = data[start].x;\n const xMax = data[endIndex].x;\n const dx = xMax - xMin;\n\n for (i = start; i < start + count; ++i) {\n point = data[i];\n x = (point.x - xMin) / dx * availableWidth;\n y = point.y;\n const truncX = x | 0;\n\n if (truncX === prevX) {\n // Determine `minY` / `maxY` and `avgX` while we stay within same x-position\n if (y < minY) {\n minY = y;\n minIndex = i;\n } else if (y > maxY) {\n maxY = y;\n maxIndex = i;\n }\n // For first point in group, countX is `0`, so average will be `x` / 1.\n // Use point.x here because we're computing the average data `x` value\n avgX = (countX * avgX + point.x) / ++countX;\n } else {\n // Push up to 4 points, 3 for the last interval and the first point for this interval\n const lastIndex = i - 1;\n\n if (!isNullOrUndef(minIndex) && !isNullOrUndef(maxIndex)) {\n // The interval is defined by 4 points: start, min, max, end.\n // The starting point is already considered at this point, so we need to determine which\n // of the other points to add. We need to sort these points to ensure the decimated data\n // is still sorted and then ensure there are no duplicates.\n const intermediateIndex1 = Math.min(minIndex, maxIndex);\n const intermediateIndex2 = Math.max(minIndex, maxIndex);\n\n if (intermediateIndex1 !== startIndex && intermediateIndex1 !== lastIndex) {\n decimated.push({\n ...data[intermediateIndex1],\n x: avgX,\n });\n }\n if (intermediateIndex2 !== startIndex && intermediateIndex2 !== lastIndex) {\n decimated.push({\n ...data[intermediateIndex2],\n x: avgX\n });\n }\n }\n\n // lastIndex === startIndex will occur when a range has only 1 point which could\n // happen with very uneven data\n if (i > 0 && lastIndex !== startIndex) {\n // Last point in the previous interval\n decimated.push(data[lastIndex]);\n }\n\n // Start of the new interval\n decimated.push(point);\n prevX = truncX;\n countX = 0;\n minY = maxY = y;\n minIndex = maxIndex = startIndex = i;\n }\n }\n\n return decimated;\n}\n\nfunction cleanDecimatedDataset(dataset) {\n if (dataset._decimated) {\n const data = dataset._data;\n delete dataset._decimated;\n delete dataset._data;\n Object.defineProperty(dataset, 'data', {value: data});\n }\n}\n\nfunction cleanDecimatedData(chart) {\n chart.data.datasets.forEach((dataset) => {\n cleanDecimatedDataset(dataset);\n });\n}\n\nfunction getStartAndCountOfVisiblePointsSimplified(meta, points) {\n const pointCount = points.length;\n\n let start = 0;\n let count;\n\n const {iScale} = meta;\n const {min, max, minDefined, maxDefined} = iScale.getUserBounds();\n\n if (minDefined) {\n start = _limitValue(_lookupByKey(points, iScale.axis, min).lo, 0, pointCount - 1);\n }\n if (maxDefined) {\n count = _limitValue(_lookupByKey(points, iScale.axis, max).hi + 1, start, pointCount) - start;\n } else {\n count = pointCount - start;\n }\n\n return {start, count};\n}\n\nexport default {\n id: 'decimation',\n\n defaults: {\n algorithm: 'min-max',\n enabled: false,\n },\n\n beforeElementsUpdate: (chart, args, options) => {\n if (!options.enabled) {\n // The decimation plugin may have been previously enabled. Need to remove old `dataset._data` handlers\n cleanDecimatedData(chart);\n return;\n }\n\n // Assume the entire chart is available to show a few more points than needed\n const availableWidth = chart.width;\n\n chart.data.datasets.forEach((dataset, datasetIndex) => {\n const {_data, indexAxis} = dataset;\n const meta = chart.getDatasetMeta(datasetIndex);\n const data = _data || dataset.data;\n\n if (resolve([indexAxis, chart.options.indexAxis]) === 'y') {\n // Decimation is only supported for lines that have an X indexAxis\n return;\n }\n\n if (!meta.controller.supportsDecimation) {\n // Only line datasets are supported\n return;\n }\n\n const xAxis = chart.scales[meta.xAxisID];\n if (xAxis.type !== 'linear' && xAxis.type !== 'time') {\n // Only linear interpolation is supported\n return;\n }\n\n if (chart.options.parsing) {\n // Plugin only supports data that does not need parsing\n return;\n }\n\n let {start, count} = getStartAndCountOfVisiblePointsSimplified(meta, data);\n const threshold = options.threshold || 4 * availableWidth;\n if (count <= threshold) {\n // No decimation is required until we are above this threshold\n cleanDecimatedDataset(dataset);\n return;\n }\n\n if (isNullOrUndef(_data)) {\n // First time we are seeing this dataset\n // We override the 'data' property with a setter that stores the\n // raw data in _data, but reads the decimated data from _decimated\n dataset._data = data;\n delete dataset.data;\n Object.defineProperty(dataset, 'data', {\n configurable: true,\n enumerable: true,\n get: function() {\n return this._decimated;\n },\n set: function(d) {\n this._data = d;\n }\n });\n }\n\n // Point the chart to the decimated data\n let decimated;\n switch (options.algorithm) {\n case 'lttb':\n decimated = lttbDecimation(data, start, count, availableWidth, options);\n break;\n case 'min-max':\n decimated = minMaxDecimation(data, start, count, availableWidth);\n break;\n default:\n throw new Error(`Unsupported decimation algorithm '${options.algorithm}'`);\n }\n\n dataset._decimated = decimated;\n });\n },\n\n destroy(chart) {\n cleanDecimatedData(chart);\n }\n};\n","import {_boundSegment, _boundSegments, _normalizeAngle} from '../../helpers';\n\nexport function _segments(line, target, property) {\n const segments = line.segments;\n const points = line.points;\n const tpoints = target.points;\n const parts = [];\n\n for (const segment of segments) {\n let {start, end} = segment;\n end = _findSegmentEnd(start, end, points);\n\n const bounds = _getBounds(property, points[start], points[end], segment.loop);\n\n if (!target.segments) {\n // Special case for boundary not supporting `segments` (simpleArc)\n // Bounds are provided as `target` for partial circle, or undefined for full circle\n parts.push({\n source: segment,\n target: bounds,\n start: points[start],\n end: points[end]\n });\n continue;\n }\n\n // Get all segments from `target` that intersect the bounds of current segment of `line`\n const targetSegments = _boundSegments(target, bounds);\n\n for (const tgt of targetSegments) {\n const subBounds = _getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);\n const fillSources = _boundSegment(segment, points, subBounds);\n\n for (const fillSource of fillSources) {\n parts.push({\n source: fillSource,\n target: tgt,\n start: {\n [property]: _getEdge(bounds, subBounds, 'start', Math.max)\n },\n end: {\n [property]: _getEdge(bounds, subBounds, 'end', Math.min)\n }\n });\n }\n }\n }\n return parts;\n}\n\nexport function _getBounds(property, first, last, loop) {\n if (loop) {\n return;\n }\n let start = first[property];\n let end = last[property];\n\n if (property === 'angle') {\n start = _normalizeAngle(start);\n end = _normalizeAngle(end);\n }\n return {property, start, end};\n}\n\nexport function _pointsFromSegments(boundary, line) {\n const {x = null, y = null} = boundary || {};\n const linePoints = line.points;\n const points = [];\n line.segments.forEach(({start, end}) => {\n end = _findSegmentEnd(start, end, linePoints);\n const first = linePoints[start];\n const last = linePoints[end];\n if (y !== null) {\n points.push({x: first.x, y});\n points.push({x: last.x, y});\n } else if (x !== null) {\n points.push({x, y: first.y});\n points.push({x, y: last.y});\n }\n });\n return points;\n}\n\nexport function _findSegmentEnd(start, end, points) {\n for (;end > start; end--) {\n const point = points[end];\n if (!isNaN(point.x) && !isNaN(point.y)) {\n break;\n }\n }\n return end;\n}\n\nfunction _getEdge(a, b, prop, fn) {\n if (a && b) {\n return fn(a[prop], b[prop]);\n }\n return a ? a[prop] : b ? b[prop] : 0;\n}\n","/**\n * @typedef { import('../../core/core.controller').default } Chart\n * @typedef { import('../../core/core.scale').default } Scale\n * @typedef { import('../../elements/element.point').default } PointElement\n */\n\nimport {LineElement} from '../../elements';\nimport {isArray} from '../../helpers';\nimport {_pointsFromSegments} from './filler.segment';\n\n/**\n * @param {PointElement[] | { x: number; y: number; }} boundary\n * @param {LineElement} line\n * @return {LineElement?}\n */\nexport function _createBoundaryLine(boundary, line) {\n let points = [];\n let _loop = false;\n\n if (isArray(boundary)) {\n _loop = true;\n // @ts-ignore\n points = boundary;\n } else {\n points = _pointsFromSegments(boundary, line);\n }\n\n return points.length ? new LineElement({\n points,\n options: {tension: 0},\n _loop,\n _fullLoop: _loop\n }) : null;\n}\n\nexport function _shouldApplyFill(source) {\n return source && source.fill !== false;\n}\n","import {isObject, isFinite, valueOrDefault} from '../../helpers/helpers.core';\n\n/**\n * @typedef { import('../../core/core.scale').default } Scale\n * @typedef { import('../../elements/element.line').default } LineElement\n * @typedef { import('../../../types').FillTarget } FillTarget\n * @typedef { import('../../../types').ComplexFillTarget } ComplexFillTarget\n */\n\nexport function _resolveTarget(sources, index, propagate) {\n const source = sources[index];\n let fill = source.fill;\n const visited = [index];\n let target;\n\n if (!propagate) {\n return fill;\n }\n\n while (fill !== false && visited.indexOf(fill) === -1) {\n if (!isFinite(fill)) {\n return fill;\n }\n\n target = sources[fill];\n if (!target) {\n return false;\n }\n\n if (target.visible) {\n return fill;\n }\n\n visited.push(fill);\n fill = target.fill;\n }\n\n return false;\n}\n\n/**\n * @param {LineElement} line\n * @param {number} index\n * @param {number} count\n */\nexport function _decodeFill(line, index, count) {\n /** @type {string | {value: number}} */\n const fill = parseFillOption(line);\n\n if (isObject(fill)) {\n return isNaN(fill.value) ? false : fill;\n }\n\n let target = parseFloat(fill);\n\n if (isFinite(target) && Math.floor(target) === target) {\n return decodeTargetIndex(fill[0], index, target, count);\n }\n\n return ['origin', 'start', 'end', 'stack', 'shape'].indexOf(fill) >= 0 && fill;\n}\n\nfunction decodeTargetIndex(firstCh, index, target, count) {\n if (firstCh === '-' || firstCh === '+') {\n target = index + target;\n }\n\n if (target === index || target < 0 || target >= count) {\n return false;\n }\n\n return target;\n}\n\n/**\n * @param {FillTarget | ComplexFillTarget} fill\n * @param {Scale} scale\n * @returns {number | null}\n */\nexport function _getTargetPixel(fill, scale) {\n let pixel = null;\n if (fill === 'start') {\n pixel = scale.bottom;\n } else if (fill === 'end') {\n pixel = scale.top;\n } else if (isObject(fill)) {\n // @ts-ignore\n pixel = scale.getPixelForValue(fill.value);\n } else if (scale.getBasePixel) {\n pixel = scale.getBasePixel();\n }\n return pixel;\n}\n\n/**\n * @param {FillTarget | ComplexFillTarget} fill\n * @param {Scale} scale\n * @param {number} startValue\n * @returns {number | undefined}\n */\nexport function _getTargetValue(fill, scale, startValue) {\n let value;\n\n if (fill === 'start') {\n value = startValue;\n } else if (fill === 'end') {\n value = scale.options.reverse ? scale.min : scale.max;\n } else if (isObject(fill)) {\n // @ts-ignore\n value = fill.value;\n } else {\n value = scale.getBaseValue();\n }\n return value;\n}\n\n/**\n * @param {LineElement} line\n */\nfunction parseFillOption(line) {\n const options = line.options;\n const fillOption = options.fill;\n let fill = valueOrDefault(fillOption && fillOption.target, fillOption);\n\n if (fill === undefined) {\n fill = !!options.backgroundColor;\n }\n\n if (fill === false || fill === null) {\n return false;\n }\n\n if (fill === true) {\n return 'origin';\n }\n return fill;\n}\n","/**\n * @typedef { import('../../core/core.controller').default } Chart\n * @typedef { import('../../core/core.scale').default } Scale\n * @typedef { import('../../elements/element.point').default } PointElement\n */\n\nimport {LineElement} from '../../elements';\nimport {_isBetween} from '../../helpers';\nimport {_createBoundaryLine} from './filler.helper';\n\n/**\n * @param {{ chart: Chart; scale: Scale; index: number; line: LineElement; }} source\n * @return {LineElement}\n */\nexport function _buildStackLine(source) {\n const {scale, index, line} = source;\n const points = [];\n const segments = line.segments;\n const sourcePoints = line.points;\n const linesBelow = getLinesBelow(scale, index);\n linesBelow.push(_createBoundaryLine({x: null, y: scale.bottom}, line));\n\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n for (let j = segment.start; j <= segment.end; j++) {\n addPointsBelow(points, sourcePoints[j], linesBelow);\n }\n }\n return new LineElement({points, options: {}});\n}\n\n/**\n * @param {Scale} scale\n * @param {number} index\n * @return {LineElement[]}\n */\nfunction getLinesBelow(scale, index) {\n const below = [];\n const metas = scale.getMatchingVisibleMetas('line');\n\n for (let i = 0; i < metas.length; i++) {\n const meta = metas[i];\n if (meta.index === index) {\n break;\n }\n if (!meta.hidden) {\n below.unshift(meta.dataset);\n }\n }\n return below;\n}\n\n/**\n * @param {PointElement[]} points\n * @param {PointElement} sourcePoint\n * @param {LineElement[]} linesBelow\n */\nfunction addPointsBelow(points, sourcePoint, linesBelow) {\n const postponed = [];\n for (let j = 0; j < linesBelow.length; j++) {\n const line = linesBelow[j];\n const {first, last, point} = findPoint(line, sourcePoint, 'x');\n\n if (!point || (first && last)) {\n continue;\n }\n if (first) {\n // First point of an segment -> need to add another point before this,\n // from next line below.\n postponed.unshift(point);\n } else {\n points.push(point);\n if (!last) {\n // In the middle of an segment, no need to add more points.\n break;\n }\n }\n }\n points.push(...postponed);\n}\n\n/**\n * @param {LineElement} line\n * @param {PointElement} sourcePoint\n * @param {string} property\n * @returns {{point?: PointElement, first?: boolean, last?: boolean}}\n */\nfunction findPoint(line, sourcePoint, property) {\n const point = line.interpolate(sourcePoint, property);\n if (!point) {\n return {};\n }\n\n const pointValue = point[property];\n const segments = line.segments;\n const linePoints = line.points;\n let first = false;\n let last = false;\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n const firstValue = linePoints[segment.start][property];\n const lastValue = linePoints[segment.end][property];\n if (_isBetween(pointValue, firstValue, lastValue)) {\n first = pointValue === firstValue;\n last = pointValue === lastValue;\n break;\n }\n }\n return {first, last, point};\n}\n","import {TAU} from '../../helpers';\n\n// TODO: use elements.ArcElement instead\nexport class simpleArc {\n constructor(opts) {\n this.x = opts.x;\n this.y = opts.y;\n this.radius = opts.radius;\n }\n\n pathSegment(ctx, bounds, opts) {\n const {x, y, radius} = this;\n bounds = bounds || {start: 0, end: TAU};\n ctx.arc(x, y, radius, bounds.end, bounds.start, true);\n return !opts.bounds;\n }\n\n interpolate(point) {\n const {x, y, radius} = this;\n const angle = point.angle;\n return {\n x: x + Math.cos(angle) * radius,\n y: y + Math.sin(angle) * radius,\n angle\n };\n }\n}\n","import {isFinite} from '../../helpers';\nimport {_createBoundaryLine} from './filler.helper';\nimport {_getTargetPixel, _getTargetValue} from './filler.options';\nimport {_buildStackLine} from './filler.target.stack';\nimport {simpleArc} from './simpleArc';\n\n/**\n * @typedef { import('../../core/core.controller').default } Chart\n * @typedef { import('../../core/core.scale').default } Scale\n * @typedef { import('../../elements/element.point').default } PointElement\n */\n\nexport function _getTarget(source) {\n const {chart, fill, line} = source;\n\n if (isFinite(fill)) {\n return getLineByIndex(chart, fill);\n }\n\n if (fill === 'stack') {\n return _buildStackLine(source);\n }\n\n if (fill === 'shape') {\n return true;\n }\n\n const boundary = computeBoundary(source);\n\n if (boundary instanceof simpleArc) {\n return boundary;\n }\n\n return _createBoundaryLine(boundary, line);\n}\n\n/**\n * @param {Chart} chart\n * @param {number} index\n */\nfunction getLineByIndex(chart, index) {\n const meta = chart.getDatasetMeta(index);\n const visible = meta && chart.isDatasetVisible(index);\n return visible ? meta.dataset : null;\n}\n\nfunction computeBoundary(source) {\n const scale = source.scale || {};\n\n if (scale.getPointPositionForValue) {\n return computeCircularBoundary(source);\n }\n return computeLinearBoundary(source);\n}\n\n\nfunction computeLinearBoundary(source) {\n const {scale = {}, fill} = source;\n const pixel = _getTargetPixel(fill, scale);\n\n if (isFinite(pixel)) {\n const horizontal = scale.isHorizontal();\n\n return {\n x: horizontal ? pixel : null,\n y: horizontal ? null : pixel\n };\n }\n\n return null;\n}\n\nfunction computeCircularBoundary(source) {\n const {scale, fill} = source;\n const options = scale.options;\n const length = scale.getLabels().length;\n const start = options.reverse ? scale.max : scale.min;\n const value = _getTargetValue(fill, scale, start);\n const target = [];\n\n if (options.grid.circular) {\n const center = scale.getPointPositionForValue(0, start);\n return new simpleArc({\n x: center.x,\n y: center.y,\n radius: scale.getDistanceFromCenterForValue(value)\n });\n }\n\n for (let i = 0; i < length; ++i) {\n target.push(scale.getPointPositionForValue(i, value));\n }\n return target;\n}\n\n","import {clipArea, unclipArea} from '../../helpers';\nimport {_findSegmentEnd, _getBounds, _segments} from './filler.segment';\nimport {_getTarget} from './filler.target';\n\nexport function _drawfill(ctx, source, area) {\n const target = _getTarget(source);\n const {line, scale, axis} = source;\n const lineOpts = line.options;\n const fillOption = lineOpts.fill;\n const color = lineOpts.backgroundColor;\n const {above = color, below = color} = fillOption || {};\n if (target && line.points.length) {\n clipArea(ctx, area);\n doFill(ctx, {line, target, above, below, area, scale, axis});\n unclipArea(ctx);\n }\n}\n\nfunction doFill(ctx, cfg) {\n const {line, target, above, below, area, scale} = cfg;\n const property = line._loop ? 'angle' : cfg.axis;\n\n ctx.save();\n\n if (property === 'x' && below !== above) {\n clipVertical(ctx, target, area.top);\n fill(ctx, {line, target, color: above, scale, property});\n ctx.restore();\n ctx.save();\n clipVertical(ctx, target, area.bottom);\n }\n fill(ctx, {line, target, color: below, scale, property});\n\n ctx.restore();\n}\n\nfunction clipVertical(ctx, target, clipY) {\n const {segments, points} = target;\n let first = true;\n let lineLoop = false;\n\n ctx.beginPath();\n for (const segment of segments) {\n const {start, end} = segment;\n const firstPoint = points[start];\n const lastPoint = points[_findSegmentEnd(start, end, points)];\n if (first) {\n ctx.moveTo(firstPoint.x, firstPoint.y);\n first = false;\n } else {\n ctx.lineTo(firstPoint.x, clipY);\n ctx.lineTo(firstPoint.x, firstPoint.y);\n }\n lineLoop = !!target.pathSegment(ctx, segment, {move: lineLoop});\n if (lineLoop) {\n ctx.closePath();\n } else {\n ctx.lineTo(lastPoint.x, clipY);\n }\n }\n\n ctx.lineTo(target.first().x, clipY);\n ctx.closePath();\n ctx.clip();\n}\n\nfunction fill(ctx, cfg) {\n const {line, target, property, color, scale} = cfg;\n const segments = _segments(line, target, property);\n\n for (const {source: src, target: tgt, start, end} of segments) {\n const {style: {backgroundColor = color} = {}} = src;\n const notShape = target !== true;\n\n ctx.save();\n ctx.fillStyle = backgroundColor;\n\n clipBounds(ctx, scale, notShape && _getBounds(property, start, end));\n\n ctx.beginPath();\n\n const lineLoop = !!line.pathSegment(ctx, src);\n\n let loop;\n if (notShape) {\n if (lineLoop) {\n ctx.closePath();\n } else {\n interpolatedLineTo(ctx, target, end, property);\n }\n\n const targetLoop = !!target.pathSegment(ctx, tgt, {move: lineLoop, reverse: true});\n loop = lineLoop && targetLoop;\n if (!loop) {\n interpolatedLineTo(ctx, target, start, property);\n }\n }\n\n ctx.closePath();\n ctx.fill(loop ? 'evenodd' : 'nonzero');\n\n ctx.restore();\n }\n}\n\nfunction clipBounds(ctx, scale, bounds) {\n const {top, bottom} = scale.chart.chartArea;\n const {property, start, end} = bounds || {};\n if (property === 'x') {\n ctx.beginPath();\n ctx.rect(start, top, end - start, bottom - top);\n ctx.clip();\n }\n}\n\nfunction interpolatedLineTo(ctx, target, point, property) {\n const interpolatedPoint = target.interpolate(point, property);\n if (interpolatedPoint) {\n ctx.lineTo(interpolatedPoint.x, interpolatedPoint.y);\n }\n}\n\n","/**\n * Plugin based on discussion from the following Chart.js issues:\n * @see https://github.com/chartjs/Chart.js/issues/2380#issuecomment-279961569\n * @see https://github.com/chartjs/Chart.js/issues/2440#issuecomment-256461897\n */\n\nimport LineElement from '../../elements/element.line';\nimport {_drawfill} from './filler.drawing';\nimport {_shouldApplyFill} from './filler.helper';\nimport {_decodeFill, _resolveTarget} from './filler.options';\n\nexport default {\n id: 'filler',\n\n afterDatasetsUpdate(chart, _args, options) {\n const count = (chart.data.datasets || []).length;\n const sources = [];\n let meta, i, line, source;\n\n for (i = 0; i < count; ++i) {\n meta = chart.getDatasetMeta(i);\n line = meta.dataset;\n source = null;\n\n if (line && line.options && line instanceof LineElement) {\n source = {\n visible: chart.isDatasetVisible(i),\n index: i,\n fill: _decodeFill(line, i, count),\n chart,\n axis: meta.controller.options.indexAxis,\n scale: meta.vScale,\n line,\n };\n }\n\n meta.$filler = source;\n sources.push(source);\n }\n\n for (i = 0; i < count; ++i) {\n source = sources[i];\n if (!source || source.fill === false) {\n continue;\n }\n\n source.fill = _resolveTarget(sources, i, options.propagate);\n }\n },\n\n beforeDraw(chart, _args, options) {\n const draw = options.drawTime === 'beforeDraw';\n const metasets = chart.getSortedVisibleDatasetMetas();\n const area = chart.chartArea;\n for (let i = metasets.length - 1; i >= 0; --i) {\n const source = metasets[i].$filler;\n if (!source) {\n continue;\n }\n\n source.line.updateControlPoints(area, source.axis);\n if (draw && source.fill) {\n _drawfill(chart.ctx, source, area);\n }\n }\n },\n\n beforeDatasetsDraw(chart, _args, options) {\n if (options.drawTime !== 'beforeDatasetsDraw') {\n return;\n }\n\n const metasets = chart.getSortedVisibleDatasetMetas();\n for (let i = metasets.length - 1; i >= 0; --i) {\n const source = metasets[i].$filler;\n\n if (_shouldApplyFill(source)) {\n _drawfill(chart.ctx, source, chart.chartArea);\n }\n }\n },\n\n beforeDatasetDraw(chart, args, options) {\n const source = args.meta.$filler;\n\n if (!_shouldApplyFill(source) || options.drawTime !== 'beforeDatasetDraw') {\n return;\n }\n\n _drawfill(chart.ctx, source, chart.chartArea);\n },\n\n defaults: {\n propagate: true,\n drawTime: 'beforeDatasetDraw'\n }\n};\n","import defaults from '../core/core.defaults';\nimport Element from '../core/core.element';\nimport layouts from '../core/core.layouts';\nimport {addRoundedRectPath, drawPointLegend, renderText} from '../helpers/helpers.canvas';\nimport {\n _isBetween,\n callback as call,\n clipArea,\n getRtlAdapter,\n overrideTextDirection,\n restoreTextDirection,\n toFont,\n toPadding,\n unclipArea,\n valueOrDefault,\n} from '../helpers/index';\nimport {_alignStartEnd, _textX, _toLeftRightCenter} from '../helpers/helpers.extras';\nimport {toTRBLCorners} from '../helpers/helpers.options';\n\n/**\n * @typedef { import(\"../../types\").ChartEvent } ChartEvent\n */\n\nconst getBoxSize = (labelOpts, fontSize) => {\n let {boxHeight = fontSize, boxWidth = fontSize} = labelOpts;\n\n if (labelOpts.usePointStyle) {\n boxHeight = Math.min(boxHeight, fontSize);\n boxWidth = labelOpts.pointStyleWidth || Math.min(boxWidth, fontSize);\n }\n\n return {\n boxWidth,\n boxHeight,\n itemHeight: Math.max(fontSize, boxHeight)\n };\n};\n\nconst itemsEqual = (a, b) => a !== null && b !== null && a.datasetIndex === b.datasetIndex && a.index === b.index;\n\nexport class Legend extends Element {\n\n /**\n\t * @param {{ ctx: any; options: any; chart: any; }} config\n\t */\n constructor(config) {\n super();\n\n this._added = false;\n\n // Contains hit boxes for each dataset (in dataset order)\n this.legendHitBoxes = [];\n\n /**\n \t\t * @private\n \t\t */\n this._hoveredItem = null;\n\n // Are we in doughnut mode which has a different data type\n this.doughnutMode = false;\n\n this.chart = config.chart;\n this.options = config.options;\n this.ctx = config.ctx;\n this.legendItems = undefined;\n this.columnSizes = undefined;\n this.lineWidths = undefined;\n this.maxHeight = undefined;\n this.maxWidth = undefined;\n this.top = undefined;\n this.bottom = undefined;\n this.left = undefined;\n this.right = undefined;\n this.height = undefined;\n this.width = undefined;\n this._margins = undefined;\n this.position = undefined;\n this.weight = undefined;\n this.fullSize = undefined;\n }\n\n update(maxWidth, maxHeight, margins) {\n this.maxWidth = maxWidth;\n this.maxHeight = maxHeight;\n this._margins = margins;\n\n this.setDimensions();\n this.buildLabels();\n this.fit();\n }\n\n setDimensions() {\n if (this.isHorizontal()) {\n this.width = this.maxWidth;\n this.left = this._margins.left;\n this.right = this.width;\n } else {\n this.height = this.maxHeight;\n this.top = this._margins.top;\n this.bottom = this.height;\n }\n }\n\n buildLabels() {\n const labelOpts = this.options.labels || {};\n let legendItems = call(labelOpts.generateLabels, [this.chart], this) || [];\n\n if (labelOpts.filter) {\n legendItems = legendItems.filter((item) => labelOpts.filter(item, this.chart.data));\n }\n\n if (labelOpts.sort) {\n legendItems = legendItems.sort((a, b) => labelOpts.sort(a, b, this.chart.data));\n }\n\n if (this.options.reverse) {\n legendItems.reverse();\n }\n\n this.legendItems = legendItems;\n }\n\n fit() {\n const {options, ctx} = this;\n\n // The legend may not be displayed for a variety of reasons including\n // the fact that the defaults got set to `false`.\n // When the legend is not displayed, there are no guarantees that the options\n // are correctly formatted so we need to bail out as early as possible.\n if (!options.display) {\n this.width = this.height = 0;\n return;\n }\n\n const labelOpts = options.labels;\n const labelFont = toFont(labelOpts.font);\n const fontSize = labelFont.size;\n const titleHeight = this._computeTitleHeight();\n const {boxWidth, itemHeight} = getBoxSize(labelOpts, fontSize);\n\n let width, height;\n\n ctx.font = labelFont.string;\n\n if (this.isHorizontal()) {\n width = this.maxWidth; // fill all the width\n height = this._fitRows(titleHeight, fontSize, boxWidth, itemHeight) + 10;\n } else {\n height = this.maxHeight; // fill all the height\n width = this._fitCols(titleHeight, labelFont, boxWidth, itemHeight) + 10;\n }\n\n this.width = Math.min(width, options.maxWidth || this.maxWidth);\n this.height = Math.min(height, options.maxHeight || this.maxHeight);\n }\n\n /**\n\t * @private\n\t */\n _fitRows(titleHeight, fontSize, boxWidth, itemHeight) {\n const {ctx, maxWidth, options: {labels: {padding}}} = this;\n const hitboxes = this.legendHitBoxes = [];\n // Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one\n const lineWidths = this.lineWidths = [0];\n const lineHeight = itemHeight + padding;\n let totalHeight = titleHeight;\n\n ctx.textAlign = 'left';\n ctx.textBaseline = 'middle';\n\n let row = -1;\n let top = -lineHeight;\n this.legendItems.forEach((legendItem, i) => {\n const itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;\n\n if (i === 0 || lineWidths[lineWidths.length - 1] + itemWidth + 2 * padding > maxWidth) {\n totalHeight += lineHeight;\n lineWidths[lineWidths.length - (i > 0 ? 0 : 1)] = 0;\n top += lineHeight;\n row++;\n }\n\n hitboxes[i] = {left: 0, top, row, width: itemWidth, height: itemHeight};\n\n lineWidths[lineWidths.length - 1] += itemWidth + padding;\n });\n\n return totalHeight;\n }\n\n _fitCols(titleHeight, labelFont, boxWidth, _itemHeight) {\n const {ctx, maxHeight, options: {labels: {padding}}} = this;\n const hitboxes = this.legendHitBoxes = [];\n const columnSizes = this.columnSizes = [];\n const heightLimit = maxHeight - titleHeight;\n\n let totalWidth = padding;\n let currentColWidth = 0;\n let currentColHeight = 0;\n\n let left = 0;\n let col = 0;\n\n this.legendItems.forEach((legendItem, i) => {\n const {itemWidth, itemHeight} = calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight);\n\n // If too tall, go to new column\n if (i > 0 && currentColHeight + itemHeight + 2 * padding > heightLimit) {\n totalWidth += currentColWidth + padding;\n columnSizes.push({width: currentColWidth, height: currentColHeight}); // previous column size\n left += currentColWidth + padding;\n col++;\n currentColWidth = currentColHeight = 0;\n }\n\n // Store the hitbox width and height here. Final position will be updated in `draw`\n hitboxes[i] = {left, top: currentColHeight, col, width: itemWidth, height: itemHeight};\n\n // Get max width\n currentColWidth = Math.max(currentColWidth, itemWidth);\n currentColHeight += itemHeight + padding;\n });\n\n totalWidth += currentColWidth;\n columnSizes.push({width: currentColWidth, height: currentColHeight}); // previous column size\n\n return totalWidth;\n }\n\n adjustHitBoxes() {\n if (!this.options.display) {\n return;\n }\n const titleHeight = this._computeTitleHeight();\n const {legendHitBoxes: hitboxes, options: {align, labels: {padding}, rtl}} = this;\n const rtlHelper = getRtlAdapter(rtl, this.left, this.width);\n if (this.isHorizontal()) {\n let row = 0;\n let left = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);\n for (const hitbox of hitboxes) {\n if (row !== hitbox.row) {\n row = hitbox.row;\n left = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);\n }\n hitbox.top += this.top + titleHeight + padding;\n hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(left), hitbox.width);\n left += hitbox.width + padding;\n }\n } else {\n let col = 0;\n let top = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);\n for (const hitbox of hitboxes) {\n if (hitbox.col !== col) {\n col = hitbox.col;\n top = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);\n }\n hitbox.top = top;\n hitbox.left += this.left + padding;\n hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(hitbox.left), hitbox.width);\n top += hitbox.height + padding;\n }\n }\n }\n\n isHorizontal() {\n return this.options.position === 'top' || this.options.position === 'bottom';\n }\n\n draw() {\n if (this.options.display) {\n const ctx = this.ctx;\n clipArea(ctx, this);\n\n this._draw();\n\n unclipArea(ctx);\n }\n }\n\n /**\n\t * @private\n\t */\n _draw() {\n const {options: opts, columnSizes, lineWidths, ctx} = this;\n const {align, labels: labelOpts} = opts;\n const defaultColor = defaults.color;\n const rtlHelper = getRtlAdapter(opts.rtl, this.left, this.width);\n const labelFont = toFont(labelOpts.font);\n const {padding} = labelOpts;\n const fontSize = labelFont.size;\n const halfFontSize = fontSize / 2;\n let cursor;\n\n this.drawTitle();\n\n // Canvas setup\n ctx.textAlign = rtlHelper.textAlign('left');\n ctx.textBaseline = 'middle';\n ctx.lineWidth = 0.5;\n ctx.font = labelFont.string;\n\n const {boxWidth, boxHeight, itemHeight} = getBoxSize(labelOpts, fontSize);\n\n // current position\n const drawLegendBox = function(x, y, legendItem) {\n if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {\n return;\n }\n\n // Set the ctx for the box\n ctx.save();\n\n const lineWidth = valueOrDefault(legendItem.lineWidth, 1);\n ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor);\n ctx.lineCap = valueOrDefault(legendItem.lineCap, 'butt');\n ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, 0);\n ctx.lineJoin = valueOrDefault(legendItem.lineJoin, 'miter');\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);\n\n ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));\n\n if (labelOpts.usePointStyle) {\n // Recalculate x and y for drawPoint() because its expecting\n // x and y to be center of figure (instead of top left)\n const drawOptions = {\n radius: boxHeight * Math.SQRT2 / 2,\n pointStyle: legendItem.pointStyle,\n rotation: legendItem.rotation,\n borderWidth: lineWidth\n };\n const centerX = rtlHelper.xPlus(x, boxWidth / 2);\n const centerY = y + halfFontSize;\n\n // Draw pointStyle as legend symbol\n drawPointLegend(ctx, drawOptions, centerX, centerY, labelOpts.pointStyleWidth && boxWidth);\n } else {\n // Draw box as legend symbol\n // Adjust position when boxHeight < fontSize (want it centered)\n const yBoxTop = y + Math.max((fontSize - boxHeight) / 2, 0);\n const xBoxLeft = rtlHelper.leftForLtr(x, boxWidth);\n const borderRadius = toTRBLCorners(legendItem.borderRadius);\n\n ctx.beginPath();\n\n if (Object.values(borderRadius).some(v => v !== 0)) {\n addRoundedRectPath(ctx, {\n x: xBoxLeft,\n y: yBoxTop,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius,\n });\n } else {\n ctx.rect(xBoxLeft, yBoxTop, boxWidth, boxHeight);\n }\n\n ctx.fill();\n if (lineWidth !== 0) {\n ctx.stroke();\n }\n }\n\n ctx.restore();\n };\n\n const fillText = function(x, y, legendItem) {\n renderText(ctx, legendItem.text, x, y + (itemHeight / 2), labelFont, {\n strikethrough: legendItem.hidden,\n textAlign: rtlHelper.textAlign(legendItem.textAlign)\n });\n };\n\n // Horizontal\n const isHorizontal = this.isHorizontal();\n const titleHeight = this._computeTitleHeight();\n if (isHorizontal) {\n cursor = {\n x: _alignStartEnd(align, this.left + padding, this.right - lineWidths[0]),\n y: this.top + padding + titleHeight,\n line: 0\n };\n } else {\n cursor = {\n x: this.left + padding,\n y: _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[0].height),\n line: 0\n };\n }\n\n overrideTextDirection(this.ctx, opts.textDirection);\n\n const lineHeight = itemHeight + padding;\n this.legendItems.forEach((legendItem, i) => {\n ctx.strokeStyle = legendItem.fontColor; // for strikethrough effect\n ctx.fillStyle = legendItem.fontColor; // render in correct colour\n\n const textWidth = ctx.measureText(legendItem.text).width;\n const textAlign = rtlHelper.textAlign(legendItem.textAlign || (legendItem.textAlign = labelOpts.textAlign));\n const width = boxWidth + halfFontSize + textWidth;\n let x = cursor.x;\n let y = cursor.y;\n\n rtlHelper.setWidth(this.width);\n\n if (isHorizontal) {\n if (i > 0 && x + width + padding > this.right) {\n y = cursor.y += lineHeight;\n cursor.line++;\n x = cursor.x = _alignStartEnd(align, this.left + padding, this.right - lineWidths[cursor.line]);\n }\n } else if (i > 0 && y + lineHeight > this.bottom) {\n x = cursor.x = x + columnSizes[cursor.line].width + padding;\n cursor.line++;\n y = cursor.y = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[cursor.line].height);\n }\n\n const realX = rtlHelper.x(x);\n\n drawLegendBox(realX, y, legendItem);\n\n x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : this.right, opts.rtl);\n\n // Fill the actual label\n fillText(rtlHelper.x(x), y, legendItem);\n\n if (isHorizontal) {\n cursor.x += width + padding;\n } else if (typeof legendItem.text !== 'string') {\n const fontLineHeight = labelFont.lineHeight;\n cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight);\n } else {\n cursor.y += lineHeight;\n }\n });\n\n restoreTextDirection(this.ctx, opts.textDirection);\n }\n\n /**\n\t * @protected\n\t */\n drawTitle() {\n const opts = this.options;\n const titleOpts = opts.title;\n const titleFont = toFont(titleOpts.font);\n const titlePadding = toPadding(titleOpts.padding);\n\n if (!titleOpts.display) {\n return;\n }\n\n const rtlHelper = getRtlAdapter(opts.rtl, this.left, this.width);\n const ctx = this.ctx;\n const position = titleOpts.position;\n const halfFontSize = titleFont.size / 2;\n const topPaddingPlusHalfFontSize = titlePadding.top + halfFontSize;\n let y;\n\n // These defaults are used when the legend is vertical.\n // When horizontal, they are computed below.\n let left = this.left;\n let maxWidth = this.width;\n\n if (this.isHorizontal()) {\n // Move left / right so that the title is above the legend lines\n maxWidth = Math.max(...this.lineWidths);\n y = this.top + topPaddingPlusHalfFontSize;\n left = _alignStartEnd(opts.align, left, this.right - maxWidth);\n } else {\n // Move down so that the title is above the legend stack in every alignment\n const maxHeight = this.columnSizes.reduce((acc, size) => Math.max(acc, size.height), 0);\n y = topPaddingPlusHalfFontSize + _alignStartEnd(opts.align, this.top, this.bottom - maxHeight - opts.labels.padding - this._computeTitleHeight());\n }\n\n // Now that we know the left edge of the inner legend box, compute the correct\n // X coordinate from the title alignment\n const x = _alignStartEnd(position, left, left + maxWidth);\n\n // Canvas setup\n ctx.textAlign = rtlHelper.textAlign(_toLeftRightCenter(position));\n ctx.textBaseline = 'middle';\n ctx.strokeStyle = titleOpts.color;\n ctx.fillStyle = titleOpts.color;\n ctx.font = titleFont.string;\n\n renderText(ctx, titleOpts.text, x, y, titleFont);\n }\n\n /**\n\t * @private\n\t */\n _computeTitleHeight() {\n const titleOpts = this.options.title;\n const titleFont = toFont(titleOpts.font);\n const titlePadding = toPadding(titleOpts.padding);\n return titleOpts.display ? titleFont.lineHeight + titlePadding.height : 0;\n }\n\n /**\n\t * @private\n\t */\n _getLegendItemAt(x, y) {\n let i, hitBox, lh;\n\n if (_isBetween(x, this.left, this.right)\n && _isBetween(y, this.top, this.bottom)) {\n // See if we are touching one of the dataset boxes\n lh = this.legendHitBoxes;\n for (i = 0; i < lh.length; ++i) {\n hitBox = lh[i];\n\n if (_isBetween(x, hitBox.left, hitBox.left + hitBox.width)\n && _isBetween(y, hitBox.top, hitBox.top + hitBox.height)) {\n // Touching an element\n return this.legendItems[i];\n }\n }\n }\n\n return null;\n }\n\n /**\n\t * Handle an event\n\t * @param {ChartEvent} e - The event to handle\n\t */\n handleEvent(e) {\n const opts = this.options;\n if (!isListened(e.type, opts)) {\n return;\n }\n\n // Chart event already has relative position in it\n const hoveredItem = this._getLegendItemAt(e.x, e.y);\n\n if (e.type === 'mousemove' || e.type === 'mouseout') {\n const previous = this._hoveredItem;\n const sameItem = itemsEqual(previous, hoveredItem);\n if (previous && !sameItem) {\n call(opts.onLeave, [e, previous, this], this);\n }\n\n this._hoveredItem = hoveredItem;\n\n if (hoveredItem && !sameItem) {\n call(opts.onHover, [e, hoveredItem, this], this);\n }\n } else if (hoveredItem) {\n call(opts.onClick, [e, hoveredItem, this], this);\n }\n }\n}\n\nfunction calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight) {\n const itemWidth = calculateItemWidth(legendItem, boxWidth, labelFont, ctx);\n const itemHeight = calculateItemHeight(_itemHeight, legendItem, labelFont.lineHeight);\n return {itemWidth, itemHeight};\n}\n\nfunction calculateItemWidth(legendItem, boxWidth, labelFont, ctx) {\n let legendItemText = legendItem.text;\n if (legendItemText && typeof legendItemText !== 'string') {\n legendItemText = legendItemText.reduce((a, b) => a.length > b.length ? a : b);\n }\n return boxWidth + (labelFont.size / 2) + ctx.measureText(legendItemText).width;\n}\n\nfunction calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {\n let itemHeight = _itemHeight;\n if (typeof legendItem.text !== 'string') {\n itemHeight = calculateLegendItemHeight(legendItem, fontLineHeight);\n }\n return itemHeight;\n}\n\nfunction calculateLegendItemHeight(legendItem, fontLineHeight) {\n const labelHeight = legendItem.text ? legendItem.text.length + 0.5 : 0;\n return fontLineHeight * labelHeight;\n}\n\nfunction isListened(type, opts) {\n if ((type === 'mousemove' || type === 'mouseout') && (opts.onHover || opts.onLeave)) {\n return true;\n }\n if (opts.onClick && (type === 'click' || type === 'mouseup')) {\n return true;\n }\n return false;\n}\n\nexport default {\n id: 'legend',\n\n /**\n\t * For tests\n\t * @private\n\t */\n _element: Legend,\n\n start(chart, _args, options) {\n const legend = chart.legend = new Legend({ctx: chart.ctx, options, chart});\n layouts.configure(chart, legend, options);\n layouts.addBox(chart, legend);\n },\n\n stop(chart) {\n layouts.removeBox(chart, chart.legend);\n delete chart.legend;\n },\n\n // During the beforeUpdate step, the layout configuration needs to run\n // This ensures that if the legend position changes (via an option update)\n // the layout system respects the change. See https://github.com/chartjs/Chart.js/issues/7527\n beforeUpdate(chart, _args, options) {\n const legend = chart.legend;\n layouts.configure(chart, legend, options);\n legend.options = options;\n },\n\n // The labels need to be built after datasets are updated to ensure that colors\n // and other styling are correct. See https://github.com/chartjs/Chart.js/issues/6968\n afterUpdate(chart) {\n const legend = chart.legend;\n legend.buildLabels();\n legend.adjustHitBoxes();\n },\n\n\n afterEvent(chart, args) {\n if (!args.replay) {\n chart.legend.handleEvent(args.event);\n }\n },\n\n defaults: {\n display: true,\n position: 'top',\n align: 'center',\n fullSize: true,\n reverse: false,\n weight: 1000,\n\n // a callback that will handle\n onClick(e, legendItem, legend) {\n const index = legendItem.datasetIndex;\n const ci = legend.chart;\n if (ci.isDatasetVisible(index)) {\n ci.hide(index);\n legendItem.hidden = true;\n } else {\n ci.show(index);\n legendItem.hidden = false;\n }\n },\n\n onHover: null,\n onLeave: null,\n\n labels: {\n color: (ctx) => ctx.chart.options.color,\n boxWidth: 40,\n padding: 10,\n // Generates labels shown in the legend\n // Valid properties to return:\n // text : text to display\n // fillStyle : fill of coloured box\n // strokeStyle: stroke of coloured box\n // hidden : if this legend item refers to a hidden item\n // lineCap : cap style for line\n // lineDash\n // lineDashOffset :\n // lineJoin :\n // lineWidth :\n generateLabels(chart) {\n const datasets = chart.data.datasets;\n const {labels: {usePointStyle, pointStyle, textAlign, color, useBorderRadius, borderRadius}} = chart.legend.options;\n\n return chart._getSortedDatasetMetas().map((meta) => {\n const style = meta.controller.getStyle(usePointStyle ? 0 : undefined);\n const borderWidth = toPadding(style.borderWidth);\n\n return {\n text: datasets[meta.index].label,\n fillStyle: style.backgroundColor,\n fontColor: color,\n hidden: !meta.visible,\n lineCap: style.borderCapStyle,\n lineDash: style.borderDash,\n lineDashOffset: style.borderDashOffset,\n lineJoin: style.borderJoinStyle,\n lineWidth: (borderWidth.width + borderWidth.height) / 4,\n strokeStyle: style.borderColor,\n pointStyle: pointStyle || style.pointStyle,\n rotation: style.rotation,\n textAlign: textAlign || style.textAlign,\n borderRadius: useBorderRadius && (borderRadius || style.borderRadius),\n\n // Below is extra data used for toggling the datasets\n datasetIndex: meta.index\n };\n }, this);\n }\n },\n\n title: {\n color: (ctx) => ctx.chart.options.color,\n display: false,\n position: 'center',\n text: '',\n }\n },\n\n descriptors: {\n _scriptable: (name) => !name.startsWith('on'),\n labels: {\n _scriptable: (name) => !['generateLabels', 'filter', 'sort'].includes(name),\n }\n },\n};\n","import Element from '../core/core.element';\nimport layouts from '../core/core.layouts';\nimport {PI, isArray, toPadding, toFont} from '../helpers';\nimport {_toLeftRightCenter, _alignStartEnd} from '../helpers/helpers.extras';\nimport {renderText} from '../helpers/helpers.canvas';\n\nexport class Title extends Element {\n /**\n\t * @param {{ ctx: any; options: any; chart: any; }} config\n\t */\n constructor(config) {\n super();\n\n this.chart = config.chart;\n this.options = config.options;\n this.ctx = config.ctx;\n this._padding = undefined;\n this.top = undefined;\n this.bottom = undefined;\n this.left = undefined;\n this.right = undefined;\n this.width = undefined;\n this.height = undefined;\n this.position = undefined;\n this.weight = undefined;\n this.fullSize = undefined;\n }\n\n update(maxWidth, maxHeight) {\n const opts = this.options;\n\n this.left = 0;\n this.top = 0;\n\n if (!opts.display) {\n this.width = this.height = this.right = this.bottom = 0;\n return;\n }\n\n this.width = this.right = maxWidth;\n this.height = this.bottom = maxHeight;\n\n const lineCount = isArray(opts.text) ? opts.text.length : 1;\n this._padding = toPadding(opts.padding);\n const textSize = lineCount * toFont(opts.font).lineHeight + this._padding.height;\n\n if (this.isHorizontal()) {\n this.height = textSize;\n } else {\n this.width = textSize;\n }\n }\n\n isHorizontal() {\n const pos = this.options.position;\n return pos === 'top' || pos === 'bottom';\n }\n\n _drawArgs(offset) {\n const {top, left, bottom, right, options} = this;\n const align = options.align;\n let rotation = 0;\n let maxWidth, titleX, titleY;\n\n if (this.isHorizontal()) {\n titleX = _alignStartEnd(align, left, right);\n titleY = top + offset;\n maxWidth = right - left;\n } else {\n if (options.position === 'left') {\n titleX = left + offset;\n titleY = _alignStartEnd(align, bottom, top);\n rotation = PI * -0.5;\n } else {\n titleX = right - offset;\n titleY = _alignStartEnd(align, top, bottom);\n rotation = PI * 0.5;\n }\n maxWidth = bottom - top;\n }\n return {titleX, titleY, maxWidth, rotation};\n }\n\n draw() {\n const ctx = this.ctx;\n const opts = this.options;\n\n if (!opts.display) {\n return;\n }\n\n const fontOpts = toFont(opts.font);\n const lineHeight = fontOpts.lineHeight;\n const offset = lineHeight / 2 + this._padding.top;\n const {titleX, titleY, maxWidth, rotation} = this._drawArgs(offset);\n\n renderText(ctx, opts.text, 0, 0, fontOpts, {\n color: opts.color,\n maxWidth,\n rotation,\n textAlign: _toLeftRightCenter(opts.align),\n textBaseline: 'middle',\n translation: [titleX, titleY],\n });\n }\n}\n\nfunction createTitle(chart, titleOpts) {\n const title = new Title({\n ctx: chart.ctx,\n options: titleOpts,\n chart\n });\n\n layouts.configure(chart, title, titleOpts);\n layouts.addBox(chart, title);\n chart.titleBlock = title;\n}\n\nexport default {\n id: 'title',\n\n /**\n\t * For tests\n\t * @private\n\t */\n _element: Title,\n\n start(chart, _args, options) {\n createTitle(chart, options);\n },\n\n stop(chart) {\n const titleBlock = chart.titleBlock;\n layouts.removeBox(chart, titleBlock);\n delete chart.titleBlock;\n },\n\n beforeUpdate(chart, _args, options) {\n const title = chart.titleBlock;\n layouts.configure(chart, title, options);\n title.options = options;\n },\n\n defaults: {\n align: 'center',\n display: false,\n font: {\n weight: 'bold',\n },\n fullSize: true,\n padding: 10,\n position: 'top',\n text: '',\n weight: 2000 // by default greater than legend (1000) to be above\n },\n\n defaultRoutes: {\n color: 'color'\n },\n\n descriptors: {\n _scriptable: true,\n _indexable: false,\n },\n};\n","import {Title} from './plugin.title';\nimport layouts from '../core/core.layouts';\n\nconst map = new WeakMap();\n\nexport default {\n id: 'subtitle',\n\n start(chart, _args, options) {\n const title = new Title({\n ctx: chart.ctx,\n options,\n chart\n });\n\n layouts.configure(chart, title, options);\n layouts.addBox(chart, title);\n map.set(chart, title);\n },\n\n stop(chart) {\n layouts.removeBox(chart, map.get(chart));\n map.delete(chart);\n },\n\n beforeUpdate(chart, _args, options) {\n const title = map.get(chart);\n layouts.configure(chart, title, options);\n title.options = options;\n },\n\n defaults: {\n align: 'center',\n display: false,\n font: {\n weight: 'normal',\n },\n fullSize: true,\n padding: 0,\n position: 'top',\n text: '',\n weight: 1500 // by default greater than legend (1000) and smaller than title (2000)\n },\n\n defaultRoutes: {\n color: 'color'\n },\n\n descriptors: {\n _scriptable: true,\n _indexable: false,\n },\n};\n","import Animations from '../core/core.animations';\nimport Element from '../core/core.element';\nimport {addRoundedRectPath} from '../helpers/helpers.canvas';\nimport {each, noop, isNullOrUndef, isArray, _elementsEqual, isObject} from '../helpers/helpers.core';\nimport {toFont, toPadding, toTRBLCorners} from '../helpers/helpers.options';\nimport {getRtlAdapter, overrideTextDirection, restoreTextDirection} from '../helpers/helpers.rtl';\nimport {distanceBetweenPoints, _limitValue} from '../helpers/helpers.math';\nimport {createContext, drawPoint} from '../helpers';\n\n/**\n * @typedef { import(\"../platform/platform.base\").Chart } Chart\n * @typedef { import(\"../../types\").ChartEvent } ChartEvent\n * @typedef { import(\"../../types\").ActiveElement } ActiveElement\n * @typedef { import(\"../core/core.interaction\").InteractionItem } InteractionItem\n */\n\nconst positioners = {\n /**\n\t * Average mode places the tooltip at the average position of the elements shown\n\t */\n average(items) {\n if (!items.length) {\n return false;\n }\n\n let i, len;\n let x = 0;\n let y = 0;\n let count = 0;\n\n for (i = 0, len = items.length; i < len; ++i) {\n const el = items[i].element;\n if (el && el.hasValue()) {\n const pos = el.tooltipPosition();\n x += pos.x;\n y += pos.y;\n ++count;\n }\n }\n\n return {\n x: x / count,\n y: y / count\n };\n },\n\n /**\n\t * Gets the tooltip position nearest of the item nearest to the event position\n\t */\n nearest(items, eventPosition) {\n if (!items.length) {\n return false;\n }\n\n let x = eventPosition.x;\n let y = eventPosition.y;\n let minDistance = Number.POSITIVE_INFINITY;\n let i, len, nearestElement;\n\n for (i = 0, len = items.length; i < len; ++i) {\n const el = items[i].element;\n if (el && el.hasValue()) {\n const center = el.getCenterPoint();\n const d = distanceBetweenPoints(eventPosition, center);\n\n if (d < minDistance) {\n minDistance = d;\n nearestElement = el;\n }\n }\n }\n\n if (nearestElement) {\n const tp = nearestElement.tooltipPosition();\n x = tp.x;\n y = tp.y;\n }\n\n return {\n x,\n y\n };\n }\n};\n\n// Helper to push or concat based on if the 2nd parameter is an array or not\nfunction pushOrConcat(base, toPush) {\n if (toPush) {\n if (isArray(toPush)) {\n // base = base.concat(toPush);\n Array.prototype.push.apply(base, toPush);\n } else {\n base.push(toPush);\n }\n }\n\n return base;\n}\n\n/**\n * Returns array of strings split by newline\n * @param {*} str - The value to split by newline.\n * @returns {string|string[]} value if newline present - Returned from String split() method\n * @function\n */\nfunction splitNewlines(str) {\n if ((typeof str === 'string' || str instanceof String) && str.indexOf('\\n') > -1) {\n return str.split('\\n');\n }\n return str;\n}\n\n\n/**\n * Private helper to create a tooltip item model\n * @param {Chart} chart\n * @param {ActiveElement} item - {element, index, datasetIndex} to create the tooltip item for\n * @return new tooltip item\n */\nfunction createTooltipItem(chart, item) {\n const {element, datasetIndex, index} = item;\n const controller = chart.getDatasetMeta(datasetIndex).controller;\n const {label, value} = controller.getLabelAndValue(index);\n\n return {\n chart,\n label,\n parsed: controller.getParsed(index),\n raw: chart.data.datasets[datasetIndex].data[index],\n formattedValue: value,\n dataset: controller.getDataset(),\n dataIndex: index,\n datasetIndex,\n element\n };\n}\n\n/**\n * Get the size of the tooltip\n */\nfunction getTooltipSize(tooltip, options) {\n const ctx = tooltip.chart.ctx;\n const {body, footer, title} = tooltip;\n const {boxWidth, boxHeight} = options;\n const bodyFont = toFont(options.bodyFont);\n const titleFont = toFont(options.titleFont);\n const footerFont = toFont(options.footerFont);\n const titleLineCount = title.length;\n const footerLineCount = footer.length;\n const bodyLineItemCount = body.length;\n\n const padding = toPadding(options.padding);\n let height = padding.height;\n let width = 0;\n\n // Count of all lines in the body\n let combinedBodyLength = body.reduce((count, bodyItem) => count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length, 0);\n combinedBodyLength += tooltip.beforeBody.length + tooltip.afterBody.length;\n\n if (titleLineCount) {\n height += titleLineCount * titleFont.lineHeight\n\t\t\t+ (titleLineCount - 1) * options.titleSpacing\n\t\t\t+ options.titleMarginBottom;\n }\n if (combinedBodyLength) {\n // Body lines may include some extra height depending on boxHeight\n const bodyLineHeight = options.displayColors ? Math.max(boxHeight, bodyFont.lineHeight) : bodyFont.lineHeight;\n height += bodyLineItemCount * bodyLineHeight\n\t\t\t+ (combinedBodyLength - bodyLineItemCount) * bodyFont.lineHeight\n\t\t\t+ (combinedBodyLength - 1) * options.bodySpacing;\n }\n if (footerLineCount) {\n height += options.footerMarginTop\n\t\t\t+ footerLineCount * footerFont.lineHeight\n\t\t\t+ (footerLineCount - 1) * options.footerSpacing;\n }\n\n // Title width\n let widthPadding = 0;\n const maxLineWidth = function(line) {\n width = Math.max(width, ctx.measureText(line).width + widthPadding);\n };\n\n ctx.save();\n\n ctx.font = titleFont.string;\n each(tooltip.title, maxLineWidth);\n\n // Body width\n ctx.font = bodyFont.string;\n each(tooltip.beforeBody.concat(tooltip.afterBody), maxLineWidth);\n\n // Body lines may include some extra width due to the color box\n widthPadding = options.displayColors ? (boxWidth + 2 + options.boxPadding) : 0;\n each(body, (bodyItem) => {\n each(bodyItem.before, maxLineWidth);\n each(bodyItem.lines, maxLineWidth);\n each(bodyItem.after, maxLineWidth);\n });\n\n // Reset back to 0\n widthPadding = 0;\n\n // Footer width\n ctx.font = footerFont.string;\n each(tooltip.footer, maxLineWidth);\n\n ctx.restore();\n\n // Add padding\n width += padding.width;\n\n return {width, height};\n}\n\nfunction determineYAlign(chart, size) {\n const {y, height} = size;\n\n if (y < height / 2) {\n return 'top';\n } else if (y > (chart.height - height / 2)) {\n return 'bottom';\n }\n return 'center';\n}\n\nfunction doesNotFitWithAlign(xAlign, chart, options, size) {\n const {x, width} = size;\n const caret = options.caretSize + options.caretPadding;\n if (xAlign === 'left' && x + width + caret > chart.width) {\n return true;\n }\n\n if (xAlign === 'right' && x - width - caret < 0) {\n return true;\n }\n}\n\nfunction determineXAlign(chart, options, size, yAlign) {\n const {x, width} = size;\n const {width: chartWidth, chartArea: {left, right}} = chart;\n let xAlign = 'center';\n\n if (yAlign === 'center') {\n xAlign = x <= (left + right) / 2 ? 'left' : 'right';\n } else if (x <= width / 2) {\n xAlign = 'left';\n } else if (x >= chartWidth - width / 2) {\n xAlign = 'right';\n }\n\n if (doesNotFitWithAlign(xAlign, chart, options, size)) {\n xAlign = 'center';\n }\n\n return xAlign;\n}\n\n/**\n * Helper to get the alignment of a tooltip given the size\n */\nfunction determineAlignment(chart, options, size) {\n const yAlign = size.yAlign || options.yAlign || determineYAlign(chart, size);\n\n return {\n xAlign: size.xAlign || options.xAlign || determineXAlign(chart, options, size, yAlign),\n yAlign\n };\n}\n\nfunction alignX(size, xAlign) {\n let {x, width} = size;\n if (xAlign === 'right') {\n x -= width;\n } else if (xAlign === 'center') {\n x -= (width / 2);\n }\n return x;\n}\n\nfunction alignY(size, yAlign, paddingAndSize) {\n // eslint-disable-next-line prefer-const\n let {y, height} = size;\n if (yAlign === 'top') {\n y += paddingAndSize;\n } else if (yAlign === 'bottom') {\n y -= height + paddingAndSize;\n } else {\n y -= (height / 2);\n }\n return y;\n}\n\n/**\n * Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment\n */\nfunction getBackgroundPoint(options, size, alignment, chart) {\n const {caretSize, caretPadding, cornerRadius} = options;\n const {xAlign, yAlign} = alignment;\n const paddingAndSize = caretSize + caretPadding;\n const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(cornerRadius);\n\n let x = alignX(size, xAlign);\n const y = alignY(size, yAlign, paddingAndSize);\n\n if (yAlign === 'center') {\n if (xAlign === 'left') {\n x += paddingAndSize;\n } else if (xAlign === 'right') {\n x -= paddingAndSize;\n }\n } else if (xAlign === 'left') {\n x -= Math.max(topLeft, bottomLeft) + caretSize;\n } else if (xAlign === 'right') {\n x += Math.max(topRight, bottomRight) + caretSize;\n }\n\n return {\n x: _limitValue(x, 0, chart.width - size.width),\n y: _limitValue(y, 0, chart.height - size.height)\n };\n}\n\nfunction getAlignedX(tooltip, align, options) {\n const padding = toPadding(options.padding);\n\n return align === 'center'\n ? tooltip.x + tooltip.width / 2\n : align === 'right'\n ? tooltip.x + tooltip.width - padding.right\n : tooltip.x + padding.left;\n}\n\n/**\n * Helper to build before and after body lines\n */\nfunction getBeforeAfterBodyLines(callback) {\n return pushOrConcat([], splitNewlines(callback));\n}\n\nfunction createTooltipContext(parent, tooltip, tooltipItems) {\n return createContext(parent, {\n tooltip,\n tooltipItems,\n type: 'tooltip'\n });\n}\n\nfunction overrideCallbacks(callbacks, context) {\n const override = context && context.dataset && context.dataset.tooltip && context.dataset.tooltip.callbacks;\n return override ? callbacks.override(override) : callbacks;\n}\n\nconst defaultCallbacks = {\n // Args are: (tooltipItems, data)\n beforeTitle: noop,\n title(tooltipItems) {\n if (tooltipItems.length > 0) {\n const item = tooltipItems[0];\n const labels = item.chart.data.labels;\n const labelCount = labels ? labels.length : 0;\n\n if (this && this.options && this.options.mode === 'dataset') {\n return item.dataset.label || '';\n } else if (item.label) {\n return item.label;\n } else if (labelCount > 0 && item.dataIndex < labelCount) {\n return labels[item.dataIndex];\n }\n }\n\n return '';\n },\n afterTitle: noop,\n\n // Args are: (tooltipItems, data)\n beforeBody: noop,\n\n // Args are: (tooltipItem, data)\n beforeLabel: noop,\n label(tooltipItem) {\n if (this && this.options && this.options.mode === 'dataset') {\n return tooltipItem.label + ': ' + tooltipItem.formattedValue || tooltipItem.formattedValue;\n }\n\n let label = tooltipItem.dataset.label || '';\n\n if (label) {\n label += ': ';\n }\n const value = tooltipItem.formattedValue;\n if (!isNullOrUndef(value)) {\n label += value;\n }\n return label;\n },\n labelColor(tooltipItem) {\n const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n const options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n borderColor: options.borderColor,\n backgroundColor: options.backgroundColor,\n borderWidth: options.borderWidth,\n borderDash: options.borderDash,\n borderDashOffset: options.borderDashOffset,\n borderRadius: 0,\n };\n },\n labelTextColor() {\n return this.options.bodyColor;\n },\n labelPointStyle(tooltipItem) {\n const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);\n const options = meta.controller.getStyle(tooltipItem.dataIndex);\n return {\n pointStyle: options.pointStyle,\n rotation: options.rotation,\n };\n },\n afterLabel: noop,\n\n // Args are: (tooltipItems, data)\n afterBody: noop,\n\n // Args are: (tooltipItems, data)\n beforeFooter: noop,\n footer: noop,\n afterFooter: noop\n};\n\n/**\n * Invoke callback from object with context and arguments.\n * If callback returns `undefined`, then will be invoked default callback.\n * @param {Record} callbacks\n * @param {keyof typeof defaultCallbacks} name\n * @param {*} ctx\n * @param {*} arg\n * @returns {any}\n */\nfunction invokeCallbackWithFallback(callbacks, name, ctx, arg) {\n const result = callbacks[name].call(ctx, arg);\n\n if (typeof result === 'undefined') {\n return defaultCallbacks[name].call(ctx, arg);\n }\n\n return result;\n}\n\nexport class Tooltip extends Element {\n\n /**\n * @namespace Chart.Tooltip.positioners\n */\n static positioners = positioners;\n\n constructor(config) {\n super();\n\n this.opacity = 0;\n this._active = [];\n this._eventPosition = undefined;\n this._size = undefined;\n this._cachedAnimations = undefined;\n this._tooltipItems = [];\n this.$animations = undefined;\n this.$context = undefined;\n this.chart = config.chart;\n this.options = config.options;\n this.dataPoints = undefined;\n this.title = undefined;\n this.beforeBody = undefined;\n this.body = undefined;\n this.afterBody = undefined;\n this.footer = undefined;\n this.xAlign = undefined;\n this.yAlign = undefined;\n this.x = undefined;\n this.y = undefined;\n this.height = undefined;\n this.width = undefined;\n this.caretX = undefined;\n this.caretY = undefined;\n // TODO: V4, make this private, rename to `_labelStyles`, and combine with `labelPointStyles`\n // and `labelTextColors` to create a single variable\n this.labelColors = undefined;\n this.labelPointStyles = undefined;\n this.labelTextColors = undefined;\n }\n\n initialize(options) {\n this.options = options;\n this._cachedAnimations = undefined;\n this.$context = undefined;\n }\n\n /**\n\t * @private\n\t */\n _resolveAnimations() {\n const cached = this._cachedAnimations;\n\n if (cached) {\n return cached;\n }\n\n const chart = this.chart;\n const options = this.options.setContext(this.getContext());\n const opts = options.enabled && chart.options.animation && options.animations;\n const animations = new Animations(this.chart, opts);\n if (opts._cacheable) {\n this._cachedAnimations = Object.freeze(animations);\n }\n\n return animations;\n }\n\n /**\n\t * @protected\n\t */\n getContext() {\n return this.$context ||\n\t\t\t(this.$context = createTooltipContext(this.chart.getContext(), this, this._tooltipItems));\n }\n\n getTitle(context, options) {\n const {callbacks} = options;\n\n const beforeTitle = invokeCallbackWithFallback(callbacks, 'beforeTitle', this, context);\n const title = invokeCallbackWithFallback(callbacks, 'title', this, context);\n const afterTitle = invokeCallbackWithFallback(callbacks, 'afterTitle', this, context);\n\n let lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeTitle));\n lines = pushOrConcat(lines, splitNewlines(title));\n lines = pushOrConcat(lines, splitNewlines(afterTitle));\n\n return lines;\n }\n\n getBeforeBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(\n invokeCallbackWithFallback(options.callbacks, 'beforeBody', this, tooltipItems)\n );\n }\n\n getBody(tooltipItems, options) {\n const {callbacks} = options;\n const bodyItems = [];\n\n each(tooltipItems, (context) => {\n const bodyItem = {\n before: [],\n lines: [],\n after: []\n };\n const scoped = overrideCallbacks(callbacks, context);\n pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, 'beforeLabel', this, context)));\n pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, 'label', this, context));\n pushOrConcat(bodyItem.after, splitNewlines(invokeCallbackWithFallback(scoped, 'afterLabel', this, context)));\n\n bodyItems.push(bodyItem);\n });\n\n return bodyItems;\n }\n\n getAfterBody(tooltipItems, options) {\n return getBeforeAfterBodyLines(\n invokeCallbackWithFallback(options.callbacks, 'afterBody', this, tooltipItems)\n );\n }\n\n // Get the footer and beforeFooter and afterFooter lines\n getFooter(tooltipItems, options) {\n const {callbacks} = options;\n\n const beforeFooter = invokeCallbackWithFallback(callbacks, 'beforeFooter', this, tooltipItems);\n const footer = invokeCallbackWithFallback(callbacks, 'footer', this, tooltipItems);\n const afterFooter = invokeCallbackWithFallback(callbacks, 'afterFooter', this, tooltipItems);\n\n let lines = [];\n lines = pushOrConcat(lines, splitNewlines(beforeFooter));\n lines = pushOrConcat(lines, splitNewlines(footer));\n lines = pushOrConcat(lines, splitNewlines(afterFooter));\n\n return lines;\n }\n\n /**\n\t * @private\n\t */\n _createItems(options) {\n const active = this._active;\n const data = this.chart.data;\n const labelColors = [];\n const labelPointStyles = [];\n const labelTextColors = [];\n let tooltipItems = [];\n let i, len;\n\n for (i = 0, len = active.length; i < len; ++i) {\n tooltipItems.push(createTooltipItem(this.chart, active[i]));\n }\n\n // If the user provided a filter function, use it to modify the tooltip items\n if (options.filter) {\n tooltipItems = tooltipItems.filter((element, index, array) => options.filter(element, index, array, data));\n }\n\n // If the user provided a sorting function, use it to modify the tooltip items\n if (options.itemSort) {\n tooltipItems = tooltipItems.sort((a, b) => options.itemSort(a, b, data));\n }\n\n // Determine colors for boxes\n each(tooltipItems, (context) => {\n const scoped = overrideCallbacks(options.callbacks, context);\n labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor', this, context));\n labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle', this, context));\n labelTextColors.push(invokeCallbackWithFallback(scoped, 'labelTextColor', this, context));\n });\n\n this.labelColors = labelColors;\n this.labelPointStyles = labelPointStyles;\n this.labelTextColors = labelTextColors;\n this.dataPoints = tooltipItems;\n return tooltipItems;\n }\n\n update(changed, replay) {\n const options = this.options.setContext(this.getContext());\n const active = this._active;\n let properties;\n let tooltipItems = [];\n\n if (!active.length) {\n if (this.opacity !== 0) {\n properties = {\n opacity: 0\n };\n }\n } else {\n const position = positioners[options.position].call(this, active, this._eventPosition);\n tooltipItems = this._createItems(options);\n\n this.title = this.getTitle(tooltipItems, options);\n this.beforeBody = this.getBeforeBody(tooltipItems, options);\n this.body = this.getBody(tooltipItems, options);\n this.afterBody = this.getAfterBody(tooltipItems, options);\n this.footer = this.getFooter(tooltipItems, options);\n\n const size = this._size = getTooltipSize(this, options);\n const positionAndSize = Object.assign({}, position, size);\n const alignment = determineAlignment(this.chart, options, positionAndSize);\n const backgroundPoint = getBackgroundPoint(options, positionAndSize, alignment, this.chart);\n\n this.xAlign = alignment.xAlign;\n this.yAlign = alignment.yAlign;\n\n properties = {\n opacity: 1,\n x: backgroundPoint.x,\n y: backgroundPoint.y,\n width: size.width,\n height: size.height,\n caretX: position.x,\n caretY: position.y\n };\n }\n\n this._tooltipItems = tooltipItems;\n this.$context = undefined;\n\n if (properties) {\n this._resolveAnimations().update(this, properties);\n }\n\n if (changed && options.external) {\n options.external.call(this, {chart: this.chart, tooltip: this, replay});\n }\n }\n\n drawCaret(tooltipPoint, ctx, size, options) {\n const caretPosition = this.getCaretPosition(tooltipPoint, size, options);\n\n ctx.lineTo(caretPosition.x1, caretPosition.y1);\n ctx.lineTo(caretPosition.x2, caretPosition.y2);\n ctx.lineTo(caretPosition.x3, caretPosition.y3);\n }\n\n getCaretPosition(tooltipPoint, size, options) {\n const {xAlign, yAlign} = this;\n const {caretSize, cornerRadius} = options;\n const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(cornerRadius);\n const {x: ptX, y: ptY} = tooltipPoint;\n const {width, height} = size;\n let x1, x2, x3, y1, y2, y3;\n\n if (yAlign === 'center') {\n y2 = ptY + (height / 2);\n\n if (xAlign === 'left') {\n x1 = ptX;\n x2 = x1 - caretSize;\n\n // Left draws bottom -> top, this y1 is on the bottom\n y1 = y2 + caretSize;\n y3 = y2 - caretSize;\n } else {\n x1 = ptX + width;\n x2 = x1 + caretSize;\n\n // Right draws top -> bottom, thus y1 is on the top\n y1 = y2 - caretSize;\n y3 = y2 + caretSize;\n }\n\n x3 = x1;\n } else {\n if (xAlign === 'left') {\n x2 = ptX + Math.max(topLeft, bottomLeft) + (caretSize);\n } else if (xAlign === 'right') {\n x2 = ptX + width - Math.max(topRight, bottomRight) - caretSize;\n } else {\n x2 = this.caretX;\n }\n\n if (yAlign === 'top') {\n y1 = ptY;\n y2 = y1 - caretSize;\n\n // Top draws left -> right, thus x1 is on the left\n x1 = x2 - caretSize;\n x3 = x2 + caretSize;\n } else {\n y1 = ptY + height;\n y2 = y1 + caretSize;\n\n // Bottom draws right -> left, thus x1 is on the right\n x1 = x2 + caretSize;\n x3 = x2 - caretSize;\n }\n y3 = y1;\n }\n return {x1, x2, x3, y1, y2, y3};\n }\n\n drawTitle(pt, ctx, options) {\n const title = this.title;\n const length = title.length;\n let titleFont, titleSpacing, i;\n\n if (length) {\n const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);\n\n pt.x = getAlignedX(this, options.titleAlign, options);\n\n ctx.textAlign = rtlHelper.textAlign(options.titleAlign);\n ctx.textBaseline = 'middle';\n\n titleFont = toFont(options.titleFont);\n titleSpacing = options.titleSpacing;\n\n ctx.fillStyle = options.titleColor;\n ctx.font = titleFont.string;\n\n for (i = 0; i < length; ++i) {\n ctx.fillText(title[i], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2);\n pt.y += titleFont.lineHeight + titleSpacing; // Line Height and spacing\n\n if (i + 1 === length) {\n pt.y += options.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing\n }\n }\n }\n }\n\n /**\n\t * @private\n\t */\n _drawColorBox(ctx, pt, i, rtlHelper, options) {\n const labelColors = this.labelColors[i];\n const labelPointStyle = this.labelPointStyles[i];\n const {boxHeight, boxWidth, boxPadding} = options;\n const bodyFont = toFont(options.bodyFont);\n const colorX = getAlignedX(this, 'left', options);\n const rtlColorX = rtlHelper.x(colorX);\n const yOffSet = boxHeight < bodyFont.lineHeight ? (bodyFont.lineHeight - boxHeight) / 2 : 0;\n const colorY = pt.y + yOffSet;\n\n if (options.usePointStyle) {\n const drawOptions = {\n radius: Math.min(boxWidth, boxHeight) / 2, // fit the circle in the box\n pointStyle: labelPointStyle.pointStyle,\n rotation: labelPointStyle.rotation,\n borderWidth: 1\n };\n // Recalculate x and y for drawPoint() because its expecting\n // x and y to be center of figure (instead of top left)\n const centerX = rtlHelper.leftForLtr(rtlColorX, boxWidth) + boxWidth / 2;\n const centerY = colorY + boxHeight / 2;\n\n // Fill the point with white so that colours merge nicely if the opacity is < 1\n ctx.strokeStyle = options.multiKeyBackground;\n ctx.fillStyle = options.multiKeyBackground;\n drawPoint(ctx, drawOptions, centerX, centerY);\n\n // Draw the point\n ctx.strokeStyle = labelColors.borderColor;\n ctx.fillStyle = labelColors.backgroundColor;\n drawPoint(ctx, drawOptions, centerX, centerY);\n } else {\n // Border\n ctx.lineWidth = isObject(labelColors.borderWidth) ? Math.max(...Object.values(labelColors.borderWidth)) : (labelColors.borderWidth || 1); // TODO, v4 remove fallback\n ctx.strokeStyle = labelColors.borderColor;\n ctx.setLineDash(labelColors.borderDash || []);\n ctx.lineDashOffset = labelColors.borderDashOffset || 0;\n\n // Fill a white rect so that colours merge nicely if the opacity is < 1\n const outerX = rtlHelper.leftForLtr(rtlColorX, boxWidth - boxPadding);\n const innerX = rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), boxWidth - boxPadding - 2);\n const borderRadius = toTRBLCorners(labelColors.borderRadius);\n\n if (Object.values(borderRadius).some(v => v !== 0)) {\n ctx.beginPath();\n ctx.fillStyle = options.multiKeyBackground;\n addRoundedRectPath(ctx, {\n x: outerX,\n y: colorY,\n w: boxWidth,\n h: boxHeight,\n radius: borderRadius,\n });\n ctx.fill();\n ctx.stroke();\n\n // Inner square\n ctx.fillStyle = labelColors.backgroundColor;\n ctx.beginPath();\n addRoundedRectPath(ctx, {\n x: innerX,\n y: colorY + 1,\n w: boxWidth - 2,\n h: boxHeight - 2,\n radius: borderRadius,\n });\n ctx.fill();\n } else {\n // Normal rect\n ctx.fillStyle = options.multiKeyBackground;\n ctx.fillRect(outerX, colorY, boxWidth, boxHeight);\n ctx.strokeRect(outerX, colorY, boxWidth, boxHeight);\n // Inner square\n ctx.fillStyle = labelColors.backgroundColor;\n ctx.fillRect(innerX, colorY + 1, boxWidth - 2, boxHeight - 2);\n }\n }\n\n // restore fillStyle\n ctx.fillStyle = this.labelTextColors[i];\n }\n\n drawBody(pt, ctx, options) {\n const {body} = this;\n const {bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth, boxPadding} = options;\n const bodyFont = toFont(options.bodyFont);\n let bodyLineHeight = bodyFont.lineHeight;\n let xLinePadding = 0;\n\n const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);\n\n const fillLineOfText = function(line) {\n ctx.fillText(line, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyLineHeight / 2);\n pt.y += bodyLineHeight + bodySpacing;\n };\n\n const bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);\n let bodyItem, textColor, lines, i, j, ilen, jlen;\n\n ctx.textAlign = bodyAlign;\n ctx.textBaseline = 'middle';\n ctx.font = bodyFont.string;\n\n pt.x = getAlignedX(this, bodyAlignForCalculation, options);\n\n // Before body lines\n ctx.fillStyle = options.bodyColor;\n each(this.beforeBody, fillLineOfText);\n\n xLinePadding = displayColors && bodyAlignForCalculation !== 'right'\n ? bodyAlign === 'center' ? (boxWidth / 2 + boxPadding) : (boxWidth + 2 + boxPadding)\n : 0;\n\n // Draw body lines now\n for (i = 0, ilen = body.length; i < ilen; ++i) {\n bodyItem = body[i];\n textColor = this.labelTextColors[i];\n\n ctx.fillStyle = textColor;\n each(bodyItem.before, fillLineOfText);\n\n lines = bodyItem.lines;\n // Draw Legend-like boxes if needed\n if (displayColors && lines.length) {\n this._drawColorBox(ctx, pt, i, rtlHelper, options);\n bodyLineHeight = Math.max(bodyFont.lineHeight, boxHeight);\n }\n\n for (j = 0, jlen = lines.length; j < jlen; ++j) {\n fillLineOfText(lines[j]);\n // Reset for any lines that don't include colorbox\n bodyLineHeight = bodyFont.lineHeight;\n }\n\n each(bodyItem.after, fillLineOfText);\n }\n\n // Reset back to 0 for after body\n xLinePadding = 0;\n bodyLineHeight = bodyFont.lineHeight;\n\n // After body lines\n each(this.afterBody, fillLineOfText);\n pt.y -= bodySpacing; // Remove last body spacing\n }\n\n drawFooter(pt, ctx, options) {\n const footer = this.footer;\n const length = footer.length;\n let footerFont, i;\n\n if (length) {\n const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);\n\n pt.x = getAlignedX(this, options.footerAlign, options);\n pt.y += options.footerMarginTop;\n\n ctx.textAlign = rtlHelper.textAlign(options.footerAlign);\n ctx.textBaseline = 'middle';\n\n footerFont = toFont(options.footerFont);\n\n ctx.fillStyle = options.footerColor;\n ctx.font = footerFont.string;\n\n for (i = 0; i < length; ++i) {\n ctx.fillText(footer[i], rtlHelper.x(pt.x), pt.y + footerFont.lineHeight / 2);\n pt.y += footerFont.lineHeight + options.footerSpacing;\n }\n }\n }\n\n drawBackground(pt, ctx, tooltipSize, options) {\n const {xAlign, yAlign} = this;\n const {x, y} = pt;\n const {width, height} = tooltipSize;\n const {topLeft, topRight, bottomLeft, bottomRight} = toTRBLCorners(options.cornerRadius);\n\n ctx.fillStyle = options.backgroundColor;\n ctx.strokeStyle = options.borderColor;\n ctx.lineWidth = options.borderWidth;\n\n ctx.beginPath();\n ctx.moveTo(x + topLeft, y);\n if (yAlign === 'top') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + width - topRight, y);\n ctx.quadraticCurveTo(x + width, y, x + width, y + topRight);\n if (yAlign === 'center' && xAlign === 'right') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + width, y + height - bottomRight);\n ctx.quadraticCurveTo(x + width, y + height, x + width - bottomRight, y + height);\n if (yAlign === 'bottom') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x + bottomLeft, y + height);\n ctx.quadraticCurveTo(x, y + height, x, y + height - bottomLeft);\n if (yAlign === 'center' && xAlign === 'left') {\n this.drawCaret(pt, ctx, tooltipSize, options);\n }\n ctx.lineTo(x, y + topLeft);\n ctx.quadraticCurveTo(x, y, x + topLeft, y);\n ctx.closePath();\n\n ctx.fill();\n\n if (options.borderWidth > 0) {\n ctx.stroke();\n }\n }\n\n /**\n\t * Update x/y animation targets when _active elements are animating too\n\t * @private\n\t */\n _updateAnimationTarget(options) {\n const chart = this.chart;\n const anims = this.$animations;\n const animX = anims && anims.x;\n const animY = anims && anims.y;\n if (animX || animY) {\n const position = positioners[options.position].call(this, this._active, this._eventPosition);\n if (!position) {\n return;\n }\n const size = this._size = getTooltipSize(this, options);\n const positionAndSize = Object.assign({}, position, this._size);\n const alignment = determineAlignment(chart, options, positionAndSize);\n const point = getBackgroundPoint(options, positionAndSize, alignment, chart);\n if (animX._to !== point.x || animY._to !== point.y) {\n this.xAlign = alignment.xAlign;\n this.yAlign = alignment.yAlign;\n this.width = size.width;\n this.height = size.height;\n this.caretX = position.x;\n this.caretY = position.y;\n this._resolveAnimations().update(this, point);\n }\n }\n }\n\n /**\n * Determine if the tooltip will draw anything\n * @returns {boolean} True if the tooltip will render\n */\n _willRender() {\n return !!this.opacity;\n }\n\n draw(ctx) {\n const options = this.options.setContext(this.getContext());\n let opacity = this.opacity;\n\n if (!opacity) {\n return;\n }\n\n this._updateAnimationTarget(options);\n\n const tooltipSize = {\n width: this.width,\n height: this.height\n };\n const pt = {\n x: this.x,\n y: this.y\n };\n\n // IE11/Edge does not like very small opacities, so snap to 0\n opacity = Math.abs(opacity) < 1e-3 ? 0 : opacity;\n\n const padding = toPadding(options.padding);\n\n // Truthy/falsey value for empty tooltip\n const hasTooltipContent = this.title.length || this.beforeBody.length || this.body.length || this.afterBody.length || this.footer.length;\n\n if (options.enabled && hasTooltipContent) {\n ctx.save();\n ctx.globalAlpha = opacity;\n\n // Draw Background\n this.drawBackground(pt, ctx, tooltipSize, options);\n\n overrideTextDirection(ctx, options.textDirection);\n\n pt.y += padding.top;\n\n // Titles\n this.drawTitle(pt, ctx, options);\n\n // Body\n this.drawBody(pt, ctx, options);\n\n // Footer\n this.drawFooter(pt, ctx, options);\n\n restoreTextDirection(ctx, options.textDirection);\n\n ctx.restore();\n }\n }\n\n /**\n\t * Get active elements in the tooltip\n\t * @returns {Array} Array of elements that are active in the tooltip\n\t */\n getActiveElements() {\n return this._active || [];\n }\n\n /**\n\t * Set active elements in the tooltip\n\t * @param {array} activeElements Array of active datasetIndex/index pairs.\n\t * @param {object} eventPosition Synthetic event position used in positioning\n\t */\n setActiveElements(activeElements, eventPosition) {\n const lastActive = this._active;\n const active = activeElements.map(({datasetIndex, index}) => {\n const meta = this.chart.getDatasetMeta(datasetIndex);\n\n if (!meta) {\n throw new Error('Cannot find a dataset at index ' + datasetIndex);\n }\n\n return {\n datasetIndex,\n element: meta.data[index],\n index,\n };\n });\n const changed = !_elementsEqual(lastActive, active);\n const positionChanged = this._positionChanged(active, eventPosition);\n\n if (changed || positionChanged) {\n this._active = active;\n this._eventPosition = eventPosition;\n this._ignoreReplayEvents = true;\n this.update(true);\n }\n }\n\n /**\n\t * Handle an event\n\t * @param {ChartEvent} e - The event to handle\n\t * @param {boolean} [replay] - This is a replayed event (from update)\n\t * @param {boolean} [inChartArea] - The event is inside chartArea\n\t * @returns {boolean} true if the tooltip changed\n\t */\n handleEvent(e, replay, inChartArea = true) {\n if (replay && this._ignoreReplayEvents) {\n return false;\n }\n this._ignoreReplayEvents = false;\n\n const options = this.options;\n const lastActive = this._active || [];\n const active = this._getActiveElements(e, lastActive, replay, inChartArea);\n\n // When there are multiple items shown, but the tooltip position is nearest mode\n // an update may need to be made because our position may have changed even though\n // the items are the same as before.\n const positionChanged = this._positionChanged(active, e);\n\n // Remember Last Actives\n const changed = replay || !_elementsEqual(active, lastActive) || positionChanged;\n\n // Only handle target event on tooltip change\n if (changed) {\n this._active = active;\n\n if (options.enabled || options.external) {\n this._eventPosition = {\n x: e.x,\n y: e.y\n };\n\n this.update(true, replay);\n }\n }\n\n return changed;\n }\n\n /**\n\t * Helper for determining the active elements for event\n\t * @param {ChartEvent} e - The event to handle\n\t * @param {InteractionItem[]} lastActive - Previously active elements\n\t * @param {boolean} [replay] - This is a replayed event (from update)\n\t * @param {boolean} [inChartArea] - The event is inside chartArea\n\t * @returns {InteractionItem[]} - Active elements\n\t * @private\n\t */\n _getActiveElements(e, lastActive, replay, inChartArea) {\n const options = this.options;\n\n if (e.type === 'mouseout') {\n return [];\n }\n\n if (!inChartArea) {\n // Let user control the active elements outside chartArea. Eg. using Legend.\n return lastActive;\n }\n\n // Find Active Elements for tooltips\n const active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);\n\n if (options.reverse) {\n active.reverse();\n }\n\n return active;\n }\n\n /**\n\t * Determine if the active elements + event combination changes the\n\t * tooltip position\n\t * @param {array} active - Active elements\n\t * @param {ChartEvent} e - Event that triggered the position change\n\t * @returns {boolean} True if the position has changed\n\t */\n _positionChanged(active, e) {\n const {caretX, caretY, options} = this;\n const position = positioners[options.position].call(this, active, e);\n return position !== false && (caretX !== position.x || caretY !== position.y);\n }\n}\n\nexport default {\n id: 'tooltip',\n _element: Tooltip,\n positioners,\n\n afterInit(chart, _args, options) {\n if (options) {\n chart.tooltip = new Tooltip({chart, options});\n }\n },\n\n beforeUpdate(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n\n reset(chart, _args, options) {\n if (chart.tooltip) {\n chart.tooltip.initialize(options);\n }\n },\n\n afterDraw(chart) {\n const tooltip = chart.tooltip;\n\n if (tooltip && tooltip._willRender()) {\n const args = {\n tooltip\n };\n\n if (chart.notifyPlugins('beforeTooltipDraw', {...args, cancelable: true}) === false) {\n return;\n }\n\n tooltip.draw(chart.ctx);\n\n chart.notifyPlugins('afterTooltipDraw', args);\n }\n },\n\n afterEvent(chart, args) {\n if (chart.tooltip) {\n // If the event is replayed from `update`, we should evaluate with the final positions.\n const useFinalPosition = args.replay;\n if (chart.tooltip.handleEvent(args.event, useFinalPosition, args.inChartArea)) {\n // notify chart about the change, so it will render\n args.changed = true;\n }\n }\n },\n\n defaults: {\n enabled: true,\n external: null,\n position: 'average',\n backgroundColor: 'rgba(0,0,0,0.8)',\n titleColor: '#fff',\n titleFont: {\n weight: 'bold',\n },\n titleSpacing: 2,\n titleMarginBottom: 6,\n titleAlign: 'left',\n bodyColor: '#fff',\n bodySpacing: 2,\n bodyFont: {\n },\n bodyAlign: 'left',\n footerColor: '#fff',\n footerSpacing: 2,\n footerMarginTop: 6,\n footerFont: {\n weight: 'bold',\n },\n footerAlign: 'left',\n padding: 6,\n caretPadding: 2,\n caretSize: 5,\n cornerRadius: 6,\n boxHeight: (ctx, opts) => opts.bodyFont.size,\n boxWidth: (ctx, opts) => opts.bodyFont.size,\n multiKeyBackground: '#fff',\n displayColors: true,\n boxPadding: 0,\n borderColor: 'rgba(0,0,0,0)',\n borderWidth: 0,\n animation: {\n duration: 400,\n easing: 'easeOutQuart',\n },\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'width', 'height', 'caretX', 'caretY'],\n },\n opacity: {\n easing: 'linear',\n duration: 200\n }\n },\n callbacks: defaultCallbacks\n },\n\n defaultRoutes: {\n bodyFont: 'font',\n footerFont: 'font',\n titleFont: 'font'\n },\n\n descriptors: {\n _scriptable: (name) => name !== 'filter' && name !== 'itemSort' && name !== 'external',\n _indexable: false,\n callbacks: {\n _scriptable: false,\n _indexable: false,\n },\n animation: {\n _fallback: false\n },\n animations: {\n _fallback: 'animation'\n }\n },\n\n // Resolve additionally from `interaction` options and defaults.\n additionalOptionScopes: ['interaction']\n};\n","import Scale from '../core/core.scale';\nimport {isNullOrUndef, valueOrDefault, _limitValue} from '../helpers';\n\nconst addIfString = (labels, raw, index, addedLabels) => {\n if (typeof raw === 'string') {\n index = labels.push(raw) - 1;\n addedLabels.unshift({index, label: raw});\n } else if (isNaN(raw)) {\n index = null;\n }\n return index;\n};\n\nfunction findOrAddLabel(labels, raw, index, addedLabels) {\n const first = labels.indexOf(raw);\n if (first === -1) {\n return addIfString(labels, raw, index, addedLabels);\n }\n const last = labels.lastIndexOf(raw);\n return first !== last ? index : first;\n}\n\nconst validIndex = (index, max) => index === null ? null : _limitValue(Math.round(index), 0, max);\n\nfunction _getLabelForValue(value) {\n const labels = this.getLabels();\n\n if (value >= 0 && value < labels.length) {\n return labels[value];\n }\n return value;\n}\n\nexport default class CategoryScale extends Scale {\n\n static id = 'category';\n\n /**\n * @type {any}\n */\n static defaults = {\n ticks: {\n callback: _getLabelForValue\n }\n };\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this._startValue = undefined;\n this._valueRange = 0;\n this._addedLabels = [];\n }\n\n init(scaleOptions) {\n const added = this._addedLabels;\n if (added.length) {\n const labels = this.getLabels();\n for (const {index, label} of added) {\n if (labels[index] === label) {\n labels.splice(index, 1);\n }\n }\n this._addedLabels = [];\n }\n super.init(scaleOptions);\n }\n\n parse(raw, index) {\n if (isNullOrUndef(raw)) {\n return null;\n }\n const labels = this.getLabels();\n index = isFinite(index) && labels[index] === raw ? index\n : findOrAddLabel(labels, raw, valueOrDefault(index, raw), this._addedLabels);\n return validIndex(index, labels.length - 1);\n }\n\n determineDataLimits() {\n const {minDefined, maxDefined} = this.getUserBounds();\n let {min, max} = this.getMinMax(true);\n\n if (this.options.bounds === 'ticks') {\n if (!minDefined) {\n min = 0;\n }\n if (!maxDefined) {\n max = this.getLabels().length - 1;\n }\n }\n\n this.min = min;\n this.max = max;\n }\n\n buildTicks() {\n const min = this.min;\n const max = this.max;\n const offset = this.options.offset;\n const ticks = [];\n let labels = this.getLabels();\n\n // If we are viewing some subset of labels, slice the original array\n labels = (min === 0 && max === labels.length - 1) ? labels : labels.slice(min, max + 1);\n\n this._valueRange = Math.max(labels.length - (offset ? 0 : 1), 1);\n this._startValue = this.min - (offset ? 0.5 : 0);\n\n for (let value = min; value <= max; value++) {\n ticks.push({value});\n }\n return ticks;\n }\n\n getLabelForValue(value) {\n return _getLabelForValue.call(this, value);\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n super.configure();\n\n if (!this.isHorizontal()) {\n // For backward compatibility, vertical category scale reverse is inverted.\n this._reversePixels = !this._reversePixels;\n }\n }\n\n // Used to get data value locations. Value can either be an index or a numerical value\n getPixelForValue(value) {\n if (typeof value !== 'number') {\n value = this.parse(value);\n }\n\n return value === null ? NaN : this.getPixelForDecimal((value - this._startValue) / this._valueRange);\n }\n\n // Must override base implementation because it calls getPixelForValue\n // and category scale can have duplicate values\n getPixelForTick(index) {\n const ticks = this.ticks;\n if (index < 0 || index > ticks.length - 1) {\n return null;\n }\n return this.getPixelForValue(ticks[index].value);\n }\n\n getValueForPixel(pixel) {\n return Math.round(this._startValue + this.getDecimalForPixel(pixel) * this._valueRange);\n }\n\n getBasePixel() {\n return this.bottom;\n }\n}\n","import {isNullOrUndef} from '../helpers/helpers.core';\nimport {almostEquals, almostWhole, niceNum, _decimalPlaces, _setMinAndMaxByKey, sign, toRadians} from '../helpers/helpers.math';\nimport Scale from '../core/core.scale';\nimport {formatNumber} from '../helpers/helpers.intl';\n\n/**\n * Generate a set of linear ticks for an axis\n * 1. If generationOptions.min, generationOptions.max, and generationOptions.step are defined:\n * if (max - min) / step is an integer, ticks are generated as [min, min + step, ..., max]\n * Note that the generationOptions.maxCount setting is respected in this scenario\n *\n * 2. If generationOptions.min, generationOptions.max, and generationOptions.count is defined\n * spacing = (max - min) / count\n * Ticks are generated as [min, min + spacing, ..., max]\n *\n * 3. If generationOptions.count is defined\n * spacing = (niceMax - niceMin) / count\n *\n * 4. Compute optimal spacing of ticks using niceNum algorithm\n *\n * @param generationOptions the options used to generate the ticks\n * @param dataRange the range of the data\n * @returns {object[]} array of tick objects\n */\nfunction generateTicks(generationOptions, dataRange) {\n const ticks = [];\n // To get a \"nice\" value for the tick spacing, we will use the appropriately named\n // \"nice number\" algorithm. See https://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks\n // for details.\n\n const MIN_SPACING = 1e-14;\n const {bounds, step, min, max, precision, count, maxTicks, maxDigits, includeBounds} = generationOptions;\n const unit = step || 1;\n const maxSpaces = maxTicks - 1;\n const {min: rmin, max: rmax} = dataRange;\n const minDefined = !isNullOrUndef(min);\n const maxDefined = !isNullOrUndef(max);\n const countDefined = !isNullOrUndef(count);\n const minSpacing = (rmax - rmin) / (maxDigits + 1);\n let spacing = niceNum((rmax - rmin) / maxSpaces / unit) * unit;\n let factor, niceMin, niceMax, numSpaces;\n\n // Beyond MIN_SPACING floating point numbers being to lose precision\n // such that we can't do the math necessary to generate ticks\n if (spacing < MIN_SPACING && !minDefined && !maxDefined) {\n return [{value: rmin}, {value: rmax}];\n }\n\n numSpaces = Math.ceil(rmax / spacing) - Math.floor(rmin / spacing);\n if (numSpaces > maxSpaces) {\n // If the calculated num of spaces exceeds maxNumSpaces, recalculate it\n spacing = niceNum(numSpaces * spacing / maxSpaces / unit) * unit;\n }\n\n if (!isNullOrUndef(precision)) {\n // If the user specified a precision, round to that number of decimal places\n factor = Math.pow(10, precision);\n spacing = Math.ceil(spacing * factor) / factor;\n }\n\n if (bounds === 'ticks') {\n niceMin = Math.floor(rmin / spacing) * spacing;\n niceMax = Math.ceil(rmax / spacing) * spacing;\n } else {\n niceMin = rmin;\n niceMax = rmax;\n }\n\n if (minDefined && maxDefined && step && almostWhole((max - min) / step, spacing / 1000)) {\n // Case 1: If min, max and stepSize are set and they make an evenly spaced scale use it.\n // spacing = step;\n // numSpaces = (max - min) / spacing;\n // Note that we round here to handle the case where almostWhole translated an FP error\n numSpaces = Math.round(Math.min((max - min) / spacing, maxTicks));\n spacing = (max - min) / numSpaces;\n niceMin = min;\n niceMax = max;\n } else if (countDefined) {\n // Cases 2 & 3, we have a count specified. Handle optional user defined edges to the range.\n // Sometimes these are no-ops, but it makes the code a lot clearer\n // and when a user defined range is specified, we want the correct ticks\n niceMin = minDefined ? min : niceMin;\n niceMax = maxDefined ? max : niceMax;\n numSpaces = count - 1;\n spacing = (niceMax - niceMin) / numSpaces;\n } else {\n // Case 4\n numSpaces = (niceMax - niceMin) / spacing;\n\n // If very close to our rounded value, use it.\n if (almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {\n numSpaces = Math.round(numSpaces);\n } else {\n numSpaces = Math.ceil(numSpaces);\n }\n }\n\n // The spacing will have changed in cases 1, 2, and 3 so the factor cannot be computed\n // until this point\n const decimalPlaces = Math.max(\n _decimalPlaces(spacing),\n _decimalPlaces(niceMin)\n );\n factor = Math.pow(10, isNullOrUndef(precision) ? decimalPlaces : precision);\n niceMin = Math.round(niceMin * factor) / factor;\n niceMax = Math.round(niceMax * factor) / factor;\n\n let j = 0;\n if (minDefined) {\n if (includeBounds && niceMin !== min) {\n ticks.push({value: min});\n\n if (niceMin < min) {\n j++; // Skip niceMin\n }\n // If the next nice tick is close to min, skip it\n if (almostEquals(Math.round((niceMin + j * spacing) * factor) / factor, min, relativeLabelSize(min, minSpacing, generationOptions))) {\n j++;\n }\n } else if (niceMin < min) {\n j++;\n }\n }\n\n for (; j < numSpaces; ++j) {\n ticks.push({value: Math.round((niceMin + j * spacing) * factor) / factor});\n }\n\n if (maxDefined && includeBounds && niceMax !== max) {\n // If the previous tick is too close to max, replace it with max, else add max\n if (ticks.length && almostEquals(ticks[ticks.length - 1].value, max, relativeLabelSize(max, minSpacing, generationOptions))) {\n ticks[ticks.length - 1].value = max;\n } else {\n ticks.push({value: max});\n }\n } else if (!maxDefined || niceMax === max) {\n ticks.push({value: niceMax});\n }\n\n return ticks;\n}\n\nfunction relativeLabelSize(value, minSpacing, {horizontal, minRotation}) {\n const rad = toRadians(minRotation);\n const ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;\n const length = 0.75 * minSpacing * ('' + value).length;\n return Math.min(minSpacing / ratio, length);\n}\n\nexport default class LinearScaleBase extends Scale {\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this.start = undefined;\n /** @type {number} */\n this.end = undefined;\n /** @type {number} */\n this._startValue = undefined;\n /** @type {number} */\n this._endValue = undefined;\n this._valueRange = 0;\n }\n\n parse(raw, index) { // eslint-disable-line no-unused-vars\n if (isNullOrUndef(raw)) {\n return null;\n }\n if ((typeof raw === 'number' || raw instanceof Number) && !isFinite(+raw)) {\n return null;\n }\n\n return +raw;\n }\n\n handleTickRangeOptions() {\n const {beginAtZero} = this.options;\n const {minDefined, maxDefined} = this.getUserBounds();\n let {min, max} = this;\n\n const setMin = v => (min = minDefined ? min : v);\n const setMax = v => (max = maxDefined ? max : v);\n\n if (beginAtZero) {\n const minSign = sign(min);\n const maxSign = sign(max);\n\n if (minSign < 0 && maxSign < 0) {\n setMax(0);\n } else if (minSign > 0 && maxSign > 0) {\n setMin(0);\n }\n }\n\n if (min === max) {\n let offset = max === 0 ? 1 : Math.abs(max * 0.05);\n\n setMax(max + offset);\n\n if (!beginAtZero) {\n setMin(min - offset);\n }\n }\n this.min = min;\n this.max = max;\n }\n\n getTickLimit() {\n const tickOpts = this.options.ticks;\n // eslint-disable-next-line prefer-const\n let {maxTicksLimit, stepSize} = tickOpts;\n let maxTicks;\n\n if (stepSize) {\n maxTicks = Math.ceil(this.max / stepSize) - Math.floor(this.min / stepSize) + 1;\n if (maxTicks > 1000) {\n console.warn(`scales.${this.id}.ticks.stepSize: ${stepSize} would result generating up to ${maxTicks} ticks. Limiting to 1000.`);\n maxTicks = 1000;\n }\n } else {\n maxTicks = this.computeTickLimit();\n maxTicksLimit = maxTicksLimit || 11;\n }\n\n if (maxTicksLimit) {\n maxTicks = Math.min(maxTicksLimit, maxTicks);\n }\n\n return maxTicks;\n }\n\n /**\n\t * @protected\n\t */\n computeTickLimit() {\n return Number.POSITIVE_INFINITY;\n }\n\n buildTicks() {\n const opts = this.options;\n const tickOpts = opts.ticks;\n\n // Figure out what the max number of ticks we can support it is based on the size of\n // the axis area. For now, we say that the minimum tick spacing in pixels must be 40\n // We also limit the maximum number of ticks to 11 which gives a nice 10 squares on\n // the graph. Make sure we always have at least 2 ticks\n let maxTicks = this.getTickLimit();\n maxTicks = Math.max(2, maxTicks);\n\n const numericGeneratorOptions = {\n maxTicks,\n bounds: opts.bounds,\n min: opts.min,\n max: opts.max,\n precision: tickOpts.precision,\n step: tickOpts.stepSize,\n count: tickOpts.count,\n maxDigits: this._maxDigits(),\n horizontal: this.isHorizontal(),\n minRotation: tickOpts.minRotation || 0,\n includeBounds: tickOpts.includeBounds !== false\n };\n const dataRange = this._range || this;\n const ticks = generateTicks(numericGeneratorOptions, dataRange);\n\n // At this point, we need to update our max and min given the tick values,\n // since we probably have expanded the range of the scale\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, this, 'value');\n }\n\n if (opts.reverse) {\n ticks.reverse();\n\n this.start = this.max;\n this.end = this.min;\n } else {\n this.start = this.min;\n this.end = this.max;\n }\n\n return ticks;\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n const ticks = this.ticks;\n let start = this.min;\n let end = this.max;\n\n super.configure();\n\n if (this.options.offset && ticks.length) {\n const offset = (end - start) / Math.max(ticks.length - 1, 1) / 2;\n start -= offset;\n end += offset;\n }\n this._startValue = start;\n this._endValue = end;\n this._valueRange = end - start;\n }\n\n getLabelForValue(value) {\n return formatNumber(value, this.chart.options.locale, this.options.ticks.format);\n }\n}\n","import {isFinite} from '../helpers/helpers.core';\nimport LinearScaleBase from './scale.linearbase';\nimport Ticks from '../core/core.ticks';\nimport {toRadians} from '../helpers';\n\nexport default class LinearScale extends LinearScaleBase {\n\n static id = 'linear';\n\n /**\n * @type {any}\n */\n static defaults = {\n ticks: {\n callback: Ticks.formatters.numeric\n }\n };\n\n\n determineDataLimits() {\n const {min, max} = this.getMinMax(true);\n\n this.min = isFinite(min) ? min : 0;\n this.max = isFinite(max) ? max : 1;\n\n // Common base implementation to handle min, max, beginAtZero\n this.handleTickRangeOptions();\n }\n\n /**\n\t * Returns the maximum number of ticks based on the scale dimension\n\t * @protected\n \t */\n computeTickLimit() {\n const horizontal = this.isHorizontal();\n const length = horizontal ? this.width : this.height;\n const minRotation = toRadians(this.options.ticks.minRotation);\n const ratio = (horizontal ? Math.sin(minRotation) : Math.cos(minRotation)) || 0.001;\n const tickFont = this._resolveTickFontOptions(0);\n return Math.ceil(length / Math.min(40, tickFont.lineHeight / ratio));\n }\n\n // Utils\n getPixelForValue(value) {\n return value === null ? NaN : this.getPixelForDecimal((value - this._startValue) / this._valueRange);\n }\n\n getValueForPixel(pixel) {\n return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;\n }\n}\n","import {finiteOrDefault, isFinite} from '../helpers/helpers.core';\nimport {formatNumber} from '../helpers/helpers.intl';\nimport {_setMinAndMaxByKey, log10} from '../helpers/helpers.math';\nimport Scale from '../core/core.scale';\nimport LinearScaleBase from './scale.linearbase';\nimport Ticks from '../core/core.ticks';\n\nconst log10Floor = v => Math.floor(log10(v));\nconst changeExponent = (v, m) => Math.pow(10, log10Floor(v) + m);\n\nfunction isMajor(tickVal) {\n const remain = tickVal / (Math.pow(10, log10Floor(tickVal)));\n return remain === 1;\n}\n\nfunction steps(min, max, rangeExp) {\n const rangeStep = Math.pow(10, rangeExp);\n const start = Math.floor(min / rangeStep);\n const end = Math.ceil(max / rangeStep);\n return end - start;\n}\n\nfunction startExp(min, max) {\n const range = max - min;\n let rangeExp = log10Floor(range);\n while (steps(min, max, rangeExp) > 10) {\n rangeExp++;\n }\n while (steps(min, max, rangeExp) < 10) {\n rangeExp--;\n }\n return Math.min(rangeExp, log10Floor(min));\n}\n\n\n/**\n * Generate a set of logarithmic ticks\n * @param generationOptions the options used to generate the ticks\n * @param dataRange the range of the data\n * @returns {object[]} array of tick objects\n */\nfunction generateTicks(generationOptions, {min, max}) {\n min = finiteOrDefault(generationOptions.min, min);\n const ticks = [];\n const minExp = log10Floor(min);\n let exp = startExp(min, max);\n let precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;\n const stepSize = Math.pow(10, exp);\n const base = minExp > exp ? Math.pow(10, minExp) : 0;\n const start = Math.round((min - base) * precision) / precision;\n const offset = Math.floor((min - base) / stepSize / 10) * stepSize * 10;\n let significand = Math.floor((start - offset) / Math.pow(10, exp));\n let value = finiteOrDefault(generationOptions.min, Math.round((base + offset + significand * Math.pow(10, exp)) * precision) / precision);\n while (value < max) {\n ticks.push({value, major: isMajor(value), significand});\n if (significand >= 10) {\n significand = significand < 15 ? 15 : 20;\n } else {\n significand++;\n }\n if (significand >= 20) {\n exp++;\n significand = 2;\n precision = exp >= 0 ? 1 : precision;\n }\n value = Math.round((base + offset + significand * Math.pow(10, exp)) * precision) / precision;\n }\n const lastTick = finiteOrDefault(generationOptions.max, value);\n ticks.push({value: lastTick, major: isMajor(lastTick), significand});\n\n return ticks;\n}\n\nexport default class LogarithmicScale extends Scale {\n\n static id = 'logarithmic';\n\n /**\n * @type {any}\n */\n static defaults = {\n ticks: {\n callback: Ticks.formatters.logarithmic,\n major: {\n enabled: true\n }\n }\n };\n\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this.start = undefined;\n /** @type {number} */\n this.end = undefined;\n /** @type {number} */\n this._startValue = undefined;\n this._valueRange = 0;\n }\n\n parse(raw, index) {\n const value = LinearScaleBase.prototype.parse.apply(this, [raw, index]);\n if (value === 0) {\n this._zero = true;\n return undefined;\n }\n return isFinite(value) && value > 0 ? value : null;\n }\n\n determineDataLimits() {\n const {min, max} = this.getMinMax(true);\n\n this.min = isFinite(min) ? Math.max(0, min) : null;\n this.max = isFinite(max) ? Math.max(0, max) : null;\n\n if (this.options.beginAtZero) {\n this._zero = true;\n }\n\n // if data has `0` in it or `beginAtZero` is true, min (non zero) value is at bottom\n // of scale, and it does not equal suggestedMin, lower the min bound by one exp.\n if (this._zero && this.min !== this._suggestedMin && !isFinite(this._userMin)) {\n this.min = min === changeExponent(this.min, 0) ? changeExponent(this.min, -1) : changeExponent(this.min, 0);\n }\n\n this.handleTickRangeOptions();\n }\n\n handleTickRangeOptions() {\n const {minDefined, maxDefined} = this.getUserBounds();\n let min = this.min;\n let max = this.max;\n\n const setMin = v => (min = minDefined ? min : v);\n const setMax = v => (max = maxDefined ? max : v);\n\n if (min === max) {\n if (min <= 0) { // includes null\n setMin(1);\n setMax(10);\n } else {\n setMin(changeExponent(min, -1));\n setMax(changeExponent(max, +1));\n }\n }\n if (min <= 0) {\n setMin(changeExponent(max, -1));\n }\n if (max <= 0) {\n\n setMax(changeExponent(min, +1));\n }\n\n this.min = min;\n this.max = max;\n }\n\n buildTicks() {\n const opts = this.options;\n\n const generationOptions = {\n min: this._userMin,\n max: this._userMax\n };\n const ticks = generateTicks(generationOptions, this);\n\n // At this point, we need to update our max and min given the tick values,\n // since we probably have expanded the range of the scale\n if (opts.bounds === 'ticks') {\n _setMinAndMaxByKey(ticks, this, 'value');\n }\n\n if (opts.reverse) {\n ticks.reverse();\n\n this.start = this.max;\n this.end = this.min;\n } else {\n this.start = this.min;\n this.end = this.max;\n }\n\n return ticks;\n }\n\n /**\n\t * @param {number} value\n\t * @return {string}\n\t */\n getLabelForValue(value) {\n return value === undefined\n ? '0'\n : formatNumber(value, this.chart.options.locale, this.options.ticks.format);\n }\n\n /**\n\t * @protected\n\t */\n configure() {\n const start = this.min;\n\n super.configure();\n\n this._startValue = log10(start);\n this._valueRange = log10(this.max) - log10(start);\n }\n\n getPixelForValue(value) {\n if (value === undefined || value === 0) {\n value = this.min;\n }\n if (value === null || isNaN(value)) {\n return NaN;\n }\n return this.getPixelForDecimal(value === this.min\n ? 0\n : (log10(value) - this._startValue) / this._valueRange);\n }\n\n getValueForPixel(pixel) {\n const decimal = this.getDecimalForPixel(pixel);\n return Math.pow(10, this._startValue + decimal * this._valueRange);\n }\n}\n","import defaults from '../core/core.defaults';\nimport {_longestText, addRoundedRectPath, renderText} from '../helpers/helpers.canvas';\nimport {HALF_PI, TAU, toDegrees, toRadians, _normalizeAngle, PI} from '../helpers/helpers.math';\nimport LinearScaleBase from './scale.linearbase';\nimport Ticks from '../core/core.ticks';\nimport {valueOrDefault, isArray, isFinite, callback as callCallback, isNullOrUndef} from '../helpers/helpers.core';\nimport {createContext, toFont, toPadding, toTRBLCorners} from '../helpers/helpers.options';\n\nfunction getTickBackdropHeight(opts) {\n const tickOpts = opts.ticks;\n\n if (tickOpts.display && opts.display) {\n const padding = toPadding(tickOpts.backdropPadding);\n return valueOrDefault(tickOpts.font && tickOpts.font.size, defaults.font.size) + padding.height;\n }\n return 0;\n}\n\nfunction measureLabelSize(ctx, font, label) {\n label = isArray(label) ? label : [label];\n return {\n w: _longestText(ctx, font.string, label),\n h: label.length * font.lineHeight\n };\n}\n\nfunction determineLimits(angle, pos, size, min, max) {\n if (angle === min || angle === max) {\n return {\n start: pos - (size / 2),\n end: pos + (size / 2)\n };\n } else if (angle < min || angle > max) {\n return {\n start: pos - size,\n end: pos\n };\n }\n\n return {\n start: pos,\n end: pos + size\n };\n}\n\n/**\n * Helper function to fit a radial linear scale with point labels\n */\nfunction fitWithPointLabels(scale) {\n\n // Right, this is really confusing and there is a lot of maths going on here\n // The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9\n //\n // Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif\n //\n // Solution:\n //\n // We assume the radius of the polygon is half the size of the canvas at first\n // at each index we check if the text overlaps.\n //\n // Where it does, we store that angle and that index.\n //\n // After finding the largest index and angle we calculate how much we need to remove\n // from the shape radius to move the point inwards by that x.\n //\n // We average the left and right distances to get the maximum shape radius that can fit in the box\n // along with labels.\n //\n // Once we have that, we can find the centre point for the chart, by taking the x text protrusion\n // on each side, removing that from the size, halving it and adding the left x protrusion width.\n //\n // This will mean we have a shape fitted to the canvas, as large as it can be with the labels\n // and position it in the most space efficient manner\n //\n // https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif\n\n // Get maximum radius of the polygon. Either half the height (minus the text width) or half the width.\n // Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points\n const orig = {\n l: scale.left + scale._padding.left,\n r: scale.right - scale._padding.right,\n t: scale.top + scale._padding.top,\n b: scale.bottom - scale._padding.bottom\n };\n const limits = Object.assign({}, orig);\n const labelSizes = [];\n const padding = [];\n const valueCount = scale._pointLabels.length;\n const pointLabelOpts = scale.options.pointLabels;\n const additionalAngle = pointLabelOpts.centerPointLabels ? PI / valueCount : 0;\n\n for (let i = 0; i < valueCount; i++) {\n const opts = pointLabelOpts.setContext(scale.getPointLabelContext(i));\n padding[i] = opts.padding;\n const pointPosition = scale.getPointPosition(i, scale.drawingArea + padding[i], additionalAngle);\n const plFont = toFont(opts.font);\n const textSize = measureLabelSize(scale.ctx, plFont, scale._pointLabels[i]);\n labelSizes[i] = textSize;\n\n const angleRadians = _normalizeAngle(scale.getIndexAngle(i) + additionalAngle);\n const angle = Math.round(toDegrees(angleRadians));\n const hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);\n const vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);\n updateLimits(limits, orig, angleRadians, hLimits, vLimits);\n }\n\n scale.setCenterPoint(\n orig.l - limits.l,\n limits.r - orig.r,\n orig.t - limits.t,\n limits.b - orig.b\n );\n\n // Now that text size is determined, compute the full positions\n scale._pointLabelItems = buildPointLabelItems(scale, labelSizes, padding);\n}\n\nfunction updateLimits(limits, orig, angle, hLimits, vLimits) {\n const sin = Math.abs(Math.sin(angle));\n const cos = Math.abs(Math.cos(angle));\n let x = 0;\n let y = 0;\n if (hLimits.start < orig.l) {\n x = (orig.l - hLimits.start) / sin;\n limits.l = Math.min(limits.l, orig.l - x);\n } else if (hLimits.end > orig.r) {\n x = (hLimits.end - orig.r) / sin;\n limits.r = Math.max(limits.r, orig.r + x);\n }\n if (vLimits.start < orig.t) {\n y = (orig.t - vLimits.start) / cos;\n limits.t = Math.min(limits.t, orig.t - y);\n } else if (vLimits.end > orig.b) {\n y = (vLimits.end - orig.b) / cos;\n limits.b = Math.max(limits.b, orig.b + y);\n }\n}\n\nfunction buildPointLabelItems(scale, labelSizes, padding) {\n const items = [];\n const valueCount = scale._pointLabels.length;\n const opts = scale.options;\n const extra = getTickBackdropHeight(opts) / 2;\n const outerDistance = scale.drawingArea;\n const additionalAngle = opts.pointLabels.centerPointLabels ? PI / valueCount : 0;\n\n for (let i = 0; i < valueCount; i++) {\n const pointLabelPosition = scale.getPointPosition(i, outerDistance + extra + padding[i], additionalAngle);\n const angle = Math.round(toDegrees(_normalizeAngle(pointLabelPosition.angle + HALF_PI)));\n const size = labelSizes[i];\n const y = yForAngle(pointLabelPosition.y, size.h, angle);\n const textAlign = getTextAlignForAngle(angle);\n const left = leftForTextAlign(pointLabelPosition.x, size.w, textAlign);\n\n items.push({\n // Text position\n x: pointLabelPosition.x,\n y,\n\n // Text rendering data\n textAlign,\n\n // Bounding box\n left,\n top: y,\n right: left + size.w,\n bottom: y + size.h\n });\n }\n return items;\n}\n\nfunction getTextAlignForAngle(angle) {\n if (angle === 0 || angle === 180) {\n return 'center';\n } else if (angle < 180) {\n return 'left';\n }\n\n return 'right';\n}\n\nfunction leftForTextAlign(x, w, align) {\n if (align === 'right') {\n x -= w;\n } else if (align === 'center') {\n x -= (w / 2);\n }\n return x;\n}\n\nfunction yForAngle(y, h, angle) {\n if (angle === 90 || angle === 270) {\n y -= (h / 2);\n } else if (angle > 270 || angle < 90) {\n y -= h;\n }\n return y;\n}\n\nfunction drawPointLabels(scale, labelCount) {\n const {ctx, options: {pointLabels}} = scale;\n\n for (let i = labelCount - 1; i >= 0; i--) {\n const optsAtIndex = pointLabels.setContext(scale.getPointLabelContext(i));\n const plFont = toFont(optsAtIndex.font);\n const {x, y, textAlign, left, top, right, bottom} = scale._pointLabelItems[i];\n const {backdropColor} = optsAtIndex;\n\n if (!isNullOrUndef(backdropColor)) {\n const borderRadius = toTRBLCorners(optsAtIndex.borderRadius);\n const padding = toPadding(optsAtIndex.backdropPadding);\n ctx.fillStyle = backdropColor;\n\n const backdropLeft = left - padding.left;\n const backdropTop = top - padding.top;\n const backdropWidth = right - left + padding.width;\n const backdropHeight = bottom - top + padding.height;\n\n if (Object.values(borderRadius).some(v => v !== 0)) {\n ctx.beginPath();\n addRoundedRectPath(ctx, {\n x: backdropLeft,\n y: backdropTop,\n w: backdropWidth,\n h: backdropHeight,\n radius: borderRadius,\n });\n ctx.fill();\n } else {\n ctx.fillRect(backdropLeft, backdropTop, backdropWidth, backdropHeight);\n }\n }\n\n renderText(\n ctx,\n scale._pointLabels[i],\n x,\n y + (plFont.lineHeight / 2),\n plFont,\n {\n color: optsAtIndex.color,\n textAlign: textAlign,\n textBaseline: 'middle'\n }\n );\n }\n}\n\nfunction pathRadiusLine(scale, radius, circular, labelCount) {\n const {ctx} = scale;\n if (circular) {\n // Draw circular arcs between the points\n ctx.arc(scale.xCenter, scale.yCenter, radius, 0, TAU);\n } else {\n // Draw straight lines connecting each index\n let pointPosition = scale.getPointPosition(0, radius);\n ctx.moveTo(pointPosition.x, pointPosition.y);\n\n for (let i = 1; i < labelCount; i++) {\n pointPosition = scale.getPointPosition(i, radius);\n ctx.lineTo(pointPosition.x, pointPosition.y);\n }\n }\n}\n\nfunction drawRadiusLine(scale, gridLineOpts, radius, labelCount, borderOpts) {\n const ctx = scale.ctx;\n const circular = gridLineOpts.circular;\n\n const {color, lineWidth} = gridLineOpts;\n\n if ((!circular && !labelCount) || !color || !lineWidth || radius < 0) {\n return;\n }\n\n ctx.save();\n ctx.strokeStyle = color;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash(borderOpts.dash);\n ctx.lineDashOffset = borderOpts.dashOffset;\n\n ctx.beginPath();\n pathRadiusLine(scale, radius, circular, labelCount);\n ctx.closePath();\n ctx.stroke();\n ctx.restore();\n}\n\nfunction createPointLabelContext(parent, index, label) {\n return createContext(parent, {\n label,\n index,\n type: 'pointLabel'\n });\n}\n\nexport default class RadialLinearScale extends LinearScaleBase {\n\n static id = 'radialLinear';\n\n /**\n * @type {any}\n */\n static defaults = {\n display: true,\n\n // Boolean - Whether to animate scaling the chart from the centre\n animate: true,\n position: 'chartArea',\n\n angleLines: {\n display: true,\n lineWidth: 1,\n borderDash: [],\n borderDashOffset: 0.0\n },\n\n grid: {\n circular: false\n },\n\n startAngle: 0,\n\n // label settings\n ticks: {\n // Boolean - Show a backdrop to the scale label\n showLabelBackdrop: true,\n\n callback: Ticks.formatters.numeric\n },\n\n pointLabels: {\n backdropColor: undefined,\n\n // Number - The backdrop padding above & below the label in pixels\n backdropPadding: 2,\n\n // Boolean - if true, show point labels\n display: true,\n\n // Number - Point label font size in pixels\n font: {\n size: 10\n },\n\n // Function - Used to convert point labels\n callback(label) {\n return label;\n },\n\n // Number - Additionl padding between scale and pointLabel\n padding: 5,\n\n // Boolean - if true, center point labels to slices in polar chart\n centerPointLabels: false\n }\n };\n\n static defaultRoutes = {\n 'angleLines.color': 'borderColor',\n 'pointLabels.color': 'color',\n 'ticks.color': 'color'\n };\n\n static descriptors = {\n angleLines: {\n _fallback: 'grid'\n }\n };\n\n constructor(cfg) {\n super(cfg);\n\n /** @type {number} */\n this.xCenter = undefined;\n /** @type {number} */\n this.yCenter = undefined;\n /** @type {number} */\n this.drawingArea = undefined;\n /** @type {string[]} */\n this._pointLabels = [];\n this._pointLabelItems = [];\n }\n\n setDimensions() {\n // Set the unconstrained dimension before label rotation\n const padding = this._padding = toPadding(getTickBackdropHeight(this.options) / 2);\n const w = this.width = this.maxWidth - padding.width;\n const h = this.height = this.maxHeight - padding.height;\n this.xCenter = Math.floor(this.left + w / 2 + padding.left);\n this.yCenter = Math.floor(this.top + h / 2 + padding.top);\n this.drawingArea = Math.floor(Math.min(w, h) / 2);\n }\n\n determineDataLimits() {\n const {min, max} = this.getMinMax(false);\n\n this.min = isFinite(min) && !isNaN(min) ? min : 0;\n this.max = isFinite(max) && !isNaN(max) ? max : 0;\n\n // Common base implementation to handle min, max, beginAtZero\n this.handleTickRangeOptions();\n }\n\n /**\n\t * Returns the maximum number of ticks based on the scale dimension\n\t * @protected\n\t */\n computeTickLimit() {\n return Math.ceil(this.drawingArea / getTickBackdropHeight(this.options));\n }\n\n generateTickLabels(ticks) {\n LinearScaleBase.prototype.generateTickLabels.call(this, ticks);\n\n // Point labels\n this._pointLabels = this.getLabels()\n .map((value, index) => {\n const label = callCallback(this.options.pointLabels.callback, [value, index], this);\n return label || label === 0 ? label : '';\n })\n .filter((v, i) => this.chart.getDataVisibility(i));\n }\n\n fit() {\n const opts = this.options;\n\n if (opts.display && opts.pointLabels.display) {\n fitWithPointLabels(this);\n } else {\n this.setCenterPoint(0, 0, 0, 0);\n }\n }\n\n setCenterPoint(leftMovement, rightMovement, topMovement, bottomMovement) {\n this.xCenter += Math.floor((leftMovement - rightMovement) / 2);\n this.yCenter += Math.floor((topMovement - bottomMovement) / 2);\n this.drawingArea -= Math.min(this.drawingArea / 2, Math.max(leftMovement, rightMovement, topMovement, bottomMovement));\n }\n\n getIndexAngle(index) {\n const angleMultiplier = TAU / (this._pointLabels.length || 1);\n const startAngle = this.options.startAngle || 0;\n\n return _normalizeAngle(index * angleMultiplier + toRadians(startAngle));\n }\n\n getDistanceFromCenterForValue(value) {\n if (isNullOrUndef(value)) {\n return NaN;\n }\n\n // Take into account half font size + the yPadding of the top value\n const scalingFactor = this.drawingArea / (this.max - this.min);\n if (this.options.reverse) {\n return (this.max - value) * scalingFactor;\n }\n return (value - this.min) * scalingFactor;\n }\n\n getValueForDistanceFromCenter(distance) {\n if (isNullOrUndef(distance)) {\n return NaN;\n }\n\n const scaledDistance = distance / (this.drawingArea / (this.max - this.min));\n return this.options.reverse ? this.max - scaledDistance : this.min + scaledDistance;\n }\n\n getPointLabelContext(index) {\n const pointLabels = this._pointLabels || [];\n\n if (index >= 0 && index < pointLabels.length) {\n const pointLabel = pointLabels[index];\n return createPointLabelContext(this.getContext(), index, pointLabel);\n }\n }\n\n getPointPosition(index, distanceFromCenter, additionalAngle = 0) {\n const angle = this.getIndexAngle(index) - HALF_PI + additionalAngle;\n return {\n x: Math.cos(angle) * distanceFromCenter + this.xCenter,\n y: Math.sin(angle) * distanceFromCenter + this.yCenter,\n angle\n };\n }\n\n getPointPositionForValue(index, value) {\n return this.getPointPosition(index, this.getDistanceFromCenterForValue(value));\n }\n\n getBasePosition(index) {\n return this.getPointPositionForValue(index || 0, this.getBaseValue());\n }\n\n getPointLabelPosition(index) {\n const {left, top, right, bottom} = this._pointLabelItems[index];\n return {\n left,\n top,\n right,\n bottom,\n };\n }\n\n /**\n\t * @protected\n\t */\n drawBackground() {\n const {backgroundColor, grid: {circular}} = this.options;\n if (backgroundColor) {\n const ctx = this.ctx;\n ctx.save();\n ctx.beginPath();\n pathRadiusLine(this, this.getDistanceFromCenterForValue(this._endValue), circular, this._pointLabels.length);\n ctx.closePath();\n ctx.fillStyle = backgroundColor;\n ctx.fill();\n ctx.restore();\n }\n }\n\n /**\n\t * @protected\n\t */\n drawGrid() {\n const ctx = this.ctx;\n const opts = this.options;\n const {angleLines, grid, border} = opts;\n const labelCount = this._pointLabels.length;\n\n let i, offset, position;\n\n if (opts.pointLabels.display) {\n drawPointLabels(this, labelCount);\n }\n\n if (grid.display) {\n this.ticks.forEach((tick, index) => {\n if (index !== 0) {\n offset = this.getDistanceFromCenterForValue(tick.value);\n const context = this.getContext(index);\n const optsAtIndex = grid.setContext(context);\n const optsAtIndexBorder = border.setContext(context);\n\n drawRadiusLine(this, optsAtIndex, offset, labelCount, optsAtIndexBorder);\n }\n });\n }\n\n if (angleLines.display) {\n ctx.save();\n\n for (i = labelCount - 1; i >= 0; i--) {\n const optsAtIndex = angleLines.setContext(this.getPointLabelContext(i));\n const {color, lineWidth} = optsAtIndex;\n\n if (!lineWidth || !color) {\n continue;\n }\n\n ctx.lineWidth = lineWidth;\n ctx.strokeStyle = color;\n\n ctx.setLineDash(optsAtIndex.borderDash);\n ctx.lineDashOffset = optsAtIndex.borderDashOffset;\n\n offset = this.getDistanceFromCenterForValue(opts.ticks.reverse ? this.min : this.max);\n position = this.getPointPosition(i, offset);\n ctx.beginPath();\n ctx.moveTo(this.xCenter, this.yCenter);\n ctx.lineTo(position.x, position.y);\n ctx.stroke();\n }\n\n ctx.restore();\n }\n }\n\n /**\n\t * @protected\n\t */\n drawBorder() {}\n\n /**\n\t * @protected\n\t */\n drawLabels() {\n const ctx = this.ctx;\n const opts = this.options;\n const tickOpts = opts.ticks;\n\n if (!tickOpts.display) {\n return;\n }\n\n const startAngle = this.getIndexAngle(0);\n let offset, width;\n\n ctx.save();\n ctx.translate(this.xCenter, this.yCenter);\n ctx.rotate(startAngle);\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n\n this.ticks.forEach((tick, index) => {\n if (index === 0 && !opts.reverse) {\n return;\n }\n\n const optsAtIndex = tickOpts.setContext(this.getContext(index));\n const tickFont = toFont(optsAtIndex.font);\n offset = this.getDistanceFromCenterForValue(this.ticks[index].value);\n\n if (optsAtIndex.showLabelBackdrop) {\n ctx.font = tickFont.string;\n width = ctx.measureText(tick.label).width;\n ctx.fillStyle = optsAtIndex.backdropColor;\n\n const padding = toPadding(optsAtIndex.backdropPadding);\n ctx.fillRect(\n -width / 2 - padding.left,\n -offset - tickFont.size / 2 - padding.top,\n width + padding.width,\n tickFont.size + padding.height\n );\n }\n\n renderText(ctx, tick.label, 0, -offset, tickFont, {\n color: optsAtIndex.color,\n });\n });\n\n ctx.restore();\n }\n\n /**\n\t * @protected\n\t */\n drawTitle() {}\n}\n","import adapters from '../core/core.adapters';\nimport {callback as call, isFinite, isNullOrUndef, mergeIf, valueOrDefault} from '../helpers/helpers.core';\nimport {toRadians, isNumber, _limitValue} from '../helpers/helpers.math';\nimport Scale from '../core/core.scale';\nimport {_arrayUnique, _filterBetween, _lookup} from '../helpers/helpers.collection';\n\n/**\n * @typedef { import(\"../core/core.adapters\").TimeUnit } Unit\n * @typedef {{common: boolean, size: number, steps?: number}} Interval\n * @typedef { import(\"../core/core.adapters\").DateAdapter } DateAdapter\n */\n\n/**\n * @type {Object}\n */\nconst INTERVALS = {\n millisecond: {common: true, size: 1, steps: 1000},\n second: {common: true, size: 1000, steps: 60},\n minute: {common: true, size: 60000, steps: 60},\n hour: {common: true, size: 3600000, steps: 24},\n day: {common: true, size: 86400000, steps: 30},\n week: {common: false, size: 604800000, steps: 4},\n month: {common: true, size: 2.628e9, steps: 12},\n quarter: {common: false, size: 7.884e9, steps: 4},\n year: {common: true, size: 3.154e10}\n};\n\n/**\n * @type {Unit[]}\n */\nconst UNITS = /** @type Unit[] */ /* #__PURE__ */ (Object.keys(INTERVALS));\n\n/**\n * @param {number} a\n * @param {number} b\n */\nfunction sorter(a, b) {\n return a - b;\n}\n\n/**\n * @param {TimeScale} scale\n * @param {*} input\n * @return {number}\n */\nfunction parse(scale, input) {\n if (isNullOrUndef(input)) {\n return null;\n }\n\n const adapter = scale._adapter;\n const {parser, round, isoWeekday} = scale._parseOpts;\n let value = input;\n\n if (typeof parser === 'function') {\n value = parser(value);\n }\n\n // Only parse if its not a timestamp already\n if (!isFinite(value)) {\n value = typeof parser === 'string'\n ? adapter.parse(value, /** @type {Unit} */ (parser))\n : adapter.parse(value);\n }\n\n if (value === null) {\n return null;\n }\n\n if (round) {\n value = round === 'week' && (isNumber(isoWeekday) || isoWeekday === true)\n ? adapter.startOf(value, 'isoWeek', isoWeekday)\n : adapter.startOf(value, round);\n }\n\n return +value;\n}\n\n/**\n * Figures out what unit results in an appropriate number of auto-generated ticks\n * @param {Unit} minUnit\n * @param {number} min\n * @param {number} max\n * @param {number} capacity\n * @return {object}\n */\nfunction determineUnitForAutoTicks(minUnit, min, max, capacity) {\n const ilen = UNITS.length;\n\n for (let i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {\n const interval = INTERVALS[UNITS[i]];\n const factor = interval.steps ? interval.steps : Number.MAX_SAFE_INTEGER;\n\n if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {\n return UNITS[i];\n }\n }\n\n return UNITS[ilen - 1];\n}\n\n/**\n * Figures out what unit to format a set of ticks with\n * @param {TimeScale} scale\n * @param {number} numTicks\n * @param {Unit} minUnit\n * @param {number} min\n * @param {number} max\n * @return {Unit}\n */\nfunction determineUnitForFormatting(scale, numTicks, minUnit, min, max) {\n for (let i = UNITS.length - 1; i >= UNITS.indexOf(minUnit); i--) {\n const unit = UNITS[i];\n if (INTERVALS[unit].common && scale._adapter.diff(max, min, unit) >= numTicks - 1) {\n return unit;\n }\n }\n\n return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];\n}\n\n/**\n * @param {Unit} unit\n * @return {object}\n */\nfunction determineMajorUnit(unit) {\n for (let i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {\n if (INTERVALS[UNITS[i]].common) {\n return UNITS[i];\n }\n }\n}\n\n/**\n * @param {object} ticks\n * @param {number} time\n * @param {number[]} [timestamps] - if defined, snap to these timestamps\n */\nfunction addTick(ticks, time, timestamps) {\n if (!timestamps) {\n ticks[time] = true;\n } else if (timestamps.length) {\n const {lo, hi} = _lookup(timestamps, time);\n const timestamp = timestamps[lo] >= time ? timestamps[lo] : timestamps[hi];\n ticks[timestamp] = true;\n }\n}\n\n/**\n * @param {TimeScale} scale\n * @param {object[]} ticks\n * @param {object} map\n * @param {Unit} majorUnit\n * @return {object[]}\n */\nfunction setMajorTicks(scale, ticks, map, majorUnit) {\n const adapter = scale._adapter;\n const first = +adapter.startOf(ticks[0].value, majorUnit);\n const last = ticks[ticks.length - 1].value;\n let major, index;\n\n for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {\n index = map[major];\n if (index >= 0) {\n ticks[index].major = true;\n }\n }\n return ticks;\n}\n\n/**\n * @param {TimeScale} scale\n * @param {number[]} values\n * @param {Unit|undefined} [majorUnit]\n * @return {object[]}\n */\nfunction ticksFromTimestamps(scale, values, majorUnit) {\n const ticks = [];\n /** @type {Object} */\n const map = {};\n const ilen = values.length;\n let i, value;\n\n for (i = 0; i < ilen; ++i) {\n value = values[i];\n map[value] = i;\n\n ticks.push({\n value,\n major: false\n });\n }\n\n // We set the major ticks separately from the above loop because calling startOf for every tick\n // is expensive when there is a large number of ticks\n return (ilen === 0 || !majorUnit) ? ticks : setMajorTicks(scale, ticks, map, majorUnit);\n}\n\nexport default class TimeScale extends Scale {\n\n static id = 'time';\n\n /**\n * @type {any}\n */\n static defaults = {\n /**\n * Scale boundary strategy (bypassed by min/max time options)\n * - `data`: make sure data are fully visible, ticks outside are removed\n * - `ticks`: make sure ticks are fully visible, data outside are truncated\n * @see https://github.com/chartjs/Chart.js/pull/4556\n * @since 2.7.0\n */\n bounds: 'data',\n\n adapters: {},\n time: {\n parser: false, // false == a pattern string from or a custom callback that converts its argument to a timestamp\n unit: false, // false == automatic or override with week, month, year, etc.\n round: false, // none, or override with week, month, year, etc.\n isoWeekday: false, // override week start day\n minUnit: 'millisecond',\n displayFormats: {}\n },\n ticks: {\n /**\n * Ticks generation input values:\n * - 'auto': generates \"optimal\" ticks based on scale size and time options.\n * - 'data': generates ticks from data (including labels from data {t|x|y} objects).\n * - 'labels': generates ticks from user given `data.labels` values ONLY.\n * @see https://github.com/chartjs/Chart.js/pull/4507\n * @since 2.7.0\n */\n source: 'auto',\n\n callback: false,\n\n major: {\n enabled: false\n }\n }\n };\n\n /**\n\t * @param {object} props\n\t */\n constructor(props) {\n super(props);\n\n /** @type {{data: number[], labels: number[], all: number[]}} */\n this._cache = {\n data: [],\n labels: [],\n all: []\n };\n\n /** @type {Unit} */\n this._unit = 'day';\n /** @type {Unit=} */\n this._majorUnit = undefined;\n this._offsets = {};\n this._normalized = false;\n this._parseOpts = undefined;\n }\n\n init(scaleOpts, opts = {}) {\n const time = scaleOpts.time || (scaleOpts.time = {});\n /** @type {DateAdapter} */\n const adapter = this._adapter = new adapters._date(scaleOpts.adapters.date);\n\n adapter.init(opts);\n\n // Backward compatibility: before introducing adapter, `displayFormats` was\n // supposed to contain *all* unit/string pairs but this can't be resolved\n // when loading the scale (adapters are loaded afterward), so let's populate\n // missing formats on update\n mergeIf(time.displayFormats, adapter.formats());\n\n this._parseOpts = {\n parser: time.parser,\n round: time.round,\n isoWeekday: time.isoWeekday\n };\n\n super.init(scaleOpts);\n\n this._normalized = opts.normalized;\n }\n\n /**\n\t * @param {*} raw\n\t * @param {number?} [index]\n\t * @return {number}\n\t */\n parse(raw, index) { // eslint-disable-line no-unused-vars\n if (raw === undefined) {\n return null;\n }\n return parse(this, raw);\n }\n\n beforeLayout() {\n super.beforeLayout();\n this._cache = {\n data: [],\n labels: [],\n all: []\n };\n }\n\n determineDataLimits() {\n const options = this.options;\n const adapter = this._adapter;\n const unit = options.time.unit || 'day';\n // eslint-disable-next-line prefer-const\n let {min, max, minDefined, maxDefined} = this.getUserBounds();\n\n /**\n\t\t * @param {object} bounds\n\t\t */\n function _applyBounds(bounds) {\n if (!minDefined && !isNaN(bounds.min)) {\n min = Math.min(min, bounds.min);\n }\n if (!maxDefined && !isNaN(bounds.max)) {\n max = Math.max(max, bounds.max);\n }\n }\n\n // If we have user provided `min` and `max` labels / data bounds can be ignored\n if (!minDefined || !maxDefined) {\n // Labels are always considered, when user did not force bounds\n _applyBounds(this._getLabelBounds());\n\n // If `bounds` is `'ticks'` and `ticks.source` is `'labels'`,\n // data bounds are ignored (and don't need to be determined)\n if (options.bounds !== 'ticks' || options.ticks.source !== 'labels') {\n _applyBounds(this.getMinMax(false));\n }\n }\n\n min = isFinite(min) && !isNaN(min) ? min : +adapter.startOf(Date.now(), unit);\n max = isFinite(max) && !isNaN(max) ? max : +adapter.endOf(Date.now(), unit) + 1;\n\n // Make sure that max is strictly higher than min (required by the timeseries lookup table)\n this.min = Math.min(min, max - 1);\n this.max = Math.max(min + 1, max);\n }\n\n /**\n\t * @private\n\t */\n _getLabelBounds() {\n const arr = this.getLabelTimestamps();\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n\n if (arr.length) {\n min = arr[0];\n max = arr[arr.length - 1];\n }\n return {min, max};\n }\n\n /**\n\t * @return {object[]}\n\t */\n buildTicks() {\n const options = this.options;\n const timeOpts = options.time;\n const tickOpts = options.ticks;\n const timestamps = tickOpts.source === 'labels' ? this.getLabelTimestamps() : this._generate();\n\n if (options.bounds === 'ticks' && timestamps.length) {\n this.min = this._userMin || timestamps[0];\n this.max = this._userMax || timestamps[timestamps.length - 1];\n }\n\n const min = this.min;\n const max = this.max;\n\n const ticks = _filterBetween(timestamps, min, max);\n\n // PRIVATE\n // determineUnitForFormatting relies on the number of ticks so we don't use it when\n // autoSkip is enabled because we don't yet know what the final number of ticks will be\n this._unit = timeOpts.unit || (tickOpts.autoSkip\n ? determineUnitForAutoTicks(timeOpts.minUnit, this.min, this.max, this._getLabelCapacity(min))\n : determineUnitForFormatting(this, ticks.length, timeOpts.minUnit, this.min, this.max));\n this._majorUnit = !tickOpts.major.enabled || this._unit === 'year' ? undefined\n : determineMajorUnit(this._unit);\n this.initOffsets(timestamps);\n\n if (options.reverse) {\n ticks.reverse();\n }\n\n return ticksFromTimestamps(this, ticks, this._majorUnit);\n }\n\n afterAutoSkip() {\n // Offsets for bar charts need to be handled with the auto skipped\n // ticks. Once ticks have been skipped, we re-compute the offsets.\n if (this.options.offsetAfterAutoskip) {\n this.initOffsets(this.ticks.map(tick => +tick.value));\n }\n }\n\n /**\n\t * Returns the start and end offsets from edges in the form of {start, end}\n\t * where each value is a relative width to the scale and ranges between 0 and 1.\n\t * They add extra margins on the both sides by scaling down the original scale.\n\t * Offsets are added when the `offset` option is true.\n\t * @param {number[]} timestamps\n\t * @protected\n\t */\n initOffsets(timestamps = []) {\n let start = 0;\n let end = 0;\n let first, last;\n\n if (this.options.offset && timestamps.length) {\n first = this.getDecimalForValue(timestamps[0]);\n if (timestamps.length === 1) {\n start = 1 - first;\n } else {\n start = (this.getDecimalForValue(timestamps[1]) - first) / 2;\n }\n last = this.getDecimalForValue(timestamps[timestamps.length - 1]);\n if (timestamps.length === 1) {\n end = last;\n } else {\n end = (last - this.getDecimalForValue(timestamps[timestamps.length - 2])) / 2;\n }\n }\n const limit = timestamps.length < 3 ? 0.5 : 0.25;\n start = _limitValue(start, 0, limit);\n end = _limitValue(end, 0, limit);\n\n this._offsets = {start, end, factor: 1 / (start + 1 + end)};\n }\n\n /**\n\t * Generates a maximum of `capacity` timestamps between min and max, rounded to the\n\t * `minor` unit using the given scale time `options`.\n\t * Important: this method can return ticks outside the min and max range, it's the\n\t * responsibility of the calling code to clamp values if needed.\n\t * @private\n\t */\n _generate() {\n const adapter = this._adapter;\n const min = this.min;\n const max = this.max;\n const options = this.options;\n const timeOpts = options.time;\n // @ts-ignore\n const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, this._getLabelCapacity(min));\n const stepSize = valueOrDefault(options.ticks.stepSize, 1);\n const weekday = minor === 'week' ? timeOpts.isoWeekday : false;\n const hasWeekday = isNumber(weekday) || weekday === true;\n const ticks = {};\n let first = min;\n let time, count;\n\n // For 'week' unit, handle the first day of week option\n if (hasWeekday) {\n first = +adapter.startOf(first, 'isoWeek', weekday);\n }\n\n // Align first ticks on unit\n first = +adapter.startOf(first, hasWeekday ? 'day' : minor);\n\n // Prevent browser from freezing in case user options request millions of milliseconds\n if (adapter.diff(max, min, minor) > 100000 * stepSize) {\n throw new Error(min + ' and ' + max + ' are too far apart with stepSize of ' + stepSize + ' ' + minor);\n }\n\n const timestamps = options.ticks.source === 'data' && this.getDataTimestamps();\n for (time = first, count = 0; time < max; time = +adapter.add(time, stepSize, minor), count++) {\n addTick(ticks, time, timestamps);\n }\n\n if (time === max || options.bounds === 'ticks' || count === 1) {\n addTick(ticks, time, timestamps);\n }\n\n // @ts-ignore\n return Object.keys(ticks).sort((a, b) => a - b).map(x => +x);\n }\n\n /**\n\t * @param {number} value\n\t * @return {string}\n\t */\n getLabelForValue(value) {\n const adapter = this._adapter;\n const timeOpts = this.options.time;\n\n if (timeOpts.tooltipFormat) {\n return adapter.format(value, timeOpts.tooltipFormat);\n }\n return adapter.format(value, timeOpts.displayFormats.datetime);\n }\n\n /**\n\t * Function to format an individual tick mark\n\t * @param {number} time\n\t * @param {number} index\n\t * @param {object[]} ticks\n\t * @param {string|undefined} [format]\n\t * @return {string}\n\t * @private\n\t */\n _tickFormatFunction(time, index, ticks, format) {\n const options = this.options;\n const formatter = options.ticks.callback;\n\n if (formatter) {\n return call(formatter, [time, index, ticks], this);\n }\n\n const formats = options.time.displayFormats;\n const unit = this._unit;\n const majorUnit = this._majorUnit;\n const minorFormat = unit && formats[unit];\n const majorFormat = majorUnit && formats[majorUnit];\n const tick = ticks[index];\n const major = majorUnit && majorFormat && tick && tick.major;\n\n return this._adapter.format(time, format || (major ? majorFormat : minorFormat));\n }\n\n /**\n\t * @param {object[]} ticks\n\t */\n generateTickLabels(ticks) {\n let i, ilen, tick;\n\n for (i = 0, ilen = ticks.length; i < ilen; ++i) {\n tick = ticks[i];\n tick.label = this._tickFormatFunction(tick.value, i, ticks);\n }\n }\n\n /**\n\t * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)\n\t * @return {number}\n\t */\n getDecimalForValue(value) {\n return value === null ? NaN : (value - this.min) / (this.max - this.min);\n }\n\n /**\n\t * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)\n\t * @return {number}\n\t */\n getPixelForValue(value) {\n const offsets = this._offsets;\n const pos = this.getDecimalForValue(value);\n return this.getPixelForDecimal((offsets.start + pos) * offsets.factor);\n }\n\n /**\n\t * @param {number} pixel\n\t * @return {number}\n\t */\n getValueForPixel(pixel) {\n const offsets = this._offsets;\n const pos = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return this.min + pos * (this.max - this.min);\n }\n\n /**\n\t * @param {string} label\n\t * @return {{w:number, h:number}}\n\t * @private\n\t */\n _getLabelSize(label) {\n const ticksOpts = this.options.ticks;\n const tickLabelWidth = this.ctx.measureText(label).width;\n const angle = toRadians(this.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);\n const cosRotation = Math.cos(angle);\n const sinRotation = Math.sin(angle);\n const tickFontSize = this._resolveTickFontOptions(0).size;\n\n return {\n w: (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation),\n h: (tickLabelWidth * sinRotation) + (tickFontSize * cosRotation)\n };\n }\n\n /**\n\t * @param {number} exampleTime\n\t * @return {number}\n\t * @private\n\t */\n _getLabelCapacity(exampleTime) {\n const timeOpts = this.options.time;\n const displayFormats = timeOpts.displayFormats;\n\n // pick the longest format (milliseconds) for guestimation\n const format = displayFormats[timeOpts.unit] || displayFormats.millisecond;\n const exampleLabel = this._tickFormatFunction(exampleTime, 0, ticksFromTimestamps(this, [exampleTime], this._majorUnit), format);\n const size = this._getLabelSize(exampleLabel);\n // subtract 1 - if offset then there's one less label than tick\n // if not offset then one half label padding is added to each end leaving room for one less label\n const capacity = Math.floor(this.isHorizontal() ? this.width / size.w : this.height / size.h) - 1;\n return capacity > 0 ? capacity : 1;\n }\n\n /**\n\t * @protected\n\t */\n getDataTimestamps() {\n let timestamps = this._cache.data || [];\n let i, ilen;\n\n if (timestamps.length) {\n return timestamps;\n }\n\n const metas = this.getMatchingVisibleMetas();\n\n if (this._normalized && metas.length) {\n return (this._cache.data = metas[0].controller.getAllParsedValues(this));\n }\n\n for (i = 0, ilen = metas.length; i < ilen; ++i) {\n timestamps = timestamps.concat(metas[i].controller.getAllParsedValues(this));\n }\n\n return (this._cache.data = this.normalize(timestamps));\n }\n\n /**\n\t * @protected\n\t */\n getLabelTimestamps() {\n const timestamps = this._cache.labels || [];\n let i, ilen;\n\n if (timestamps.length) {\n return timestamps;\n }\n\n const labels = this.getLabels();\n for (i = 0, ilen = labels.length; i < ilen; ++i) {\n timestamps.push(parse(this, labels[i]));\n }\n\n return (this._cache.labels = this._normalized ? timestamps : this.normalize(timestamps));\n }\n\n /**\n\t * @param {number[]} values\n\t * @protected\n\t */\n normalize(values) {\n // It seems to be somewhat faster to do sorting first\n return _arrayUnique(values.sort(sorter));\n }\n}\n","import TimeScale from './scale.time';\nimport {_lookupByKey} from '../helpers/helpers.collection';\n\n/**\n * Linearly interpolates the given source `val` using the table. If value is out of bounds, values\n * at edges are used for the interpolation.\n * @param {object} table\n * @param {number} val\n * @param {boolean} [reverse] lookup time based on position instead of vice versa\n * @return {object}\n */\nfunction interpolate(table, val, reverse) {\n let lo = 0;\n let hi = table.length - 1;\n let prevSource, nextSource, prevTarget, nextTarget;\n if (reverse) {\n if (val >= table[lo].pos && val <= table[hi].pos) {\n ({lo, hi} = _lookupByKey(table, 'pos', val));\n }\n ({pos: prevSource, time: prevTarget} = table[lo]);\n ({pos: nextSource, time: nextTarget} = table[hi]);\n } else {\n if (val >= table[lo].time && val <= table[hi].time) {\n ({lo, hi} = _lookupByKey(table, 'time', val));\n }\n ({time: prevSource, pos: prevTarget} = table[lo]);\n ({time: nextSource, pos: nextTarget} = table[hi]);\n }\n\n const span = nextSource - prevSource;\n return span ? prevTarget + (nextTarget - prevTarget) * (val - prevSource) / span : prevTarget;\n}\n\nclass TimeSeriesScale extends TimeScale {\n\n static id = 'timeseries';\n\n /**\n * @type {any}\n */\n static defaults = TimeScale.defaults;\n\n /**\n\t * @param {object} props\n\t */\n constructor(props) {\n super(props);\n\n /** @type {object[]} */\n this._table = [];\n /** @type {number} */\n this._minPos = undefined;\n /** @type {number} */\n this._tableRange = undefined;\n }\n\n /**\n\t * @protected\n\t */\n initOffsets() {\n const timestamps = this._getTimestampsForTable();\n const table = this._table = this.buildLookupTable(timestamps);\n this._minPos = interpolate(table, this.min);\n this._tableRange = interpolate(table, this.max) - this._minPos;\n super.initOffsets(timestamps);\n }\n\n /**\n\t * Returns an array of {time, pos} objects used to interpolate a specific `time` or position\n\t * (`pos`) on the scale, by searching entries before and after the requested value. `pos` is\n\t * a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other\n\t * extremity (left + width or top + height). Note that it would be more optimized to directly\n\t * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need\n\t * to create the lookup table. The table ALWAYS contains at least two items: min and max.\n\t * @param {number[]} timestamps\n\t * @return {object[]}\n\t * @protected\n\t */\n buildLookupTable(timestamps) {\n const {min, max} = this;\n const items = [];\n const table = [];\n let i, ilen, prev, curr, next;\n\n for (i = 0, ilen = timestamps.length; i < ilen; ++i) {\n curr = timestamps[i];\n if (curr >= min && curr <= max) {\n items.push(curr);\n }\n }\n\n if (items.length < 2) {\n // In case there is less that 2 timestamps between min and max, the scale is defined by min and max\n return [\n {time: min, pos: 0},\n {time: max, pos: 1}\n ];\n }\n\n for (i = 0, ilen = items.length; i < ilen; ++i) {\n next = items[i + 1];\n prev = items[i - 1];\n curr = items[i];\n\n // only add points that breaks the scale linearity\n if (Math.round((next + prev) / 2) !== curr) {\n table.push({time: curr, pos: i / (ilen - 1)});\n }\n }\n return table;\n }\n\n /**\n\t * Returns all timestamps\n\t * @return {number[]}\n\t * @private\n\t */\n _getTimestampsForTable() {\n let timestamps = this._cache.all || [];\n\n if (timestamps.length) {\n return timestamps;\n }\n\n const data = this.getDataTimestamps();\n const label = this.getLabelTimestamps();\n if (data.length && label.length) {\n // If combining labels and data (data might not contain all labels),\n // we need to recheck uniqueness and sort\n timestamps = this.normalize(data.concat(label));\n } else {\n timestamps = data.length ? data : label;\n }\n timestamps = this._cache.all = timestamps;\n\n return timestamps;\n }\n\n /**\n\t * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)\n\t * @return {number}\n\t */\n getDecimalForValue(value) {\n return (interpolate(this._table, value) - this._minPos) / this._tableRange;\n }\n\n /**\n\t * @param {number} pixel\n\t * @return {number}\n\t */\n getValueForPixel(pixel) {\n const offsets = this._offsets;\n const decimal = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;\n return interpolate(this._table, decimal * this._tableRange + this._minPos, true);\n }\n}\n\nexport default TimeSeriesScale;\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n\n/**\n * @namespace Chart\n */\nimport Chart from './core/core.controller';\n\nimport * as helpers from './helpers';\nimport _adapters from './core/core.adapters';\nimport Animation from './core/core.animation';\nimport animator from './core/core.animator';\nimport Animations from './core/core.animations';\nimport * as controllers from './controllers';\nimport DatasetController from './core/core.datasetController';\nimport Element from './core/core.element';\nimport * as elements from './elements/index';\nimport Interaction from './core/core.interaction';\nimport layouts from './core/core.layouts';\nimport * as platforms from './platform/index';\nimport * as plugins from './plugins';\nimport registry from './core/core.registry';\nimport Scale from './core/core.scale';\nimport * as scales from './scales';\nimport Ticks from './core/core.ticks';\n\n// Register built-ins\nChart.register(controllers, scales, elements, plugins);\n\nChart.helpers = {...helpers};\nChart._adapters = _adapters;\nChart.Animation = Animation;\nChart.Animations = Animations;\nChart.animator = animator;\nChart.controllers = registry.controllers.items;\nChart.DatasetController = DatasetController;\nChart.Element = Element;\nChart.elements = elements;\nChart.Interaction = Interaction;\nChart.layouts = layouts;\nChart.platforms = platforms;\nChart.Scale = Scale;\nChart.Ticks = Ticks;\n\n// Compatibility with ESM extensions\nObject.assign(Chart, controllers, scales, elements, plugins, platforms);\nChart.Chart = Chart;\n\nif (typeof window !== 'undefined') {\n window.Chart = Chart;\n}\n\nexport default Chart;\n\n"],"names":["noop","uid","id","isNullOrUndef","value","isArray","Array","type","Object","prototype","toString","call","slice","isObject","isNumberFinite","Number","isFinite","finiteOrDefault","defaultValue","valueOrDefault","toPercentage","dimension","endsWith","parseFloat","toDimension","callback","fn","args","thisArg","apply","each","loopable","reverse","i","len","keys","length","_elementsEqual","a0","a1","ilen","v0","v1","datasetIndex","index","clone","source","map","target","create","klen","k","isValidKey","key","indexOf","_merger","options","tval","sval","merge","sources","merger","current","mergeIf","_mergerIf","hasOwnProperty","keyResolvers","v","x","o","y","_splitKey","parts","split","tmp","part","push","resolveObjectKey","obj","resolver","_getKeyResolver","_capitalize","str","charAt","toUpperCase","defined","isFunction","setsEqual","a","b","size","item","has","_isClickEvent","e","PI","Math","TAU","PITAU","INFINITY","POSITIVE_INFINITY","RAD_PER_DEG","HALF_PI","QUARTER_PI","TWO_THIRDS_PI","log10","sign","almostEquals","epsilon","abs","niceNum","range","roundedRange","round","niceRange","pow","floor","fraction","_factorize","result","sqrt","sort","pop","isNumber","n","isNaN","almostWhole","rounded","_setMinAndMaxByKey","array","property","min","max","toRadians","degrees","toDegrees","radians","_decimalPlaces","isFiniteNumber","p","getAngleFromPoint","centrePoint","anglePoint","distanceFromXCenter","distanceFromYCenter","radialDistanceFromCenter","angle","atan2","distance","distanceBetweenPoints","pt1","pt2","_angleDiff","_normalizeAngle","_angleBetween","start","end","sameAngleIsFullCircle","s","angleToStart","angleToEnd","startToAngle","endToAngle","_limitValue","_int16Range","_isBetween","_lookup","table","cmp","mid","hi","lo","_lookupByKey","last","ti","_rlookupByKey","_filterBetween","values","arrayEvents","listenArrayEvents","listener","_chartjs","listeners","defineProperty","configurable","enumerable","forEach","method","base","res","this","object","unlistenArrayEvents","stub","splice","_arrayUnique","items","set","Set","add","from","requestAnimFrame","window","requestAnimationFrame","throttled","ticking","debounce","delay","timeout","clearTimeout","setTimeout","_toLeftRightCenter","align","_alignStartEnd","_textX","left","right","rtl","_getStartAndCountOfVisiblePoints","meta","points","animationsDisabled","pointCount","count","_sorted","iScale","_parsed","axis","minDefined","maxDefined","getUserBounds","getPixelForValue","_scaleRangesChanged","xScale","yScale","_scaleRanges","newRanges","xmin","xmax","ymin","ymax","changed","assign","Animator","constructor","_request","_charts","Map","_running","_lastDate","undefined","_notify","chart","anims","date","callbacks","numSteps","duration","initial","currentStep","_refresh","_update","Date","now","remaining","running","draw","_active","_total","tick","_getAnims","charts","get","complete","progress","listen","event","cb","reduce","acc","cur","_duration","stop","cancel","remove","delete","animator","lim","l","h","p2b","n2b","b2n","n2p","map$1","A","B","C","D","E","F","c","d","f","hex","h1","h2","eq","hexString","r","g","isShort","alpha","HUE_RE","hsl2rgbn","hsv2rgbn","hwb2rgbn","w","rgb","rgb2hsl","hueValue","calln","hsl2rgb","hue","hueParse","m","exec","p1","p2","hwb2rgb","hsv2rgb","Z","Y","X","W","V","U","T","S","R","Q","P","O","N","M","L","K","G","H","I","J","names$1","OiceXe","antiquewEte","aqua","aquamarRe","azuY","beige","bisque","black","blanKedOmond","Xe","XeviTet","bPwn","burlywood","caMtXe","KartYuse","KocTate","cSO","cSnflowerXe","cSnsilk","crimson","cyan","xXe","xcyan","xgTMnPd","xWay","xgYF","xgYy","xkhaki","xmagFta","xTivegYF","xSange","xScEd","xYd","xsOmon","xsHgYF","xUXe","xUWay","xUgYy","xQe","xviTet","dAppRk","dApskyXe","dimWay","dimgYy","dodgerXe","fiYbrick","flSOwEte","foYstWAn","fuKsia","gaRsbSo","ghostwEte","gTd","gTMnPd","Way","gYF","gYFLw","gYy","honeyMw","hotpRk","RdianYd","Rdigo","ivSy","khaki","lavFMr","lavFMrXsh","lawngYF","NmoncEffon","ZXe","ZcSO","Zcyan","ZgTMnPdLw","ZWay","ZgYF","ZgYy","ZpRk","ZsOmon","ZsHgYF","ZskyXe","ZUWay","ZUgYy","ZstAlXe","ZLw","lime","limegYF","lRF","magFta","maPon","VaquamarRe","VXe","VScEd","VpurpN","VsHgYF","VUXe","VsprRggYF","VQe","VviTetYd","midnightXe","mRtcYam","mistyPse","moccasR","navajowEte","navy","Tdlace","Tive","TivedBb","Sange","SangeYd","ScEd","pOegTMnPd","pOegYF","pOeQe","pOeviTetYd","papayawEp","pHKpuff","peru","pRk","plum","powMrXe","purpN","YbeccapurpN","Yd","Psybrown","PyOXe","saddNbPwn","sOmon","sandybPwn","sHgYF","sHshell","siFna","silver","skyXe","UXe","UWay","UgYy","snow","sprRggYF","stAlXe","tan","teO","tEstN","tomato","Qe","viTet","JHt","wEte","wEtesmoke","Lw","LwgYF","names","nameParse","unpacked","tkeys","j","ok","nk","replace","parseInt","unpack","transparent","toLowerCase","RGB_RE","to","modHSL","ratio","proto","fromObject","input","functionParse","rgbParse","Color","ret","_rgb","_valid","valid","rgbString","hslString","mix","color","weight","c1","c2","w2","w1","interpolate","t","rgb1","rgb2","clearer","greyscale","val","opaquer","negate","lighten","darken","saturate","desaturate","rotate","deg","index_esm","isPatternOrGradient","colorLib","getHoverColor","numbers","colors","intlCache","formatNumber","num","locale","cacheKey","JSON","stringify","formatter","Intl","NumberFormat","getNumberFormat","format","formatters","numeric","tickValue","ticks","notation","delta","maxTick","calculateDelta","logDelta","numDecimal","minimumFractionDigits","maximumFractionDigits","logarithmic","remain","significand","includes","Ticks","overrides","descriptors","getScope","node","root","scope","Defaults","_descriptors","_appliers","animation","backgroundColor","borderColor","datasets","devicePixelRatio","context","platform","getDevicePixelRatio","elements","events","font","family","style","lineHeight","hover","hoverBackgroundColor","ctx","hoverBorderColor","hoverColor","indexAxis","interaction","mode","intersect","includeInvisible","maintainAspectRatio","onHover","onClick","parsing","plugins","responsive","scale","scales","showLine","drawActiveElementsOnTop","describe","override","route","name","targetScope","targetName","scopeObject","targetScopeObject","privateName","defineProperties","writable","local","appliers","defaults","_scriptable","startsWith","_indexable","_fallback","easing","loop","properties","active","resize","show","animations","visible","hide","autoPadding","padding","top","bottom","display","offset","beginAtZero","bounds","grace","grid","lineWidth","drawOnChartArea","drawTicks","tickLength","tickWidth","_ctx","tickColor","border","dash","dashOffset","width","title","text","minRotation","maxRotation","mirror","textStrokeWidth","textStrokeColor","autoSkip","autoSkipPadding","labelOffset","minor","major","crossAlign","showLabelBackdrop","backdropColor","backdropPadding","_isDomSupported","document","_getParentNode","domNode","parent","parentNode","host","parseMaxStyle","styleValue","parentProperty","valueInPixels","getComputedStyle","element","ownerDocument","defaultView","getStyle","el","getPropertyValue","positions","getPositionedStyle","styles","suffix","pos","height","getRelativePosition","canvas","currentDevicePixelRatio","borderBox","boxSizing","paddings","borders","box","touches","offsetX","offsetY","shadowRoot","useOffsetPos","rect","getBoundingClientRect","clientX","clientY","getCanvasPosition","xOffset","yOffset","round1","getMaximumSize","bbWidth","bbHeight","aspectRatio","margins","maxWidth","maxHeight","containerSize","container","containerStyle","containerBorder","containerPadding","clientWidth","clientHeight","getContainerSize","retinaScale","forceRatio","forceStyle","pixelRatio","deviceHeight","deviceWidth","setTransform","supportsEventListenerOptions","passiveSupported","passive","addEventListener","removeEventListener","readUsedSize","matches","match","toFontString","_measureText","data","gc","longest","string","textWidth","measureText","_longestText","arrayOfThings","cache","garbageCollect","save","jlen","thing","nestedThing","restore","gcLen","_alignPixel","pixel","halfWidth","clearCanvas","getContext","resetTransform","clearRect","drawPoint","drawPointLegend","cornerRadius","xOffsetW","yOffsetW","pointStyle","rotation","radius","rad","translate","drawImage","beginPath","ellipse","arc","closePath","moveTo","sin","cos","lineTo","SQRT1_2","fill","borderWidth","stroke","_isPointInArea","point","area","margin","clipArea","clip","unclipArea","_steppedLineTo","previous","flip","midpoint","_bezierCurveTo","bezierCurveTo","cp1x","cp2x","cp1y","cp2y","renderText","opts","lines","strokeWidth","strokeColor","line","translation","fillStyle","textAlign","textBaseline","setRenderOpts","backdrop","drawBackdrop","strokeStyle","strokeText","fillText","decorateText","strikethrough","underline","metrics","actualBoundingBoxLeft","actualBoundingBoxRight","actualBoundingBoxAscent","actualBoundingBoxDescent","yDecoration","decorationWidth","oldColor","fillRect","addRoundedRectPath","topLeft","bottomLeft","bottomRight","topRight","_createResolver","scopes","prefixes","rootScopes","fallback","getTarget","_resolve","Symbol","toStringTag","_cacheable","_scopes","_rootScopes","_getTarget","Proxy","deleteProperty","prop","_keys","_cached","proxy","prefix","readKey","needsSubResolver","createSubResolver","_resolveWithPrefixes","getOwnPropertyDescriptor","Reflect","getPrototypeOf","getKeysFromAllScopes","ownKeys","storage","_storage","_attachContext","subProxy","descriptorDefaults","_proxy","_context","_subProxy","_stack","setContext","receiver","isScriptable","Error","join","_resolveScriptable","isIndexable","arr","filter","_resolveArray","_resolveWithContext","allKeys","scriptable","indexable","_allKeys","resolve","resolveFallback","addScopes","parentScopes","parentFallback","allScopes","addScopesFromKey","subGetTarget","resolveKeysFromAllScopes","_parseObjectDataRadialScale","_parsing","parsed","parse","EPSILON","getPoint","skip","getValueAxis","splineCurve","firstPoint","middlePoint","afterPoint","next","d01","d12","s01","s12","fa","fb","splineCurveMonotone","valueAxis","pointsLen","deltaK","mK","pointBefore","pointCurrent","pointAfter","slopeDelta","alphaK","betaK","tauK","squaredMagnitude","monotoneAdjust","iPixel","vPixel","monotoneCompute","capControlPoint","pt","_updateBezierControlPoints","controlPoints","spanGaps","cubicInterpolationMode","prev","tension","capBezierPoints","inArea","inAreaPrev","inAreaNext","atEdge","elasticIn","elasticOut","effects","linear","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","easeInSine","easeOutSine","easeInOutSine","easeInExpo","easeOutExpo","easeInOutExpo","easeInCirc","easeOutCirc","easeInOutCirc","easeInElastic","easeOutElastic","easeInOutElastic","easeInBack","easeOutBack","easeInOutBack","easeInBounce","easeOutBounce","easeInOutBounce","effects$1","_pointInLine","_steppedInterpolation","_bezierInterpolation","cp1","cp2","LINE_HEIGHT","FONT_STYLE","toLineHeight","_readValueToProps","props","objProps","read","toTRBL","toTRBLCorners","toPadding","toFont","console","warn","inputs","info","cacheable","_addGrace","minmax","change","keepZero","createContext","parentContext","getRtlAdapter","rectX","setWidth","xPlus","leftForLtr","itemWidth","getRightToLeftAdapter","_itemWidth","overrideTextDirection","direction","original","getPropertyPriority","setProperty","prevTextDirection","restoreTextDirection","propertyFn","between","compare","normalize","normalizeSegment","_boundSegment","segment","startBound","endBound","getSegment","prevValue","inside","subStart","shouldStart","shouldStop","_boundSegments","segments","sub","_computeSegments","segmentOptions","_loop","findStartAndEnd","splitByStyles","solidSegments","_fullLoop","chartContext","_chart","baseStyle","readStyle","_datasetIndex","prevStyle","addStyle","st","dir","p0","p0DataIndex","p1DataIndex","styleChanged","doSplitByStyles","borderCapStyle","borderDash","borderDashOffset","borderJoinStyle","pixelSize","fontStyle","fontFamily","binarySearch","metaset","controller","_cachedMeta","lookupMethod","_reversePixels","_sharedOptions","getRange","evaluateInteractionItems","position","handler","metasets","getSortedVisibleDatasetMetas","getIntersectItems","useFinalPosition","isPointInArea","chartArea","inRange","getNearestCartesianItems","distanceMetric","useX","useY","deltaX","deltaY","getDistanceMetricForAxis","minDistance","center","getCenterPoint","getNearestItems","startAngle","endAngle","getProps","getNearestRadialItems","getAxisItems","rangeMethod","intersectsItem","Interaction","modes","dataset","getDatasetMeta","nearest","STATIC_POSITIONS","filterByPosition","filterDynamicPositionByAxis","sortByWeight","setLayoutDims","layouts","params","stacks","wrap","stack","stackWeight","placed","buildStacks","vBoxMaxWidth","hBoxMaxHeight","layout","fullSize","factor","horizontal","availableWidth","availableHeight","getCombinedMax","maxPadding","updateMaxPadding","boxPadding","updateDims","getPadding","newWidth","outerWidth","newHeight","outerHeight","widthChanged","heightChanged","same","other","getMargins","marginForPositions","fitBoxes","boxes","refitBoxes","refit","update","setBoxDims","placeBoxes","userPadding","addBox","_layers","z","removeBox","layoutItem","configure","minPadding","layoutBoxes","isHorizontal","wrapBoxes","centerHorizontal","centerVertical","leftAndTop","concat","rightAndBottom","vertical","buildLayoutBoxes","verticalBoxes","horizontalBoxes","beforeLayout","visibleVerticalBoxCount","total","freeze","updatePos","handleMaxPadding","BasePlatform","acquireContext","releaseContext","isAttached","updateConfig","config","BasicPlatform","EVENT_TYPES","touchstart","touchmove","touchend","pointerenter","pointerdown","pointermove","pointerup","pointerleave","pointerout","isNullOrEmpty","eventListenerOptions","removeListener","nodeListContains","nodeList","contains","createAttachObserver","observer","MutationObserver","entries","trigger","entry","addedNodes","removedNodes","observe","childList","subtree","createDetachObserver","drpListeningCharts","oldDevicePixelRatio","onWindowResize","dpr","createResizeObserver","ResizeObserver","contentRect","listenDevicePixelRatioChanges","releaseObserver","disconnect","unlistenDevicePixelRatioChanges","createProxyAndListen","native","fromNativeEvent","addListener","DomPlatform","renderHeight","getAttribute","renderWidth","displayWidth","displayHeight","initCanvas","removeAttribute","setAttribute","proxies","$proxies","attach","detach","isConnected","_detectPlatform","OffscreenCanvas","interpolators","boolean","c0","helpersColor","number","Animation","cfg","currentValue","_fn","_easing","_start","_target","_prop","_from","_to","_promises","elapsed","wait","promises","Promise","rej","resolved","Animations","_properties","animationOptions","animatedProps","getOwnPropertyNames","option","_animateOptions","newOptions","$shared","$animations","resolveTargetOptions","_createAnimations","anim","all","awaitAll","then","scaleClip","allowedOverflow","getSortedDatasetIndices","filterVisible","_getSortedDatasetMetas","applyStack","dsIndex","singleMode","otherValue","isStacked","stacked","getOrCreateStack","stackKey","indexValue","subStack","getLastIndexInStack","vScale","positive","getMatchingVisibleMetas","updateStacks","_stacks","iAxis","vAxis","indexScale","valueScale","getStackKey","_top","_bottom","getFirstScaleId","shift","clearStacks","isDirectUpdateMode","cloneIfNotShared","cached","shared","DatasetController","static","_cachedDataOpts","getMeta","_type","_data","_objectData","_drawStart","_drawCount","enableOptionSharing","supportsDecimation","$context","_syncList","datasetElementType","dataElementType","initialize","linkScales","_stacked","addElements","isPluginEnabled","updateIndex","getDataset","chooseId","xid","xAxisID","yid","yAxisID","rid","rAxisID","iid","iAxisID","vid","vAxisID","getScaleForId","rScale","scaleID","_getOtherScale","reset","_destroy","_dataCheck","adata","convertObjectDataToArray","isExtensible","buildOrUpdateElements","resetNewElements","stackChanged","oldStacked","_resyncElements","scopeKeys","datasetScopeKeys","getOptionScopes","createResolver","sorted","parseArrayData","parseObjectData","parsePrimitiveData","isNotInOrderComparedToPrev","labels","getLabels","singleScale","xAxisKey","yAxisKey","getParsed","getDataElement","updateRangeFromParsed","parsedValue","NaN","getMinMax","canStack","otherScale","hidden","createStack","NEGATIVE_INFINITY","otherMin","otherMax","_skip","getAllParsedValues","getMaxOverflow","getLabelAndValue","label","getLabelForValue","_clip","disabled","toClip","defaultClip","resolveDatasetElementOptions","resolveDataElementOptions","dataIndex","raw","createDataContext","createDatasetContext","_resolveElementOptions","elementType","sharing","datasetElementScopeKeys","resolveNamedOptions","_resolveAnimations","transition","datasetAnimationScopeKeys","getSharedOptions","includeOptions","sharedOptions","_animationsDisabled","_getSharedOptions","firstOpts","previouslySharedOptions","updateSharedOptions","updateElement","_setStyle","removeHoverStyle","setHoverStyle","_removeDatasetHoverStyle","_setDatasetHoverStyle","arg1","arg2","numMeta","numData","_insertElements","_removeElements","move","updateElements","removed","_sync","_dataChanges","_onDataPush","arguments","_onDataPop","_onDataShift","_onDataSplice","newCount","_onDataUnshift","Element","tooltipPosition","hasValue","final","tickOpts","determinedMaxTicks","_tickSize","maxScale","_length","maxChart","_maxLength","determineMaxTicks","ticksLimit","maxTicksLimit","majorIndices","enabled","getMajorIndices","numMajorIndices","first","newTicks","spacing","ceil","skipMajors","evenMajorSpacing","diff","getEvenSpacing","factors","calculateSpacing","avgMajorSpacing","majorStart","majorEnd","offsetFromEdge","edge","sample","numItems","increment","getPixelForGridLine","offsetGridLines","validIndex","_startPixel","_endPixel","lineValue","getPixelForTick","getTickMarkLength","getTitleHeight","titleAlign","reverseAlign","Scale","super","_margins","paddingTop","paddingBottom","paddingLeft","paddingRight","labelRotation","_range","_gridLineItems","_labelItems","_labelSizes","_longestTextCache","_userMax","_userMin","_suggestedMax","_suggestedMin","_ticksLength","_borderValue","_cache","_dataLimitsCached","init","suggestedMin","suggestedMax","metas","getTicks","xLabels","yLabels","beforeUpdate","sampleSize","beforeSetDimensions","setDimensions","afterSetDimensions","beforeDataLimits","determineDataLimits","afterDataLimits","beforeBuildTicks","buildTicks","afterBuildTicks","samplingEnabled","_convertTicksToLabels","beforeCalculateLabelRotation","calculateLabelRotation","afterCalculateLabelRotation","afterAutoSkip","beforeFit","fit","afterFit","afterUpdate","startPixel","endPixel","reversePixels","_alignToPixels","alignToPixels","_callHooks","notifyPlugins","beforeTickToLabelConversion","generateTickLabels","afterTickToLabelConversion","numTicks","maxLabelDiagonal","_isVisible","labelSizes","_getLabelSizes","maxLabelWidth","widest","maxLabelHeight","highest","asin","minSize","titleOpts","gridOpts","titleHeight","tickPadding","angleRadians","labelHeight","labelWidth","_calculatePadding","_handleMargins","isRotated","labelsBelowTicks","offsetLeft","offsetRight","isFullSize","_computeLabelSizes","caches","widths","heights","tickFont","fontString","nestedLabel","widestLabelSize","highestLabelSize","_resolveTickFontOptions","valueAt","idx","getValueForPixel","getPixelForDecimal","decimal","getDecimalForPixel","getBasePixel","getBaseValue","createTickContext","optionTicks","rot","_computeGridLineItems","ticksLength","tl","borderOpts","axisWidth","axisHalfWidth","alignBorderValue","borderValue","alignedLineValue","tx1","ty1","tx2","ty2","x1","y1","x2","y2","positionAxisID","limit","step","optsAtIndex","optsAtIndexBorder","lineColor","tickBorderDash","tickBorderDashOffset","_computeLabelItems","tickAndPadding","hTickAndPadding","lineCount","textOffset","_getXAxisLabelAlignment","_getYAxisLabelAlignment","halfCount","tickTextAlign","labelPadding","_computeLabelArea","drawBackground","getLineWidthForValue","findIndex","drawGrid","drawLine","setLineDash","lineDashOffset","drawBorder","lastLineWidth","drawLabels","drawTitle","titleX","titleY","titleArgs","tz","gz","bz","axisID","_maxDigits","fontSize","TypedRegistry","isForType","isPrototypeOf","register","parentScope","isIChartComponent","itemDefaults","defaultRoutes","routes","propertyParts","sourceName","sourceScope","routeDefaults","registerDefaults","unregister","Registry","controllers","_typedRegistries","_each","addControllers","addPlugins","addScales","getController","_get","getElement","getPlugin","getScale","removeControllers","removeElements","removePlugins","removeScales","typedRegistry","arg","reg","_getRegistryForType","_exec","itemReg","registry","component","camelMethod","PluginService","_init","notify","hook","_createDescriptors","descriptor","plugin","callCallback","cancelable","invalidate","_oldCache","_notifyStateChanges","localIds","allPlugins","getOpts","pluginOpts","createDescriptors","previousDescriptors","some","pluginScopeKeys","getIndexAxis","datasetDefaults","determineAxis","scaleOptions","initOptions","chartDefaults","configScales","chartIndexAxis","scaleConf","error","defaultId","getDefaultScaleIDFromAxis","defaultScaleOptions","defaultID","getAxisFromDefaultScaleID","mergeScaleConfig","initData","keyCache","keysCached","cachedKeys","generate","addIfFound","Config","_config","initConfig","_scopeCache","_resolverCache","clearCache","clear","datasetType","additionalOptionScopes","_cachedScopes","mainScope","resetCache","keyLists","chartOptionScopes","subPrefixes","getResolver","hasFunction","needContext","resolverCache","KNOWN_POSITIONS","positionIsHorizontal","compare2Level","l1","l2","onAnimationsComplete","onComplete","onAnimationProgress","onProgress","getCanvas","getElementById","instances","getChart","moveNumericKeys","intKey","Chart","invalidatePlugins","userConfig","initialCanvas","existingChart","_options","_aspectRatio","_metasets","_lastEvent","_listeners","_responsiveListeners","_sortedMetasets","_plugins","_hiddenIndices","attached","_doResize","resizeDelay","_initialize","bindEvents","_resizeBeforeDraw","_resize","newSize","newRatio","onResize","render","ensureScalesHaveIDs","axisOptions","buildOrUpdateScales","scaleOpts","updated","isRadial","dposition","dtype","scaleType","hasUpdated","_updateMetasets","_destroyDatasetMeta","_removeUnreferencedMetasets","_dataset","buildOrUpdateControllers","newControllers","order","isDatasetVisible","ControllerClass","_resetElements","animsDisabled","_updateScales","_checkEventBindings","_updateHiddenIndices","_minPadding","_updateLayout","_updateDatasets","_eventHandler","_updateHoverStyles","existingEvents","newEvents","unbindEvents","changes","_getUniformDataChanges","datasetCount","makeSet","changeSet","noArea","_idx","_updateDataset","layers","_drawDatasets","_drawDataset","useClip","getDatasetArea","getElementsAtEventForMode","getVisibleDatasetCount","setDatasetVisibility","toggleDataVisibility","getDataVisibility","_updateVisibility","_stop","destroy","toBase64Image","toDataURL","bindUserEvents","bindResponsiveEvents","_add","_remove","detached","updateHoverStyle","getActiveElements","setActiveElements","activeElements","lastActive","pluginId","replay","hoverOptions","deactivated","activated","inChartArea","eventFilter","_handleEvent","_getActiveElements","isClick","lastEvent","determineLastEvent","Chart$1","abstract","DateAdapterBase","members","formats","startOf","endOf","_adapters","_date","computeMinSampleSize","$bar","visibleMetas","getAllScaleValues","curr","updateMinAndPrev","parseValue","startValue","endValue","barStart","barEnd","_custom","parseFloatBar","parseArrayOrPrimitive","isFloatBar","custom","setBorderSkipped","borderSkipped","borderProps","enableBorderRadius","parseEdge","orig","v2","startEnd","setInflateAmount","inflateAmount","DoughnutController","animateRotate","animateScale","cutout","circumference","legend","generateLabels","fontColor","legendItem","innerRadius","outerRadius","getter","_getRotation","_getCircumference","_getRotationExtents","arcs","getMaxBorderWidth","getMaxOffset","maxSize","chartWeight","_getRingWeight","ratioX","ratioY","startX","startY","endX","endY","calcMax","calcMin","maxX","maxY","minX","minY","getRatioAndOffset","maxRadius","radiusLength","_getVisibleDatasetWeightTotal","calculateTotal","_getRingWeightOffset","_circumference","calculateCircumference","animationOpts","centerX","centerY","metaData","borderAlign","hoverBorderWidth","hoverOffset","ringWeightOffset","categoryPercentage","barPercentage","grouped","_index_","_value_","iAxisKey","vAxisKey","bars","ruler","_getRuler","vpixels","head","_calculateBarValuePixels","ipixels","_calculateBarIndexPixels","_getStacks","skipNull","_getStackCount","_getStackIndex","pixels","barThickness","stackCount","baseValue","minBarLength","actualBase","floating","barSign","halfGrid","maxBarThickness","Infinity","percent","chunk","computeFlexCategoryTraits","thickness","computeFitCategoryTraits","stackIndex","rects","_decimated","animated","maxGapLength","directUpdate","pointsCount","prevParsed","nullData","lastPoint","updateControlPoints","angleLines","circular","pointLabels","bind","_updateRadius","cutoutPercentage","xCenter","yCenter","datasetStartAngle","getIndexAngle","defaultAngle","countVisibleElements","_computeAngle","getDistanceFromCenterForValue","pointPosition","getPointPositionForValue","parseBorderRadius","angleDelta","borderRadius","halfThickness","innerLimit","computeOuterLimit","outerArcLimit","outerStart","outerEnd","innerStart","innerEnd","rThetaToXY","theta","pathArc","pixelMargin","innerR","spacingOffset","avNogSpacingRadius","angleOffset","outerStartAdjustedRadius","outerEndAdjustedRadius","outerStartAdjustedAngle","outerEndAdjustedAngle","innerStartAdjustedRadius","innerEndAdjustedRadius","innerStartAdjustedAngle","innerEndAdjustedAngle","outerMidAdjustedAngle","pCenter","p4","innerMidAdjustedAngle","p8","outerStartX","outerStartY","outerEndX","outerEndY","fullCircles","inner","lineJoin","angleMargin","clipArc","setStyle","lineCap","pathVars","paramsStart","paramsEnd","segmentStart","segmentEnd","outside","pathSegment","lineMethod","stepped","getLineMethod","fastPathSegment","prevX","lastY","avgX","countX","pointIndex","drawX","truncX","_getSegmentMethod","usePath2D","Path2D","path","_path","strokePathWithCache","segmentMethod","strokePathDirect","LineElement","_points","_segments","_pointsUpdated","_interpolate","_getInterpolationMethod","interpolated","hitRadius","getBarBounds","bar","half","skipOrLimit","boundingRects","maxW","maxH","parseBorderWidth","maxR","enableBorder","outer","skipX","skipY","addNormalRectPath","inflateRect","amount","refRect","chartX","chartY","rAdjust","betweenAngles","withinRadius","halfAngle","halfRadius","radiusOffset","drawArc","hoverRadius","mouseX","mouseY","inXRange","inYRange","addRectPath","BORDER_COLORS","BACKGROUND_COLORS","getBorderColor","getBackgroundColor","getColorizer","createDoughnutDatasetColorizer","createPolarAreaDatasetColorizer","containsColorsDefinitions","plugin_colors","_args","colorizer","cleanDecimatedDataset","cleanDecimatedData","plugin_decimation","algorithm","beforeElementsUpdate","xAxis","getStartAndCountOfVisiblePointsSimplified","threshold","decimated","samples","bucketWidth","sampledIndex","endIndex","maxAreaPoint","maxArea","nextA","avgY","avgRangeStart","avgRangeEnd","avgRangeLength","rangeOffs","rangeTo","pointAx","pointAy","lttbDecimation","minIndex","maxIndex","startIndex","xMin","dx","lastIndex","intermediateIndex1","intermediateIndex2","minMaxDecimation","_getBounds","_findSegmentEnd","_getEdge","_createBoundaryLine","boundary","linePoints","_pointsFromSegments","_shouldApplyFill","_resolveTarget","propagate","visited","_decodeFill","fillOption","parseFillOption","firstCh","decodeTargetIndex","addPointsBelow","sourcePoint","linesBelow","postponed","findPoint","unshift","pointValue","firstValue","lastValue","simpleArc","getLineByIndex","sourcePoints","below","getLinesBelow","_buildStackLine","_getTargetValue","computeCircularBoundary","_getTargetPixel","computeLinearBoundary","computeBoundary","_drawfill","lineOpts","above","clipVertical","doFill","clipY","lineLoop","tpoints","targetSegments","tgt","subBounds","fillSources","fillSource","src","notShape","clipBounds","interpolatedLineTo","targetLoop","interpolatedPoint","afterDatasetsUpdate","$filler","beforeDraw","drawTime","beforeDatasetsDraw","beforeDatasetDraw","getBoxSize","labelOpts","boxHeight","boxWidth","usePointStyle","pointStyleWidth","itemHeight","Legend","_added","legendHitBoxes","_hoveredItem","doughnutMode","legendItems","columnSizes","lineWidths","buildLabels","labelFont","_computeTitleHeight","_fitRows","_fitCols","hitboxes","totalHeight","row","_itemHeight","heightLimit","totalWidth","currentColWidth","currentColHeight","col","legendItemText","calculateItemWidth","fontLineHeight","calculateLegendItemHeight","calculateItemHeight","calculateItemSize","adjustHitBoxes","rtlHelper","hitbox","_draw","defaultColor","halfFontSize","cursor","textDirection","lineDash","drawOptions","SQRT2","yBoxTop","xBoxLeft","drawLegendBox","titleFont","titlePadding","topPaddingPlusHalfFontSize","_getLegendItemAt","hitBox","lh","handleEvent","onLeave","isListened","hoveredItem","sameItem","plugin_legend","_element","afterEvent","ci","useBorderRadius","Title","_padding","textSize","_drawArgs","fontOpts","plugin_title","titleBlock","createTitle","WeakMap","plugin_subtitle","positioners","average","eventPosition","nearestElement","tp","pushOrConcat","toPush","splitNewlines","String","createTooltipItem","formattedValue","getTooltipSize","tooltip","body","footer","bodyFont","footerFont","titleLineCount","footerLineCount","bodyLineItemCount","combinedBodyLength","bodyItem","before","after","beforeBody","afterBody","titleSpacing","titleMarginBottom","displayColors","bodySpacing","footerMarginTop","footerSpacing","widthPadding","maxLineWidth","determineXAlign","yAlign","chartWidth","xAlign","caret","caretSize","caretPadding","doesNotFitWithAlign","determineAlignment","determineYAlign","getBackgroundPoint","alignment","paddingAndSize","alignX","alignY","getAlignedX","getBeforeAfterBodyLines","overrideCallbacks","defaultCallbacks","beforeTitle","tooltipItems","labelCount","afterTitle","beforeLabel","tooltipItem","labelColor","labelTextColor","bodyColor","labelPointStyle","afterLabel","beforeFooter","afterFooter","invokeCallbackWithFallback","Tooltip","opacity","_eventPosition","_size","_cachedAnimations","_tooltipItems","dataPoints","caretX","caretY","labelColors","labelPointStyles","labelTextColors","getTitle","getBeforeBody","getBody","bodyItems","scoped","getAfterBody","getFooter","_createItems","itemSort","positionAndSize","backgroundPoint","external","drawCaret","tooltipPoint","caretPosition","getCaretPosition","x3","y3","ptX","ptY","titleColor","_drawColorBox","colorX","rtlColorX","yOffSet","colorY","multiKeyBackground","outerX","innerX","strokeRect","drawBody","bodyAlign","bodyLineHeight","xLinePadding","fillLineOfText","bodyAlignForCalculation","textColor","drawFooter","footerAlign","footerColor","tooltipSize","quadraticCurveTo","_updateAnimationTarget","animX","animY","_willRender","hasTooltipContent","globalAlpha","positionChanged","_positionChanged","_ignoreReplayEvents","plugin_tooltip","afterInit","afterDraw","findOrAddLabel","addedLabels","addIfString","lastIndexOf","_getLabelForValue","relativeLabelSize","minSpacing","LinearScaleBase","_startValue","_endValue","_valueRange","handleTickRangeOptions","setMin","setMax","minSign","maxSign","getTickLimit","maxTicks","stepSize","computeTickLimit","generationOptions","dataRange","precision","maxDigits","includeBounds","unit","maxSpaces","rmin","rmax","countDefined","niceMin","niceMax","numSpaces","decimalPlaces","generateTicks","LinearScale","log10Floor","changeExponent","isMajor","tickVal","steps","rangeExp","rangeStep","minExp","exp","startExp","lastTick","LogarithmicScale","_zero","getTickBackdropHeight","determineLimits","fitWithPointLabels","limits","valueCount","_pointLabels","pointLabelOpts","additionalAngle","centerPointLabels","getPointLabelContext","getPointPosition","drawingArea","plFont","updateLimits","setCenterPoint","_pointLabelItems","extra","outerDistance","pointLabelPosition","yForAngle","getTextAlignForAngle","leftForTextAlign","buildPointLabelItems","hLimits","vLimits","pathRadiusLine","RadialLinearScale","animate","leftMovement","rightMovement","topMovement","bottomMovement","scalingFactor","getValueForDistanceFromCenter","scaledDistance","pointLabel","createPointLabelContext","distanceFromCenter","getBasePosition","getPointLabelPosition","backdropLeft","backdropTop","backdropWidth","backdropHeight","drawPointLabels","gridLineOpts","drawRadiusLine","INTERVALS","millisecond","common","second","minute","hour","day","week","month","quarter","year","UNITS","sorter","adapter","_adapter","parser","isoWeekday","_parseOpts","determineUnitForAutoTicks","minUnit","capacity","interval","MAX_SAFE_INTEGER","addTick","time","timestamps","ticksFromTimestamps","majorUnit","setMajorTicks","TimeScale","adapters","displayFormats","_unit","_majorUnit","_offsets","_normalized","normalized","_applyBounds","_getLabelBounds","getLabelTimestamps","timeOpts","_generate","_getLabelCapacity","determineUnitForFormatting","determineMajorUnit","initOffsets","offsetAfterAutoskip","getDecimalForValue","weekday","hasWeekday","getDataTimestamps","tooltipFormat","datetime","_tickFormatFunction","minorFormat","majorFormat","offsets","_getLabelSize","ticksOpts","tickLabelWidth","cosRotation","sinRotation","tickFontSize","exampleTime","exampleLabel","prevSource","nextSource","prevTarget","nextTarget","span","TimeSeriesScale$1","_table","_minPos","_tableRange","_getTimestampsForTable","buildLookupTable","_addedLabels","added","helpers","platforms"],"mappings":";;;;;;sOAUO,SAASA,IAEf,CAKM,MAAMC,EAAM,MACjB,IAAIC,EAAK,EACT,MAAO,IAAMA,GACd,EAHkB,GAUZ,SAASC,EAAcC,GAC5B,OAAOA,OACR,CAOM,SAASC,EAAqBD,GACnC,GAAIE,MAAMD,SAAWC,MAAMD,QAAQD,GACjC,OAAO,EAET,MAAMG,EAAOC,OAAOC,UAAUC,SAASC,KAAKP,GAC5C,MAAyB,YAArBG,EAAKK,MAAM,EAAG,IAAuC,WAAnBL,EAAKK,OAAO,EAInD,CAOM,SAASC,EAAST,GACvB,OAAiB,OAAVA,GAA4D,oBAA1CI,OAAOC,UAAUC,SAASC,KAAKP,EACzD,CAMD,SAASU,EAAeV,GACtB,OAAyB,iBAAVA,GAAsBA,aAAiBW,SAAWC,UAAUZ,EAC5E,CAUM,SAASa,EAAgBb,EAAgBc,GAC9C,OAAOJ,EAAeV,GAASA,EAAQc,CACxC,CAOM,SAASC,EAAkBf,EAAsBc,GACtD,YAAwB,IAAVd,EAAwBc,EAAed,CACtD,CAEM,MAAMgB,EAAe,CAAChB,EAAwBiB,IAClC,iBAAVjB,GAAsBA,EAAMkB,SAAS,KAC1CC,WAAWnB,GAAS,KACjBA,EAAQiB,EAEFG,EAAc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0O,OAAO0hD,GAAOpG,GAAavjC,GAAQvB,GAAUoB,GAAS4+D,IAC7D90B,GAAMA,MAAQA,GAEQ,oBAAXlkD,SACTA,OAAOkkD,MAAQA"}PK!MMlsruby_runner.rbnuȯ#!/opt/alt/ruby40/bin/ruby require 'lsapi' class CodeCache def [](filename) mtime = File.mtime( filename ) entry = @cache[filename]; if entry != nil return entry end code = compile(filename) #entry = CodeEntry.new( filename, mtime, code ) @cache[filename] = code return code end private def initialize @cache = {} end def compile(filename) open(filename) do |f| s = f.read s.untaint binding = eval_string_wrap("binding") return eval(format("Proc.new {\n%s\n}", s), binding, filename, 0) end end end $count = 0; $cache = CodeCache.new while true $req = LSAPI.accept break if $req == nil filename = ENV['SCRIPT_FILENAME'] filename.untaint filename =~ %r{^(\/.*?)\/*([^\/]+)$} path = $1 Dir.chdir( path ) #load( filename, true ) code = $cache[filename] code.call end class CodeEntry public :path, :name, :mtime, :opcode def initizlize( filename, mtime, opcode ) filename =~ %r{^(\/.*?)\/*([^\/]+)$} @path = $1 @name = $2 @mtime = mtime @opcode = opcode end end PK!C-beer.pynuȯ#! /usr/bin/python2.7 # By GvR, demystified after a version by Fredrik Lundh. import sys n = 100 if sys.argv[1:]: n = int(sys.argv[1]) def bottle(n): if n == 0: return "no more bottles of beer" if n == 1: return "one bottle of beer" return str(n) + " bottles of beer" for i in range(n, 0, -1): print bottle(i), "on the wall," print bottle(i) + "." print "Take one down, pass it around," print bottle(i-1), "on the wall." PK!G mboxconvert.pyonu[ Afc@sddlZddlZddlZddlZddlZddlZddlZdZejdZ dZ dZ da ddZ ed krendS( iNc Cst}y#tjtjdd\}}Wn7tjk rb}tjjd|tjdnXx)|D]!\}}|dkrjt}qjqjW|sdg}nd}x|D]}|dks|dkr|tj p|}qt j j |r t |p|}qt j j|ryt|}Wn6tk re}tjjd ||fd}qnX||pu|}|jqtjjd |d}qW|rtj|ndS( Nitfs%s is-ft-its%s: %s s%s: not found (tmmdftgetopttsystargvterrortstderrtwritetexittmessagetstdintostpathtisdirtmhtisfiletopentIOErrortclose( tdofiletoptstargstmsgtotatststargR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pytmains<#      s [1-9][0-9]*cCsd}tj|}x|D]}tj|t|krCqntjj||}yt|}Wn6tk r}t j j d||fd}qnXt |p|}qW|S(Nis%s: %s i( R tlistdirtnumerictmatchtlenRtjoinRRRRR R (tdirRtmsgsRtfnR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyR2s cCsbd}xU|j}|sPn|dkrCt||p=|}q tjjd|fq W|S(Nis sBad line in MMFD mailbox: %r (treadlineR RRR (RRtline((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyRBs   iRc Cszd}tj|}|jd\}}|jd}|rQtj|}n<tjjd|j dft j |j t j}dG|Gtj|GHx|jD] }|GqW|jdstdadt|tf} tjjd| |fd G| GHnHxa|j}||kr0Pn|sPtjjd d}Pn|d d krmd |}n|GqWH|S(NitFromtDatesUnparseable date: %r s message-idis<%s.%d>sAdding Message-ID %s (From %s) s Message-ID:sUnexpected EOF in message isFrom t>(trfc822tMessagetgetaddrtgetdatettimetmktimeRRR t getheaderR tfstattfilenotstattST_MTIMEtctimetheadersthas_keytcounterthexR&( Rt delimiterRtmtfullnametemailtttttR'tmsgid((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyR Qs@       t__main__(R+RR/R R4RtreRtcompileRRRR9R t__name__(((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyts        !   * PK!*R  pp.pycnu[ Afc@s_ddlZddlZdZgZdZdZdZdZdZy#ejej dd\Z Z WnDej k rZ ejjdej de fejdnXxe D]\ZZedkrdZqed krdZqed krdZqed kr4x{ejd D]ZejeqWqed krIeZqedkrddZdZqedkrdZdZqeGdGHqWe se jdnes(e ddkrejZnee ddZx+ejZesPnejed qW[e d=e s(e jdq(ner@dgZgZnferddddddddddddd d!d"d#d$gZd%d"d&d'd(gZnd)gZgZd jed Zx eD]Zed*ed 7ZqWed jed 7ZddlZejZejeej erNddl!Z!e!j"d+ej#fn e$ej#dS(,iNtiis acde:F:nps%s: %s is-as-cs-ds-es s-Fs-ns-psnot recognized???t-trsif 0:s LINECOUNT = 0sfor FILE in ARGS:s if FILE == '-':s FP = sys.stdins else:s FP = open(FILE, 'r')s LINENO = 0s while 1:s LINE = FP.readline()s if not LINE: breaks LINENO = LINENO + 1s! LINECOUNT = LINECOUNT + 1s L = LINE[:-1]s aflag = AFLAGs if aflag:s" if FS: F = L.split(FS)s else: F = L.split()s if not PFLAG: continues# if FS: print FS.join(F)s# else: print ' '.join(F)s else: print Lsif 1:s s execfile(%r)(%tsystgetopttFStSCRIPTtAFLAGtCFLAGtDFLAGtNFLAGtPFLAGtargvtoptlisttARGSterrortmsgtstderrtwritetexittoptiontoptargtsplittlinetappendtstdintfptopentreadlinetprologuetepiloguetjointprogramttempfiletNamedTemporaryFiletflushtpdbtruntnametexecfile(((s'/usr/lib64/python2.7/Demo/scripts/pp.pyts  #!                           PK!Lbeer.pycnu[ Afc@sddlZdZejdr5eejdZndZxPeeddD]<ZeeGdGHeedGHdGHeedGd GHqQWdS( iNidicCs.|dkrdS|dkr dSt|dS(Nisno more bottles of beerisone bottle of beers bottles of beer(tstr(tn((s)/usr/lib64/python2.7/Demo/scripts/beer.pytbottle s   is on the wall,t.sTake one down, pass it around,s on the wall.(tsysRtargvtintRtrangeti(((s)/usr/lib64/python2.7/Demo/scripts/beer.pyts   PK!    lpwatch.pynuȯ#! /usr/bin/python2.7 # Watch line printer queue(s). # Intended for BSD 4.3 lpq. import os import sys import time DEF_PRINTER = 'psc' DEF_DELAY = 10 def main(): delay = DEF_DELAY # XXX Use getopt() later try: thisuser = os.environ['LOGNAME'] except: thisuser = os.environ['USER'] printers = sys.argv[1:] if printers: # Strip '-P' from printer names just in case # the user specified it... for i, name in enumerate(printers): if name[:2] == '-P': printers[i] = name[2:] else: if os.environ.has_key('PRINTER'): printers = [os.environ['PRINTER']] else: printers = [DEF_PRINTER] clearhome = os.popen('clear', 'r').read() while True: text = clearhome for name in printers: text += makestatus(name, thisuser) + '\n' print text time.sleep(delay) def makestatus(name, thisuser): pipe = os.popen('lpq -P' + name + ' 2>&1', 'r') lines = [] users = {} aheadbytes = 0 aheadjobs = 0 userseen = False totalbytes = 0 totaljobs = 0 for line in pipe: fields = line.split() n = len(fields) if len(fields) >= 6 and fields[n-1] == 'bytes': rank, user, job = fields[0:3] files = fields[3:-2] bytes = int(fields[n-2]) if user == thisuser: userseen = True elif not userseen: aheadbytes += bytes aheadjobs += 1 totalbytes += bytes totaljobs += 1 ujobs, ubytes = users.get(user, (0, 0)) ujobs += 1 ubytes += bytes users[user] = ujobs, ubytes else: if fields and fields[0] != 'Rank': line = line.strip() if line == 'no entries': line = name + ': idle' elif line[-22:] == ' is ready and printing': line = name lines.append(line) if totaljobs: line = '%d K' % ((totalbytes+1023) // 1024) if totaljobs != len(users): line += ' (%d jobs)' % totaljobs if len(users) == 1: line += ' for %s' % (users.keys()[0],) else: line += ' for %d users' % len(users) if userseen: if aheadjobs == 0: line += ' (%s first)' % thisuser else: line += ' (%d K before %s)' % ( (aheadbytes+1023) // 1024, thisuser) lines.append(line) sts = pipe.close() if sts: lines.append('lpq exit status %r' % (sts,)) return ': '.join(lines) if __name__ == "__main__": try: main() except KeyboardInterrupt: pass PK!K markov.pynuȯ#! /usr/bin/python2.7 class Markov: def __init__(self, histsize, choice): self.histsize = histsize self.choice = choice self.trans = {} def add(self, state, next): self.trans.setdefault(state, []).append(next) def put(self, seq): n = self.histsize add = self.add add(None, seq[:0]) for i in range(len(seq)): add(seq[max(0, i-n):i], seq[i:i+1]) add(seq[len(seq)-n:], None) def get(self): choice = self.choice trans = self.trans n = self.histsize seq = choice(trans[None]) while True: subseq = seq[max(0, len(seq)-n):] options = trans[subseq] next = choice(options) if not next: break seq += next return seq def test(): import sys, random, getopt args = sys.argv[1:] try: opts, args = getopt.getopt(args, '0123456789cdwq') except getopt.error: print 'Usage: %s [-#] [-cddqw] [file] ...' % sys.argv[0] print 'Options:' print '-#: 1-digit history size (default 2)' print '-c: characters (default)' print '-w: words' print '-d: more debugging output' print '-q: no debugging output' print 'Input files (default stdin) are split in paragraphs' print 'separated blank lines and each paragraph is split' print 'in words by whitespace, then reconcatenated with' print 'exactly one space separating words.' print 'Output consists of paragraphs separated by blank' print 'lines, where lines are no longer than 72 characters.' sys.exit(2) histsize = 2 do_words = False debug = 1 for o, a in opts: if '-0' <= o <= '-9': histsize = int(o[1:]) if o == '-c': do_words = False if o == '-d': debug += 1 if o == '-q': debug = 0 if o == '-w': do_words = True if not args: args = ['-'] m = Markov(histsize, random.choice) try: for filename in args: if filename == '-': f = sys.stdin if f.isatty(): print 'Sorry, need stdin from file' continue else: f = open(filename, 'r') if debug: print 'processing', filename, '...' text = f.read() f.close() paralist = text.split('\n\n') for para in paralist: if debug > 1: print 'feeding ...' words = para.split() if words: if do_words: data = tuple(words) else: data = ' '.join(words) m.put(data) except KeyboardInterrupt: print 'Interrupted -- continue with data read so far' if not m.trans: print 'No valid input files' return if debug: print 'done.' if debug > 1: for key in m.trans.keys(): if key is None or len(key) < histsize: print repr(key), m.trans[key] if histsize == 0: print repr(''), m.trans[''] print while True: data = m.get() if do_words: words = data else: words = data.split() n = 0 limit = 72 for w in words: if n + len(w) > limit: print n = 0 print w, n += len(w) + 1 print print if __name__ == "__main__": test() PK!Lbeer.pyonu[ Afc@sddlZdZejdr5eejdZndZxPeeddD]<ZeeGdGHeedGHdGHeedGd GHqQWdS( iNidicCs.|dkrdS|dkr dSt|dS(Nisno more bottles of beerisone bottle of beers bottles of beer(tstr(tn((s)/usr/lib64/python2.7/Demo/scripts/beer.pytbottle s   is on the wall,t.sTake one down, pass it around,s on the wall.(tsysRtargvtintRtrangeti(((s)/usr/lib64/python2.7/Demo/scripts/beer.pyts   PK!8pp.pynuȯ#! /usr/bin/python2.7 # Emulate some Perl command line options. # Usage: pp [-a] [-c] [-d] [-e scriptline] [-F fieldsep] [-n] [-p] [file] ... # Where the options mean the following: # -a : together with -n or -p, splits each line into list F # -c : check syntax only, do not execute any code # -d : run the script under the debugger, pdb # -e scriptline : gives one line of the Python script; may be repeated # -F fieldsep : sets the field separator for the -a option [not in Perl] # -n : runs the script for each line of input # -p : prints the line after the script has run # When no script lines have been passed, the first file argument # contains the script. With -n or -p, the remaining arguments are # read as input to the script, line by line. If a file is '-' # or missing, standard input is read. # XXX To do: # - add -i extension option (change files in place) # - make a single loop over the files and lines (changes effect of 'break')? # - add an option to specify the record separator # - except for -n/-p, run directly from the file if at all possible import sys import getopt FS = '' SCRIPT = [] AFLAG = 0 CFLAG = 0 DFLAG = 0 NFLAG = 0 PFLAG = 0 try: optlist, ARGS = getopt.getopt(sys.argv[1:], 'acde:F:np') except getopt.error, msg: sys.stderr.write('%s: %s\n' % (sys.argv[0], msg)) sys.exit(2) for option, optarg in optlist: if option == '-a': AFLAG = 1 elif option == '-c': CFLAG = 1 elif option == '-d': DFLAG = 1 elif option == '-e': for line in optarg.split('\n'): SCRIPT.append(line) elif option == '-F': FS = optarg elif option == '-n': NFLAG = 1 PFLAG = 0 elif option == '-p': NFLAG = 1 PFLAG = 1 else: print option, 'not recognized???' if not ARGS: ARGS.append('-') if not SCRIPT: if ARGS[0] == '-': fp = sys.stdin else: fp = open(ARGS[0], 'r') while 1: line = fp.readline() if not line: break SCRIPT.append(line[:-1]) del fp del ARGS[0] if not ARGS: ARGS.append('-') if CFLAG: prologue = ['if 0:'] epilogue = [] elif NFLAG: # Note that it is on purpose that AFLAG and PFLAG are # tested dynamically each time through the loop prologue = [ 'LINECOUNT = 0', 'for FILE in ARGS:', ' \tif FILE == \'-\':', ' \t \tFP = sys.stdin', ' \telse:', ' \t \tFP = open(FILE, \'r\')', ' \tLINENO = 0', ' \twhile 1:', ' \t \tLINE = FP.readline()', ' \t \tif not LINE: break', ' \t \tLINENO = LINENO + 1', ' \t \tLINECOUNT = LINECOUNT + 1', ' \t \tL = LINE[:-1]', ' \t \taflag = AFLAG', ' \t \tif aflag:', ' \t \t \tif FS: F = L.split(FS)', ' \t \t \telse: F = L.split()' ] epilogue = [ ' \t \tif not PFLAG: continue', ' \t \tif aflag:', ' \t \t \tif FS: print FS.join(F)', ' \t \t \telse: print \' \'.join(F)', ' \t \telse: print L', ] else: prologue = ['if 1:'] epilogue = [] # Note that we indent using tabs only, so that any indentation style # used in 'command' will come out right after re-indentation. program = '\n'.join(prologue) + '\n' for line in SCRIPT: program += ' \t \t' + line + '\n' program += '\n'.join(epilogue) + '\n' import tempfile fp = tempfile.NamedTemporaryFile() fp.write(program) fp.flush() if DFLAG: import pdb pdb.run('execfile(%r)' % (fp.name,)) else: execfile(fp.name) PK!MHYZZ primes.pynuȯ#! /usr/bin/python2.7 # Print prime numbers in a given range def primes(min, max): if max >= 2 >= min: print 2 primes = [2] i = 3 while i <= max: for p in primes: if i % p == 0 or p*p > i: break if i % p != 0: primes.append(i) if i >= min: print i i += 2 def main(): import sys min, max = 2, 0x7fffffff if sys.argv[1:]: min = int(sys.argv[1]) if sys.argv[2:]: max = int(sys.argv[2]) primes(min, max) if __name__ == "__main__": main() PK!from.pyonu[ Afc@sddlZddlZyejdZWn4eefk r_ejjdejdnXye eZ Wn"e k rejdenXxe j Z e sPne jdre d GxJe j Z e se dkrPne jdree d d!GqqWHqqWdS( iNtMAILsNo environment variable $MAIL isCannot open mailbox file: sFrom s s Subject: i (tsystostenvirontmailboxtAttributeErrortKeyErrortstderrtwritetexittopentmailtIOErrortreadlinetlinet startswithtrepr(((s)/usr/lib64/python2.7/Demo/scripts/from.pyts,   PK!Ir makedir.pynuȯ#! /usr/bin/python2.7 # Like mkdir, but also make intermediate directories if necessary. # It is not an error if the given directory already exists (as long # as it is a directory). # Errors are not treated specially -- you just get a Python exception. import sys, os def main(): for p in sys.argv[1:]: makedirs(p) def makedirs(p): if p and not os.path.isdir(p): head, tail = os.path.split(p) makedirs(head) os.mkdir(p, 0777) if __name__ == "__main__": main() PK!*R  pp.pyonu[ Afc@s_ddlZddlZdZgZdZdZdZdZdZy#ejej dd\Z Z WnDej k rZ ejjdej de fejdnXxe D]\ZZedkrdZqed krdZqed krdZqed kr4x{ejd D]ZejeqWqed krIeZqedkrddZdZqedkrdZdZqeGdGHqWe se jdnes(e ddkrejZnee ddZx+ejZesPnejed qW[e d=e s(e jdq(ner@dgZgZnferddddddddddddd d!d"d#d$gZd%d"d&d'd(gZnd)gZgZd jed Zx eD]Zed*ed 7ZqWed jed 7ZddlZejZejeej erNddl!Z!e!j"d+ej#fn e$ej#dS(,iNtiis acde:F:nps%s: %s is-as-cs-ds-es s-Fs-ns-psnot recognized???t-trsif 0:s LINECOUNT = 0sfor FILE in ARGS:s if FILE == '-':s FP = sys.stdins else:s FP = open(FILE, 'r')s LINENO = 0s while 1:s LINE = FP.readline()s if not LINE: breaks LINENO = LINENO + 1s! LINECOUNT = LINECOUNT + 1s L = LINE[:-1]s aflag = AFLAGs if aflag:s" if FS: F = L.split(FS)s else: F = L.split()s if not PFLAG: continues# if FS: print FS.join(F)s# else: print ' '.join(F)s else: print Lsif 1:s s execfile(%r)(%tsystgetopttFStSCRIPTtAFLAGtCFLAGtDFLAGtNFLAGtPFLAGtargvtoptlisttARGSterrortmsgtstderrtwritetexittoptiontoptargtsplittlinetappendtstdintfptopentreadlinetprologuetepiloguetjointprogramttempfiletNamedTemporaryFiletflushtpdbtruntnametexecfile(((s'/usr/lib64/python2.7/Demo/scripts/pp.pyts  #!                           PK!hq update.pyonu[ Afc@soddlZddlZddlZdZejeZdddYZdZedkrkendS(iNs^([^: ]+):([1-9][0-9]*):tFileObjcBs#eZdZdZdZRS(cCsk||_d|_yt|dj|_Wn*tk rZ}d|G|GHd|_dSXdG|jGHdS(Nitrs*** Can't open "%s":tdiffing(tfilenametchangedtopent readlinestlinestIOErrortNone(tselfRtmsg((s+/usr/lib64/python2.7/Demo/scripts/update.pyt__init__s    cCs|jsdG|jGHdSy0tj|j|jdt|jd}Wn-tjtfk rx}d|jG|GHdSXdG|jGHx|jD]}|j|qW|j d|_dS(Ns no changes tot~tws*** Can't rewrite "%s":twritingi( RRtostrenameRterrorRRtwritetclose(R tfpR tline((s+/usr/lib64/python2.7/Demo/scripts/update.pytfinishs    cCs|jdkr'd|j||fGdSt|d}d|koWt|jknstd|j||fGdS|j||krd|j||fGdS|jsd|_nd||fGHdG|j|GdGH||j|(RR RtevaltlenR(R tlinenotrestti((s+/usr/lib64/python2.7/Demo/scripts/update.pytprocess,s(%   (t__name__t __module__R RR(((s+/usr/lib64/python2.7/Demo/scripts/update.pyRs cCs1tjdrayttjdd}Wqjtk r]}dtjdG|GHtjdqjXn tj}d}x|j}|s|r|jnPnt j |}|dkrdG|Gqsnt j dd\}}| s||j kr|r|jnt |}n|j|||qsWdS(NiRsCan't open "%s":is Funny line:i(tsystargvRRtexittstdinR treadlineRtprogtmatchtgroupRRR(RR tcurfileRtnRR((s+/usr/lib64/python2.7/Demo/scripts/update.pytmainBs0      t__main__(( RR"tretpattcompileR'RR,R (((s+/usr/lib64/python2.7/Demo/scripts/update.pyt s   2  PK!й markov.pyonu[ Afc@s6dddYZdZedkr2endS(tMarkovcBs,eZdZdZdZdZRS(cCs||_||_i|_dS(N(thistsizetchoicettrans(tselfRR((s+/usr/lib64/python2.7/Demo/scripts/markov.pyt__init__s  cCs |jj|gj|dS(N(Rt setdefaulttappend(Rtstatetnext((s+/usr/lib64/python2.7/Demo/scripts/markov.pytadd scCs|j}|j}|d|d xFtt|D]2}||td|||!|||d!q6W||t||ddS(Nii(RR tNonetrangetlentmax(RtseqtnR ti((s+/usr/lib64/python2.7/Demo/scripts/markov.pytput s   0cCs|j}|j}|j}||d}xQtr~|tdt||}||}||}|sqPn||7}q.W|S(Ni(RRRR tTrueRR (RRRRRtsubseqtoptionsR ((s+/usr/lib64/python2.7/Demo/scripts/markov.pytgets      (t__name__t __module__RR RR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyRs   cCsddl}ddl}ddl}|jd}y|j|d\}}Wnm|jk rd|jdGHdGHdGHdGHd GHd GHd GHd GHd GHdGHdGHdGHdGH|jdnXd}t}d}x|D]\}} d|kodknrt|d}n|dkr&t}n|dkr?|d7}n|dkrTd}n|dkrt}qqW|sdg}nt ||j } yx|D]} | dkr|j } | j rdGHqqnt | d} |rdG| GdGHn| j} | j| jd}xh|D]`}|dkr;dGHn|j}|r!|rbt|}nd j|}| j|q!q!WqWWntk rd!GHnX| jsd"GHdS|rd#GHn|dkrIxN| jjD]=}|dkst||krt|G| j|GHqqW|dkrEtd$G| jd$GHnHnxtr| j}|rm|}n |j}d}d%}xF|D]>}|t||krHd}n|G|t|d7}qWHHqLWdS(&Niit0123456789cdwqs"Usage: %s [-#] [-cddqw] [file] ...isOptions:s$-#: 1-digit history size (default 2)s-c: characters (default)s -w: wordss-d: more debugging outputs-q: no debugging outputs3Input files (default stdin) are split in paragraphss1separated blank lines and each paragraph is splits0in words by whitespace, then reconcatenated withs#exactly one space separating words.s0Output consists of paragraphs separated by blanks4lines, where lines are no longer than 72 characters.is-0s-9s-cs-ds-qs-wt-sSorry, need stdin from filetrt processings...s s feeding ...t s-Interrupted -- continue with data read so farsNo valid input filessdone.tiH(tsystrandomtgetopttargvterrortexittFalsetintRRRtstdintisattytopentreadtclosetsplitttupletjoinRtKeyboardInterruptRtkeysR R treprR(RR R!targstoptsRtdo_wordstdebugtotatmtfilenametfttexttparalisttparatwordstdatatkeyRtlimittw((s+/usr/lib64/python2.7/Demo/scripts/markov.pyttest#s$                           t__main__N((RRCR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyts U PK!) - - lpwatch.pyonu[ Afc@stddlZddlZddlZdZdZdZdZedkrpy eWqpek rlqpXndS(iNtpsci cCst}ytjd}Wntjd}nXtjd}|rxlt|D]-\}}|d dkrN|d||&1RiiitbytesiiitRanks no entriess: idleis is ready and printings%d Kiis (%d jobs)s for %ss for %d userss (%s first)s (%d K before %s)slpq exit status %rs: (ii( RRtFalsetsplittlentintRtgettstriptappendtkeystclosetjoin(RRtpipetlinestuserst aheadbytest aheadjobstuserseent totalbytest totaljobstlinetfieldstntranktusertjobtfilesRtujobstubyteststs((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyR)sd   &               t__main__( RR RR RRRt__name__tKeyboardInterrupt(((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyts     9   PK! Bfind-uname.pyonu[ Afc@sWdZddlZddlZddlZdZedkrSeejdndS(s) For each argument on the command line, look for it in the set of all Unicode names. Arguments are treated as case-insensitive regular expressions, e.g.: % find-uname 'small letter a$' 'horizontal line' *** small letter a$ matches *** LATIN SMALL LETTER A (97) COMBINING LATIN SMALL LETTER A (867) CYRILLIC SMALL LETTER A (1072) PARENTHESIZED LATIN SMALL LETTER A (9372) CIRCLED LATIN SMALL LETTER A (9424) FULLWIDTH LATIN SMALL LETTER A (65345) *** horizontal line matches *** HORIZONTAL LINE EXTENSION (9135) iNc Csg}xUttjdD]@}y&|j|tjt|fWqtk rYqXqWx|D]}tj |tj }g|D]-\}}|j |dk r||f^q}|redG|GdGdGHx|D]}d|GHqWqeqeWdS(Nis***tmatchess%s (%d)( trangetsyst maxunicodetappendt unicodedatatnametunichrt ValueErrortretcompiletItsearchtNone( targst unicode_namestixtargtpattxtyRtmatch((s//usr/lib64/python2.7/Demo/scripts/find-uname.pytmains&  ' t__main__i(t__doc__RRR Rt__name__targv(((s//usr/lib64/python2.7/Demo/scripts/find-uname.pyts      PK!LC C unbirthday.pynuȯ#! /usr/bin/python2.7 # Calculate your unbirthday count (see Alice in Wonderland). # This is defined as the number of days from your birth until today # that weren't your birthday. (The day you were born is not counted). # Leap years make it interesting. import sys import time import calendar def main(): if sys.argv[1:]: year = int(sys.argv[1]) else: year = int(raw_input('In which year were you born? ')) if 0 <= year < 100: print "I'll assume that by", year, year = year + 1900 print 'you mean', year, 'and not the early Christian era' elif not (1850 <= year <= time.localtime()[0]): print "It's hard to believe you were born in", year return if sys.argv[2:]: month = int(sys.argv[2]) else: month = int(raw_input('And in which month? (1-12) ')) if not (1 <= month <= 12): print 'There is no month numbered', month return if sys.argv[3:]: day = int(sys.argv[3]) else: day = int(raw_input('And on what day of that month? (1-31) ')) if month == 2 and calendar.isleap(year): maxday = 29 else: maxday = calendar.mdays[month] if not (1 <= day <= maxday): print 'There are no', day, 'days in that month!' return bdaytuple = (year, month, day) bdaydate = mkdate(bdaytuple) print 'You were born on', format(bdaytuple) todaytuple = time.localtime()[:3] todaydate = mkdate(todaytuple) print 'Today is', format(todaytuple) if bdaytuple > todaytuple: print 'You are a time traveler. Go back to the future!' return if bdaytuple == todaytuple: print 'You were born today. Have a nice life!' return days = todaydate - bdaydate print 'You have lived', days, 'days' age = 0 for y in range(year, todaytuple[0] + 1): if bdaytuple < (y, month, day) <= todaytuple: age = age + 1 print 'You are', age, 'years old' if todaytuple[1:] == bdaytuple[1:]: print 'Congratulations! Today is your', nth(age), 'birthday' print 'Yesterday was your', else: print 'Today is your', print nth(days - age), 'unbirthday' def format((year, month, day)): return '%d %s %d' % (day, calendar.month_name[month], year) def nth(n): if n == 1: return '1st' if n == 2: return '2nd' if n == 3: return '3rd' return '%dth' % n def mkdate((year, month, day)): # January 1st, in 0 A.D. is arbitrarily defined to be day 1, # even though that day never actually existed and the calendar # was different then... days = year*365 # years, roughly days = days + (year+3)//4 # plus leap years, roughly days = days - (year+99)//100 # minus non-leap years every century days = days + (year+399)//400 # plus leap years every 4 centirues for i in range(1, month): if i == 2 and calendar.isleap(year): days = days + 29 else: days = days + calendar.mdays[i] days = days + day return days if __name__ == "__main__": main() PK!VB queens.pycnu[ Afc@sBdZdZdddYZdZedkr>endS(sN queens problem. The (well-known) problem is due to Niklaus Wirth. This solution is inspired by Dijkstra (Structured Programming). It is a classic recursive backtracking approach. itQueenscBsSeZedZdZddZdZdZdZdZ dZ RS(cCs||_|jdS(N(tntreset(tselfR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt__init__s cCsf|j}dg||_dg||_dgd|d|_dgd|d|_d|_dS(Niii(RtNonetytrowtuptdowntnfound(RR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs  icCsx}t|jD]l}|j||r|j|||d|jkrX|jn|j|d|j||qqWdS(Ni(trangeRtsafetplacetdisplaytsolvetremove(RtxR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs cCs0|j| o/|j|| o/|j|| S(N(RRR (RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR &scCs@||j| s 8  PK!zvREADMEnu[This directory contains a collection of executable Python scripts. See also the Tools/scripts directory! beer.py Print the classic 'bottles of beer' list eqfix.py Fix .py files to use the correct equality test operator fact.py Factorize numbers find-uname.py Search for Unicode characters using regexps from.py Summarize mailbox lpwatch.py Watch BSD line printer queues makedir.py Like mkdir -p markov.py Markov chain simulation of words or characters mboxconvert.py Convert MH or MMDF mailboxes to unix mailbox format morse.py Produce morse code (audible or on AIFF file) newslist.py List all newsgroups on a NNTP server as HTML pages pi.py Print all digits of pi -- given enough time and memory pp.py Emulate some Perl command line options primes.py Print prime numbers queens.py Dijkstra's solution to Wirth's "N Queens problem" script.py Equivalent to BSD script(1) -- by Steen Lumholt unbirthday.py Print unbirthday count update.py Update a bunch of files according to a script. PK!cA-D script.pycnu[ Afc@sddlZddlZddlZddlZddlZdZdZdZdZej j dryej dZny#ejej dd\Z Z Wn9ejk rZd ej d efGHejd nXx>e D]6\ZZed krd ZqedkrdZqqWeeeZejjdeejdejejejeeejdejejejjdedS(iNcCs#tj|d}tj||S(Ni(tostreadtscripttwrite(tfdtdata((s+/usr/lib64/python2.7/Demo/scripts/script.pyR s tsht typescripttwtSHELLitaps%s: %siis-atas-ptpythonsScript started, file is %s sScript started on %s sScript done on %s sScript done, file is %s (RttimetsystgetopttptyRtshelltfilenametmodetenvironthas_keytargvtoptstargsterrortmsgtexittoR topenRtstdoutRtctimetspawn(((s+/usr/lib64/python2.7/Demo/scripts/script.pyt s.0  #      PK!from.pycnu[ Afc@sddlZddlZyejdZWn4eefk r_ejjdejdnXye eZ Wn"e k rejdenXxe j Z e sPne jdre d GxJe j Z e se dkrPne jdree d d!GqqWHqqWdS( iNtMAILsNo environment variable $MAIL isCannot open mailbox file: sFrom s s Subject: i (tsystostenvirontmailboxtAttributeErrortKeyErrortstderrtwritetexittopentmailtIOErrortreadlinetlinet startswithtrepr(((s)/usr/lib64/python2.7/Demo/scripts/from.pyts,   PK!Xi queens.pynuȯ#! /usr/bin/python2.7 """N queens problem. The (well-known) problem is due to Niklaus Wirth. This solution is inspired by Dijkstra (Structured Programming). It is a classic recursive backtracking approach. """ N = 8 # Default; command line overrides class Queens: def __init__(self, n=N): self.n = n self.reset() def reset(self): n = self.n self.y = [None] * n # Where is the queen in column x self.row = [0] * n # Is row[y] safe? self.up = [0] * (2*n-1) # Is upward diagonal[x-y] safe? self.down = [0] * (2*n-1) # Is downward diagonal[x+y] safe? self.nfound = 0 # Instrumentation def solve(self, x=0): # Recursive solver for y in range(self.n): if self.safe(x, y): self.place(x, y) if x+1 == self.n: self.display() else: self.solve(x+1) self.remove(x, y) def safe(self, x, y): return not self.row[y] and not self.up[x-y] and not self.down[x+y] def place(self, x, y): self.y[x] = y self.row[y] = 1 self.up[x-y] = 1 self.down[x+y] = 1 def remove(self, x, y): self.y[x] = None self.row[y] = 0 self.up[x-y] = 0 self.down[x+y] = 0 silent = 0 # If true, count solutions only def display(self): self.nfound = self.nfound + 1 if self.silent: return print '+-' + '--'*self.n + '+' for y in range(self.n-1, -1, -1): print '|', for x in range(self.n): if self.y[x] == y: print "Q", else: print ".", print '|' print '+-' + '--'*self.n + '+' def main(): import sys silent = 0 n = N if sys.argv[1:2] == ['-n']: silent = 1 del sys.argv[1] if sys.argv[1:]: n = int(sys.argv[1]) q = Queens(n) q.silent = silent q.solve() print "Found", q.nfound, "solutions." if __name__ == "__main__": main() PK!hq update.pycnu[ Afc@soddlZddlZddlZdZejeZdddYZdZedkrkendS(iNs^([^: ]+):([1-9][0-9]*):tFileObjcBs#eZdZdZdZRS(cCsk||_d|_yt|dj|_Wn*tk rZ}d|G|GHd|_dSXdG|jGHdS(Nitrs*** Can't open "%s":tdiffing(tfilenametchangedtopent readlinestlinestIOErrortNone(tselfRtmsg((s+/usr/lib64/python2.7/Demo/scripts/update.pyt__init__s    cCs|jsdG|jGHdSy0tj|j|jdt|jd}Wn-tjtfk rx}d|jG|GHdSXdG|jGHx|jD]}|j|qW|j d|_dS(Ns no changes tot~tws*** Can't rewrite "%s":twritingi( RRtostrenameRterrorRRtwritetclose(R tfpR tline((s+/usr/lib64/python2.7/Demo/scripts/update.pytfinishs    cCs|jdkr'd|j||fGdSt|d}d|koWt|jknstd|j||fGdS|j||krd|j||fGdS|jsd|_nd||fGHdG|j|GdGH||j|(RR RtevaltlenR(R tlinenotrestti((s+/usr/lib64/python2.7/Demo/scripts/update.pytprocess,s(%   (t__name__t __module__R RR(((s+/usr/lib64/python2.7/Demo/scripts/update.pyRs cCs1tjdrayttjdd}Wqjtk r]}dtjdG|GHtjdqjXn tj}d}x|j}|s|r|jnPnt j |}|dkrdG|Gqsnt j dd\}}| s||j kr|r|jnt |}n|j|||qsWdS(NiRsCan't open "%s":is Funny line:i(tsystargvRRtexittstdinR treadlineRtprogtmatchtgroupRRR(RR tcurfileRtnRR((s+/usr/lib64/python2.7/Demo/scripts/update.pytmainBs0      t__main__(( RR"tretpattcompileR'RR,R (((s+/usr/lib64/python2.7/Demo/scripts/update.pyt s   2  PK!ټgllfact.pynuȯ#! /usr/bin/python2.7 # Factorize numbers. # The algorithm is not efficient, but easy to understand. # If there are large factors, it will take forever to find them, # because we try all odd numbers between 3 and sqrt(n)... import sys from math import sqrt def fact(n): if n < 1: raise ValueError('fact() argument should be >= 1') if n == 1: return [] # special case res = [] # Treat even factors special, so we can use i += 2 later while n % 2 == 0: res.append(2) n //= 2 # Try odd numbers up to sqrt(n) limit = sqrt(n+1) i = 3 while i <= limit: if n % i == 0: res.append(i) n //= i limit = sqrt(n+1) else: i += 2 if n != 1: res.append(n) return res def main(): if len(sys.argv) > 1: source = sys.argv[1:] else: source = iter(raw_input, '') for arg in source: try: n = int(arg) except ValueError: print arg, 'is not an integer' else: print n, fact(n) if __name__ == "__main__": main() PK!eqfix.pynuȯ#! /usr/bin/python2.7 # Fix Python source files to use the new equality test operator, i.e., # if x = y: ... # is changed to # if x == y: ... # The script correctly tokenizes the Python program to reliably # distinguish between assignments and equality tests. # # Command line arguments are files or directories to be processed. # Directories are searched recursively for files whose name looks # like a python module. # Symbolic links are always ignored (except as explicit directory # arguments). Of course, the original file is kept as a back-up # (with a "~" attached to its name). # It complains about binaries (files containing null bytes) # and about files that are ostensibly not Python files: if the first # line starts with '#!' and does not contain the string 'python'. # # Changes made are reported to stdout in a diff-like format. # # Undoubtedly you can do this using find and sed or perl, but this is # a nice example of Python code that recurses down a directory tree # and uses regular expressions. Also note several subtleties like # preserving the file's mode and avoiding to even write a temp file # when no changes are needed for a file. # # NB: by changing only the function fixline() you can turn this # into a program for a different change to Python programs... import sys import re import os from stat import * import string err = sys.stderr.write dbg = err rep = sys.stdout.write def main(): bad = 0 if not sys.argv[1:]: # No arguments err('usage: ' + sys.argv[0] + ' file-or-directory ...\n') sys.exit(2) for arg in sys.argv[1:]: if os.path.isdir(arg): if recursedown(arg): bad = 1 elif os.path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad) ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$') def ispython(name): return ispythonprog.match(name) >= 0 def recursedown(dirname): dbg('recursedown(%r)\n' % (dirname,)) bad = 0 try: names = os.listdir(dirname) except os.error, msg: err('%s: cannot list directory: %r\n' % (dirname, msg)) return 1 names.sort() subdirs = [] for name in names: if name in (os.curdir, os.pardir): continue fullname = os.path.join(dirname, name) if os.path.islink(fullname): pass elif os.path.isdir(fullname): subdirs.append(fullname) elif ispython(name): if fix(fullname): bad = 1 for fullname in subdirs: if recursedown(fullname): bad = 1 return bad def fix(filename): ## dbg('fix(%r)\n' % (dirname,)) try: f = open(filename, 'r') except IOError, msg: err('%s: cannot open: %r\n' % (filename, msg)) return 1 head, tail = os.path.split(filename) tempname = os.path.join(head, '@' + tail) g = None # If we find a match, we rewind the file and start over but # now copy everything to a temp file. lineno = 0 while 1: line = f.readline() if not line: break lineno = lineno + 1 if g is None and '\0' in line: # Check for binary files err(filename + ': contains null bytes; not fixed\n') f.close() return 1 if lineno == 1 and g is None and line[:2] == '#!': # Check for non-Python scripts words = string.split(line[2:]) if words and re.search('[pP]ython', words[0]) < 0: msg = filename + ': ' + words[0] msg = msg + ' script; not fixed\n' err(msg) f.close() return 1 while line[-2:] == '\\\n': nextline = f.readline() if not nextline: break line = line + nextline lineno = lineno + 1 newline = fixline(line) if newline != line: if g is None: try: g = open(tempname, 'w') except IOError, msg: f.close() err('%s: cannot create: %r\n' % (tempname, msg)) return 1 f.seek(0) lineno = 0 rep(filename + ':\n') continue # restart from the beginning rep(repr(lineno) + '\n') rep('< ' + line) rep('> ' + newline) if g is not None: g.write(newline) # End of file f.close() if not g: return 0 # No changes # Finishing touch -- move files # First copy the file's mode to the temp file try: statbuf = os.stat(filename) os.chmod(tempname, statbuf[ST_MODE] & 07777) except os.error, msg: err('%s: warning: chmod failed (%r)\n' % (tempname, msg)) # Then make a backup of the original file as filename~ try: os.rename(filename, filename + '~') except os.error, msg: err('%s: warning: backup failed (%r)\n' % (filename, msg)) # Now move the temp file to the original file try: os.rename(tempname, filename) except os.error, msg: err('%s: rename failed (%r)\n' % (filename, msg)) return 1 # Return succes return 0 from tokenize import tokenprog match = {'if':':', 'elif':':', 'while':':', 'return':'\n', \ '(':')', '[':']', '{':'}', '`':'`'} def fixline(line): # Quick check for easy case if '=' not in line: return line i, n = 0, len(line) stack = [] while i < n: j = tokenprog.match(line, i) if j < 0: # A bad token; forget about the rest of this line print '(Syntax error:)' print line, return line a, b = tokenprog.regs[3] # Location of the token proper token = line[a:b] i = i+j if stack and token == stack[-1]: del stack[-1] elif match.has_key(token): stack.append(match[token]) elif token == '=' and stack: line = line[:a] + '==' + line[b:] i, n = a + len('=='), len(line) elif token == '==' and not stack: print '(Warning: \'==\' at top level:)' print line, return line if __name__ == "__main__": main() PK! Bfind-uname.pycnu[ Afc@sWdZddlZddlZddlZdZedkrSeejdndS(s) For each argument on the command line, look for it in the set of all Unicode names. Arguments are treated as case-insensitive regular expressions, e.g.: % find-uname 'small letter a$' 'horizontal line' *** small letter a$ matches *** LATIN SMALL LETTER A (97) COMBINING LATIN SMALL LETTER A (867) CYRILLIC SMALL LETTER A (1072) PARENTHESIZED LATIN SMALL LETTER A (9372) CIRCLED LATIN SMALL LETTER A (9424) FULLWIDTH LATIN SMALL LETTER A (65345) *** horizontal line matches *** HORIZONTAL LINE EXTENSION (9135) iNc Csg}xUttjdD]@}y&|j|tjt|fWqtk rYqXqWx|D]}tj |tj }g|D]-\}}|j |dk r||f^q}|redG|GdGdGHx|D]}d|GHqWqeqeWdS(Nis***tmatchess%s (%d)( trangetsyst maxunicodetappendt unicodedatatnametunichrt ValueErrortretcompiletItsearchtNone( targst unicode_namestixtargtpattxtyRtmatch((s//usr/lib64/python2.7/Demo/scripts/find-uname.pytmains&  ' t__main__i(t__doc__RRR Rt__name__targv(((s//usr/lib64/python2.7/Demo/scripts/find-uname.pyts      PK!1:t t mboxconvert.pynuȯ#! /usr/bin/python2.7 # Convert MH directories (1 message per file) or MMDF mailboxes (4x^A # delimited) to unix mailbox (From ... delimited) on stdout. # If -f is given, files contain one message per file (e.g. MH messages) import rfc822 import sys import time import os import stat import getopt import re def main(): dofile = mmdf try: opts, args = getopt.getopt(sys.argv[1:], 'f') except getopt.error, msg: sys.stderr.write('%s\n' % msg) sys.exit(2) for o, a in opts: if o == '-f': dofile = message if not args: args = ['-'] sts = 0 for arg in args: if arg == '-' or arg == '': sts = dofile(sys.stdin) or sts elif os.path.isdir(arg): sts = mh(arg) or sts elif os.path.isfile(arg): try: f = open(arg) except IOError, msg: sys.stderr.write('%s: %s\n' % (arg, msg)) sts = 1 continue sts = dofile(f) or sts f.close() else: sys.stderr.write('%s: not found\n' % arg) sts = 1 if sts: sys.exit(sts) numeric = re.compile('[1-9][0-9]*') def mh(dir): sts = 0 msgs = os.listdir(dir) for msg in msgs: if numeric.match(msg) != len(msg): continue fn = os.path.join(dir, msg) try: f = open(fn) except IOError, msg: sys.stderr.write('%s: %s\n' % (fn, msg)) sts = 1 continue sts = message(f) or sts return sts def mmdf(f): sts = 0 while 1: line = f.readline() if not line: break if line == '\1\1\1\1\n': sts = message(f, line) or sts else: sys.stderr.write( 'Bad line in MMFD mailbox: %r\n' % (line,)) return sts counter = 0 # for generating unique Message-ID headers def message(f, delimiter = ''): sts = 0 # Parse RFC822 header m = rfc822.Message(f) # Write unix header line fullname, email = m.getaddr('From') tt = m.getdate('Date') if tt: t = time.mktime(tt) else: sys.stderr.write( 'Unparseable date: %r\n' % (m.getheader('Date'),)) t = os.fstat(f.fileno())[stat.ST_MTIME] print 'From', email, time.ctime(t) # Copy RFC822 header for line in m.headers: print line, # Invent Message-ID header if none is present if not m.has_key('message-id'): global counter counter = counter + 1 msgid = "<%s.%d>" % (hex(t), counter) sys.stderr.write("Adding Message-ID %s (From %s)\n" % (msgid, email)) print "Message-ID:", msgid print # Copy body while 1: line = f.readline() if line == delimiter: break if not line: sys.stderr.write('Unexpected EOF in message\n') sts = 1 break if line[:5] == 'From ': line = '>' + line print line, # Print trailing newline print return sts if __name__ == "__main__": main() PK!Gx# makedir.pycnu[ Afc@sDddlZddlZdZdZedkr@endS(iNcCs&xtjdD]}t|qWdS(Ni(tsystargvtmakedirs(tp((s,/usr/lib64/python2.7/Demo/scripts/makedir.pytmain scCsR|rNtjj| rNtjj|\}}t|tj|dndS(Ni(tostpathtisdirtsplitRtmkdir(Rtheadttail((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyRs t__main__(RRRRt__name__(((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyts   PK!Gx# makedir.pyonu[ Afc@sDddlZddlZdZdZedkr@endS(iNcCs&xtjdD]}t|qWdS(Ni(tsystargvtmakedirs(tp((s,/usr/lib64/python2.7/Demo/scripts/makedir.pytmain scCsR|rNtjj| rNtjj|\}}t|tj|dndS(Ni(tostpathtisdirtsplitRtmkdir(Rtheadttail((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyRs t__main__(RRRRt__name__(((s,/usr/lib64/python2.7/Demo/scripts/makedir.pyts   PK!@Iwwpi.pynuȯ#! /usr/bin/python2.7 # Print digits of pi forever. # # The algorithm, using Python's 'long' integers ("bignums"), works # with continued fractions, and was conceived by Lambert Meertens. # # See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton, # published by Prentice-Hall (UK) Ltd., 1990. import sys def main(): k, a, b, a1, b1 = 2, 4, 1, 12, 4 while True: # Next approximation p, q, k = k*k, 2*k+1, k+1 a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 # Print common digits d, d1 = a//b, a1//b1 while d == d1: output(d) a, a1 = 10*(a%b), 10*(a1%b1) d, d1 = a//b, a1//b1 def output(d): # Use write() to avoid spaces between the digits sys.stdout.write(str(d)) # Flush so the output is seen immediately sys.stdout.flush() if __name__ == "__main__": main() PK!0yܺ unbirthday.pyonu[ Afc@sbddlZddlZddlZdZdZdZdZedkr^endS(iNc Cstjdr#ttjd}nttd}d|koLdknrsdG|G|d}dG|GdGHn3d |kotjdknsd G|GHdStjd rttjd }nttd }d|kod knsdG|GHdStjdr'ttjd}nttd}|d kr]tj|r]d}n tj|}d|ko|knsdG|GdGHdS|||f}t |}dGt |GHtjd }t |}dGt |GH||krdGHdS||krdGHdS||}dG|GdGHd} xQt ||ddD]8} || ||fkoq|knrK| d} qKqKWdG| GdGH|d|dkrdGt | GdGHdGndGt || Gd GHdS(!NisIn which year were you born? iidsI'll assume that byilsyou meansand not the early Christian erai:s%It's hard to believe you were born inisAnd in which month? (1-12) i sThere is no month numberedis&And on what day of that month? (1-31) is There are nosdays in that month!sYou were born onsToday iss0You are a time traveler. Go back to the future!s'You were born today. Have a nice life!sYou have livedtdayssYou ares years oldsCongratulations! Today is yourtbirthdaysYesterday was yours Today is yourt unbirthday( tsystargvtintt raw_inputttimet localtimetcalendartisleaptmdaystmkdatetformattrangetnth( tyeartmonthtdaytmaxdayt bdaytupletbdaydatet todaytuplet todaydateRtagety((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pytmain sb  &             % cCs'|\}}}d|tj||fS(Ns%d %s %d(R t month_name(t.0RRR((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyR Ns cCs8|dkrdS|dkr dS|dkr0dSd|S(Nit1stit2ndit3rds%dth((tn((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyRQs   cCs|\}}}|d}||dd}||dd}||dd}xPtd|D]?}|d krtj|r|d }q_|tj|}q_W||}|S( Nimiiicidiiiii(RR R R (RRRRRti((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyR Ws    t__main__(RRR RR RR t__name__(((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyts    B    PK!`(fact.pycnu[ Afc@sHddlZddlmZdZdZedkrDendS(iN(tsqrtcCs|dkrtdn|dkr+gSg}x+|ddkr^|jd|d}q4Wt|d}d}xT||kr||dkr|j|||}t|d}qx|d7}qxW|dkr|j|n|S(Nisfact() argument should be >= 1iii(t ValueErrortappendR(tntrestlimitti((s)/usr/lib64/python2.7/Demo/scripts/fact.pytfact s&      cCsttjdkr%tjd}nttd}xJ|D]B}yt|}Wntk rm|GdGHq;X|Gt|GHq;WdS(Nitsis not an integer(tlentsystargvtitert raw_inputtintRR(tsourcetargR((s)/usr/lib64/python2.7/Demo/scripts/fact.pytmain#s   t__main__(R tmathRRRt__name__(((s)/usr/lib64/python2.7/Demo/scripts/fact.pyts   PK!R~pi.pycnu[ Afc@s8ddlZdZdZedkr4endS(iNc Csd\}}}}}xtr||d|d|d}}}||||||||||f\}}}}||||}}xL||krt|d||d||}}||||}}qWqWdS(Niiii i (iiii i(tTruetoutput( tktatbta1tb1tptqtdtd1((s'/usr/lib64/python2.7/Demo/scripts/pi.pytmain s $6 cCs'tjjt|tjjdS(N(tsyststdouttwritetstrtflush(R ((s'/usr/lib64/python2.7/Demo/scripts/pi.pyRst__main__(R R Rt__name__(((s'/usr/lib64/python2.7/Demo/scripts/pi.pyt s   PK!0yܺ unbirthday.pycnu[ Afc@sbddlZddlZddlZdZdZdZdZedkr^endS(iNc Cstjdr#ttjd}nttd}d|koLdknrsdG|G|d}dG|GdGHn3d |kotjdknsd G|GHdStjd rttjd }nttd }d|kod knsdG|GHdStjdr'ttjd}nttd}|d kr]tj|r]d}n tj|}d|ko|knsdG|GdGHdS|||f}t |}dGt |GHtjd }t |}dGt |GH||krdGHdS||krdGHdS||}dG|GdGHd} xQt ||ddD]8} || ||fkoq|knrK| d} qKqKWdG| GdGH|d|dkrdGt | GdGHdGndGt || Gd GHdS(!NisIn which year were you born? iidsI'll assume that byilsyou meansand not the early Christian erai:s%It's hard to believe you were born inisAnd in which month? (1-12) i sThere is no month numberedis&And on what day of that month? (1-31) is There are nosdays in that month!sYou were born onsToday iss0You are a time traveler. Go back to the future!s'You were born today. Have a nice life!sYou have livedtdayssYou ares years oldsCongratulations! Today is yourtbirthdaysYesterday was yours Today is yourt unbirthday( tsystargvtintt raw_inputttimet localtimetcalendartisleaptmdaystmkdatetformattrangetnth( tyeartmonthtdaytmaxdayt bdaytupletbdaydatet todaytuplet todaydateRtagety((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pytmain sb  &             % cCs'|\}}}d|tj||fS(Ns%d %s %d(R t month_name(t.0RRR((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyR Ns cCs8|dkrdS|dkr dS|dkr0dSd|S(Nit1stit2ndit3rds%dth((tn((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyRQs   cCs|\}}}|d}||dd}||dd}||dd}xPtd|D]?}|d krtj|r|d }q_|tj|}q_W||}|S( Nimiiicidiiiii(RR R R (RRRRRti((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyR Ws    t__main__(RRR RR RR t__name__(((s//usr/lib64/python2.7/Demo/scripts/unbirthday.pyts    B    PK!aPOO morse.pyonu[ Afc@sddlZddlZddlZdZdeZdZiJdd6dd6dd 6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d d"6d#d$6d#d%6d&d'6d&d(6d)d*6d)d+6d,d-6d,d.6d/d06d/d16d2d36d2d46d5d66d5d76d8d96d8d:6d;d<6d;d=6d>d?6d>d@6dAdB6dAdC6dDdE6dDdF6dGdH6dGdI6dJdK6dJdL6dMdN6dMdO6dPdQ6dPdR6dSdT6dUdV6dWdX6dYd6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dld>6dmdn6dodp6dqdr6dsdt6dudv6dsdw6dxdx6dydz6Zd{d|Zd}ZeeZ d~Z dZ dZ dZ dZedkre ndS(iNiiis.-tAtas-...tBtbs-.-.tCtcs-..tDtdt.tEtes..-.tFtfs--.tGtgs....tHths..tItis.---tJtjs-.-tKtks.-..tLtls--tMtms-.tNtns---tOtos.--.tPtps--.-tQtqs.-.tRtrs...tStst-tTtts..-tUtus...-tVtvs.--tWtws-..-tXtxs-.--tYtys--..tZtzs-----t0s--..--t,s.----t1s.-.-.-s..---t2s..--..t?s...--t3s-.-.-.t;s....-t4s---...t:s.....t5s.----.t's-....t6s-....-s--...t7s-..-.t/s---..t8s-.--.-t(s----.t9t)t s..--.-t_sicCsod}xbtdD]T}ttjtj||dd}|t|d?d@t|d@7}qW|S(NtidgI@i0uii(trangetinttmathtsintpitchr(toctavetsinewaveRtval((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmkwave<s (*c Csddl}y#|jtjdd\}}Wn@|jk rqtjjdtjddtjdnXd}t}x|D]\}}|dkrddl }|j |d}|j d |j d |j dn|d krtt|}qqW|sjddl}|j}|jd |j d |j d|j|_|j|_n|rd j|g} nttjjd } xF| D]>} t| } t| ||t|dr|jqqW|jdS(Niiso:p:sUsage is, [ -o outfile ] [ -p octave ] [ words ] ... s-oR/iDis-pRHRJtwait(tgetopttsystargvterrortstderrtwritetexittNonet defaultwavetaifctopent setframeratet setsampwidtht setnchannelsRTRLtaudiodevtAudioDevt setoutratetstoptcloset writeframestwriteframesrawtjointitertstdintreadlinetmorsetplaythasattrRU( RVtoptstargstdevtwaveRRR_Rdtsourcetlinetmline((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmainEsF #             cCsEd}x8|D]0}y|t|d7}Wq tk r<q Xq W|S(NRJs(tmorsetabtKeyError(RwtresR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRoms  cCsqxj|D]b}|dkr,t|t|n0|dkrKt|t|nt|ttt|tqWdS(NRR'(tsinetDOTtDAHtpause(RwRtRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRpws   cCs(x!t|D]}|j|q WdS(N(RKRj(RttlengthRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyR}scCs(x!t|D]}|jtq WdS(N(RKRjtnowave(RtRR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRst__main__(RWRMRdR~RtOCTAVERzRRTR^RyRoRpR}Rt__name__(((s*/usr/lib64/python2.7/Demo/scripts/morse.pytsf$     (   PK!G mboxconvert.pycnu[ Afc@sddlZddlZddlZddlZddlZddlZddlZdZejdZ dZ dZ da ddZ ed krendS( iNc Cst}y#tjtjdd\}}Wn7tjk rb}tjjd|tjdnXx)|D]!\}}|dkrjt}qjqjW|sdg}nd}x|D]}|dks|dkr|tj p|}qt j j |r t |p|}qt j j|ryt|}Wn6tk re}tjjd ||fd}qnX||pu|}|jqtjjd |d}qW|rtj|ndS( Nitfs%s is-ft-its%s: %s s%s: not found (tmmdftgetopttsystargvterrortstderrtwritetexittmessagetstdintostpathtisdirtmhtisfiletopentIOErrortclose( tdofiletoptstargstmsgtotatststargR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pytmains<#      s [1-9][0-9]*cCsd}tj|}x|D]}tj|t|krCqntjj||}yt|}Wn6tk r}t j j d||fd}qnXt |p|}qW|S(Nis%s: %s i( R tlistdirtnumerictmatchtlenRtjoinRRRRR R (tdirRtmsgsRtfnR((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyR2s cCsbd}xU|j}|sPn|dkrCt||p=|}q tjjd|fq W|S(Nis sBad line in MMFD mailbox: %r (treadlineR RRR (RRtline((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyRBs   iRc Cszd}tj|}|jd\}}|jd}|rQtj|}n<tjjd|j dft j |j t j}dG|Gtj|GHx|jD] }|GqW|jdstdadt|tf} tjjd| |fd G| GHnHxa|j}||kr0Pn|sPtjjd d}Pn|d d krmd |}n|GqWH|S(NitFromtDatesUnparseable date: %r s message-idis<%s.%d>sAdding Message-ID %s (From %s) s Message-ID:sUnexpected EOF in message isFrom t>(trfc822tMessagetgetaddrtgetdatettimetmktimeRRR t getheaderR tfstattfilenotstattST_MTIMEtctimetheadersthas_keytcounterthexR&( Rt delimiterRtmtfullnametemailtttttR'tmsgid((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyR Qs@       t__main__(R+RR/R R4RtreRtcompileRRRR9R t__name__(((s0/usr/lib64/python2.7/Demo/scripts/mboxconvert.pyts        !   * PK!]"> find-uname.pynuȯ#! /usr/bin/python2.7 """ For each argument on the command line, look for it in the set of all Unicode names. Arguments are treated as case-insensitive regular expressions, e.g.: % find-uname 'small letter a$' 'horizontal line' *** small letter a$ matches *** LATIN SMALL LETTER A (97) COMBINING LATIN SMALL LETTER A (867) CYRILLIC SMALL LETTER A (1072) PARENTHESIZED LATIN SMALL LETTER A (9372) CIRCLED LATIN SMALL LETTER A (9424) FULLWIDTH LATIN SMALL LETTER A (65345) *** horizontal line matches *** HORIZONTAL LINE EXTENSION (9135) """ import unicodedata import sys import re def main(args): unicode_names = [] for ix in range(sys.maxunicode+1): try: unicode_names.append((ix, unicodedata.name(unichr(ix)))) except ValueError: # no name for the character pass for arg in args: pat = re.compile(arg, re.I) matches = [(y,x) for (x,y) in unicode_names if pat.search(y) is not None] if matches: print "***", arg, "matches", "***" for match in matches: print "%s (%d)" % match if __name__ == "__main__": main(sys.argv[1:]) PK!u=iifrom.pynuȯ#! /usr/bin/python2.7 # Print From and Subject of messages in $MAIL. # Extension to multiple mailboxes and other bells & whistles are left # as exercises for the reader. import sys, os # Open mailbox file. Exits with exception when this fails. try: mailbox = os.environ['MAIL'] except (AttributeError, KeyError): sys.stderr.write('No environment variable $MAIL\n') sys.exit(2) try: mail = open(mailbox) except IOError: sys.exit('Cannot open mailbox file: ' + mailbox) while 1: line = mail.readline() if not line: break # EOF if line.startswith('From '): # Start of message found print line[:-1], while 1: line = mail.readline() if not line or line == '\n': break if line.startswith('Subject: '): print repr(line[9:-1]), print PK!`(fact.pyonu[ Afc@sHddlZddlmZdZdZedkrDendS(iN(tsqrtcCs|dkrtdn|dkr+gSg}x+|ddkr^|jd|d}q4Wt|d}d}xT||kr||dkr|j|||}t|d}qx|d7}qxW|dkr|j|n|S(Nisfact() argument should be >= 1iii(t ValueErrortappendR(tntrestlimitti((s)/usr/lib64/python2.7/Demo/scripts/fact.pytfact s&      cCsttjdkr%tjd}nttd}xJ|D]B}yt|}Wntk rm|GdGHq;X|Gt|GHq;WdS(Nitsis not an integer(tlentsystargvtitert raw_inputtintRR(tsourcetargR((s)/usr/lib64/python2.7/Demo/scripts/fact.pytmain#s   t__main__(R tmathRRRt__name__(((s)/usr/lib64/python2.7/Demo/scripts/fact.pyts   PK!qD eqfix.pyonu[ Afc@sddlZddlZddlZddlTddlZejjZeZej jZ dZ ej dZ dZdZdZddlmZid d 6d d 6d d 6d d6dd6dd6dd6dd6ZdZedkre ndS(iN(t*cCsd}tjds<tdtjddtjdnx}tjdD]n}tjj|rzt|rd}qqJtjj|rt|dd}qJt |rJd}qJqJWtj|dS(Niisusage: s file-or-directory ... is": will not process symbolic links ( tsystargvterrtexittostpathtisdirt recursedowntislinktfix(tbadtarg((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytmain)s    s^[a-zA-Z0-9_]+\.py$cCstj|dkS(Ni(t ispythonprogtmatch(tname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytispython9scCs1td|fd}ytj|}Wn+tjk rW}td||fdSX|jg}x|D]}|tjtjfkrqontjj ||}tjj |rqotjj |r|j |qot |rot|rd}qqoqoWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR RtappendRR R(tdirnameR tnamestmsgtsubdirsRtfullname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR<s0      c Csyt|d}Wn(tk r=}td||fdSXtjj|\}}tjj|d|}d}d}x|j}|sPn|d}|dkrd|krt|d|j dS|dkrf|dkrf|d d krft j|d} | rft j d | ddkrf|d | d}|d }t||j dSnx>|d dkr|j} | sPn|| }|d}qiWt |} | |krm|dkr:yt|d}Wn2tk r}|j td||fdSX|jdd}t|dq~ntt|dtd|td| n|dk r~|j| q~q~W|j |sdSy+tj|} tj|| td@Wn*tjk r}td||fnXytj||dWn*tjk r=}td||fnXytj||Wn+tjk r}td||fdSXdS(Ntrs%s: cannot open: %r it@iss!: contains null bytes; not fixed is#!s [pP]ythons: s script; not fixed is\ tws%s: cannot create: %r s: s s< s> is%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) (topentIOErrorRRRtsplitRtNonetreadlinetclosetstringtretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename( tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR Rs   ("            (t tokenprogt:tifteliftwhiles treturnt)t(t]t[t}t{t`cCs?d|kr|Sdt|}}g}x||kr:tj||}|dkrcdGH|G|Stjd\}}|||!}||}|r||dkr|d=q,tj|r|jt|q,|dkr|r|| d||}|tdt|}}q,|dkr,| r,dGH|Gq,q,W|S(Nt=is(Syntax error:)iis==s(Warning: '==' at top level:)(tlenRARtregsthas_keyR(R<titntstacktjtatbttoken((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR,s0       t__main__(RR*RR1R)tstderrR0RRtstdoutR.R tcompileRRRR ttokenizeRARR,t__name__(((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyts$           R  PK!qD eqfix.pycnu[ Afc@sddlZddlZddlZddlTddlZejjZeZej jZ dZ ej dZ dZdZdZddlmZid d 6d d 6d d 6d d6dd6dd6dd6dd6ZdZedkre ndS(iN(t*cCsd}tjds<tdtjddtjdnx}tjdD]n}tjj|rzt|rd}qqJtjj|rt|dd}qJt |rJd}qJqJWtj|dS(Niisusage: s file-or-directory ... is": will not process symbolic links ( tsystargvterrtexittostpathtisdirt recursedowntislinktfix(tbadtarg((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytmain)s    s^[a-zA-Z0-9_]+\.py$cCstj|dkS(Ni(t ispythonprogtmatch(tname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pytispython9scCs1td|fd}ytj|}Wn+tjk rW}td||fdSX|jg}x|D]}|tjtjfkrqontjj ||}tjj |rqotjj |r|j |qot |rot|rd}qqoqoWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR RtappendRR R(tdirnameR tnamestmsgtsubdirsRtfullname((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR<s0      c Csyt|d}Wn(tk r=}td||fdSXtjj|\}}tjj|d|}d}d}x|j}|sPn|d}|dkrd|krt|d|j dS|dkrf|dkrf|d d krft j|d} | rft j d | ddkrf|d | d}|d }t||j dSnx>|d dkr|j} | sPn|| }|d}qiWt |} | |krm|dkr:yt|d}Wn2tk r}|j td||fdSX|jdd}t|dq~ntt|dtd|td| n|dk r~|j| q~q~W|j |sdSy+tj|} tj|| td@Wn*tjk r}td||fnXytj||dWn*tjk r=}td||fnXytj||Wn+tjk r}td||fdSXdS(Ntrs%s: cannot open: %r it@iss!: contains null bytes; not fixed is#!s [pP]ythons: s script; not fixed is\ tws%s: cannot create: %r s: s s< s> is%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) (topentIOErrorRRRtsplitRtNonetreadlinetclosetstringtretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename( tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR Rs   ("            (t tokenprogt:tifteliftwhiles treturnt)t(t]t[t}t{t`cCs?d|kr|Sdt|}}g}x||kr:tj||}|dkrcdGH|G|Stjd\}}|||!}||}|r||dkr|d=q,tj|r|jt|q,|dkr|r|| d||}|tdt|}}q,|dkr,| r,dGH|Gq,q,W|S(Nt=is(Syntax error:)iis==s(Warning: '==' at top level:)(tlenRARtregsthas_keyR(R<titntstacktjtatbttoken((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyR,s0       t__main__(RR*RR1R)tstderrR0RRtstdoutR.R tcompileRRRR ttokenizeRARR,t__name__(((s*/usr/lib64/python2.7/Demo/scripts/eqfix.pyts$           R  PK!(N update.pynuȯ#! /usr/bin/python2.7 # Update a bunch of files according to a script. # The input file contains lines of the form ::, # meaning that the given line of the given file is to be replaced # by the given text. This is useful for performing global substitutions # on grep output: import os import sys import re pat = '^([^: \t\n]+):([1-9][0-9]*):' prog = re.compile(pat) class FileObj: def __init__(self, filename): self.filename = filename self.changed = 0 try: self.lines = open(filename, 'r').readlines() except IOError, msg: print '*** Can\'t open "%s":' % filename, msg self.lines = None return print 'diffing', self.filename def finish(self): if not self.changed: print 'no changes to', self.filename return try: os.rename(self.filename, self.filename + '~') fp = open(self.filename, 'w') except (os.error, IOError), msg: print '*** Can\'t rewrite "%s":' % self.filename, msg return print 'writing', self.filename for line in self.lines: fp.write(line) fp.close() self.changed = 0 def process(self, lineno, rest): if self.lines is None: print '(not processed): %s:%s:%s' % ( self.filename, lineno, rest), return i = eval(lineno) - 1 if not 0 <= i < len(self.lines): print '*** Line number out of range: %s:%s:%s' % ( self.filename, lineno, rest), return if self.lines[i] == rest: print '(no change): %s:%s:%s' % ( self.filename, lineno, rest), return if not self.changed: self.changed = 1 print '%sc%s' % (lineno, lineno) print '<', self.lines[i], print '---' self.lines[i] = rest print '>', self.lines[i], def main(): if sys.argv[1:]: try: fp = open(sys.argv[1], 'r') except IOError, msg: print 'Can\'t open "%s":' % sys.argv[1], msg sys.exit(1) else: fp = sys.stdin curfile = None while 1: line = fp.readline() if not line: if curfile: curfile.finish() break n = prog.match(line) if n < 0: print 'Funny line:', line, continue filename, lineno = prog.group(1, 2) if not curfile or filename <> curfile.filename: if curfile: curfile.finish() curfile = FileObj(filename) curfile.process(lineno, line[n:]) if __name__ == "__main__": main() PK!) - - lpwatch.pycnu[ Afc@stddlZddlZddlZdZdZdZdZedkrpy eWqpek rlqpXndS(iNtpsci cCst}ytjd}Wntjd}nXtjd}|rxlt|D]-\}}|d dkrN|d||&1RiiitbytesiiitRanks no entriess: idleis is ready and printings%d Kiis (%d jobs)s for %ss for %d userss (%s first)s (%d K before %s)slpq exit status %rs: (ii( RRtFalsetsplittlentintRtgettstriptappendtkeystclosetjoin(RRtpipetlinestuserst aheadbytest aheadjobstuserseent totalbytest totaljobstlinetfieldstntranktusertjobtfilesRtujobstubyteststs((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyR)sd   &               t__main__( RR RR RRRt__name__tKeyboardInterrupt(((s,/usr/lib64/python2.7/Demo/scripts/lpwatch.pyts     9   PK!# primes.pyonu[ Afc@s,dZdZedkr(endS(cCs|dko|knr$dGHndg}d}x||krx2|D]*}||dkso|||krIPqIqIW||dkr|j|||kr|GHqn|d7}q6WdS(Niii(tappend(tmintmaxtprimestitp((s+/usr/lib64/python2.7/Demo/scripts/primes.pyRs      cCsoddl}d\}}|jdr^t|jd}|jdr^t|jd}q^nt||dS(Niiii(ii(tsystargvtintR(RRR((s+/usr/lib64/python2.7/Demo/scripts/primes.pytmains    t__main__N(RR t__name__(((s+/usr/lib64/python2.7/Demo/scripts/primes.pyts  PK!T`morse.pynuȯ#! /usr/bin/python2.7 # DAH should be three DOTs. # Space between DOTs and DAHs should be one DOT. # Space between two letters should be one DAH. # Space between two words should be DOT DAH DAH. import sys, math, audiodev DOT = 30 DAH = 3 * DOT OCTAVE = 2 # 1 == 441 Hz, 2 == 882 Hz, ... morsetab = { 'A': '.-', 'a': '.-', 'B': '-...', 'b': '-...', 'C': '-.-.', 'c': '-.-.', 'D': '-..', 'd': '-..', 'E': '.', 'e': '.', 'F': '..-.', 'f': '..-.', 'G': '--.', 'g': '--.', 'H': '....', 'h': '....', 'I': '..', 'i': '..', 'J': '.---', 'j': '.---', 'K': '-.-', 'k': '-.-', 'L': '.-..', 'l': '.-..', 'M': '--', 'm': '--', 'N': '-.', 'n': '-.', 'O': '---', 'o': '---', 'P': '.--.', 'p': '.--.', 'Q': '--.-', 'q': '--.-', 'R': '.-.', 'r': '.-.', 'S': '...', 's': '...', 'T': '-', 't': '-', 'U': '..-', 'u': '..-', 'V': '...-', 'v': '...-', 'W': '.--', 'w': '.--', 'X': '-..-', 'x': '-..-', 'Y': '-.--', 'y': '-.--', 'Z': '--..', 'z': '--..', '0': '-----', ',': '--..--', '1': '.----', '.': '.-.-.-', '2': '..---', '?': '..--..', '3': '...--', ';': '-.-.-.', '4': '....-', ':': '---...', '5': '.....', "'": '.----.', '6': '-....', '-': '-....-', '7': '--...', '/': '-..-.', '8': '---..', '(': '-.--.-', '9': '----.', ')': '-.--.-', ' ': ' ', '_': '..--.-', } nowave = '\0' * 200 # If we play at 44.1 kHz (which we do), then if we produce one sine # wave in 100 samples, we get a tone of 441 Hz. If we produce two # sine waves in these 100 samples, we get a tone of 882 Hz. 882 Hz # appears to be a nice one for playing morse code. def mkwave(octave): sinewave = '' for i in range(100): val = int(math.sin(math.pi * i * octave / 50.0) * 30000) sinewave += chr((val >> 8) & 255) + chr(val & 255) return sinewave defaultwave = mkwave(OCTAVE) def main(): import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'o:p:') except getopt.error: sys.stderr.write('Usage ' + sys.argv[0] + ' [ -o outfile ] [ -p octave ] [ words ] ...\n') sys.exit(1) dev = None wave = defaultwave for o, a in opts: if o == '-o': import aifc dev = aifc.open(a, 'w') dev.setframerate(44100) dev.setsampwidth(2) dev.setnchannels(1) if o == '-p': wave = mkwave(int(a)) if not dev: import audiodev dev = audiodev.AudioDev() dev.setoutrate(44100) dev.setsampwidth(2) dev.setnchannels(1) dev.close = dev.stop dev.writeframesraw = dev.writeframes if args: source = [' '.join(args)] else: source = iter(sys.stdin.readline, '') for line in source: mline = morse(line) play(mline, dev, wave) if hasattr(dev, 'wait'): dev.wait() dev.close() # Convert a string to morse code with \001 between the characters in # the string. def morse(line): res = '' for c in line: try: res += morsetab[c] + '\001' except KeyError: pass return res # Play a line of morse code. def play(line, dev, wave): for c in line: if c == '.': sine(dev, DOT, wave) elif c == '-': sine(dev, DAH, wave) else: # space pause(dev, DAH + DOT) pause(dev, DOT) def sine(dev, length, wave): for i in range(length): dev.writeframesraw(wave) def pause(dev, length): for i in range(length): dev.writeframesraw(nowave) if __name__ == '__main__': main() PK!R~pi.pyonu[ Afc@s8ddlZdZdZedkr4endS(iNc Csd\}}}}}xtr||d|d|d}}}||||||||||f\}}}}||||}}xL||krt|d||d||}}||||}}qWqWdS(Niiii i (iiii i(tTruetoutput( tktatbta1tb1tptqtdtd1((s'/usr/lib64/python2.7/Demo/scripts/pi.pytmain s $6 cCs'tjjt|tjjdS(N(tsyststdouttwritetstrtflush(R ((s'/usr/lib64/python2.7/Demo/scripts/pi.pyRst__main__(R R Rt__name__(((s'/usr/lib64/python2.7/Demo/scripts/pi.pyt s   PK!aPOO morse.pycnu[ Afc@sddlZddlZddlZdZdeZdZiJdd6dd6dd 6dd 6d d 6d d 6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d d"6d#d$6d#d%6d&d'6d&d(6d)d*6d)d+6d,d-6d,d.6d/d06d/d16d2d36d2d46d5d66d5d76d8d96d8d:6d;d<6d;d=6d>d?6d>d@6dAdB6dAdC6dDdE6dDdF6dGdH6dGdI6dJdK6dJdL6dMdN6dMdO6dPdQ6dPdR6dSdT6dUdV6dWdX6dYd6dZd[6d\d]6d^d_6d`da6dbdc6ddde6dfdg6dhdi6djdk6dld>6dmdn6dodp6dqdr6dsdt6dudv6dsdw6dxdx6dydz6Zd{d|Zd}ZeeZ d~Z dZ dZ dZ dZedkre ndS(iNiiis.-tAtas-...tBtbs-.-.tCtcs-..tDtdt.tEtes..-.tFtfs--.tGtgs....tHths..tItis.---tJtjs-.-tKtks.-..tLtls--tMtms-.tNtns---tOtos.--.tPtps--.-tQtqs.-.tRtrs...tStst-tTtts..-tUtus...-tVtvs.--tWtws-..-tXtxs-.--tYtys--..tZtzs-----t0s--..--t,s.----t1s.-.-.-s..---t2s..--..t?s...--t3s-.-.-.t;s....-t4s---...t:s.....t5s.----.t's-....t6s-....-s--...t7s-..-.t/s---..t8s-.--.-t(s----.t9t)t s..--.-t_sicCsod}xbtdD]T}ttjtj||dd}|t|d?d@t|d@7}qW|S(NtidgI@i0uii(trangetinttmathtsintpitchr(toctavetsinewaveRtval((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmkwave<s (*c Csddl}y#|jtjdd\}}Wn@|jk rqtjjdtjddtjdnXd}t}x|D]\}}|dkrddl }|j |d}|j d |j d |j dn|d krtt|}qqW|sjddl}|j}|jd |j d |j d|j|_|j|_n|rd j|g} nttjjd } xF| D]>} t| } t| ||t|dr|jqqW|jdS(Niiso:p:sUsage is, [ -o outfile ] [ -p octave ] [ words ] ... s-oR/iDis-pRHRJtwait(tgetopttsystargvterrortstderrtwritetexittNonet defaultwavetaifctopent setframeratet setsampwidtht setnchannelsRTRLtaudiodevtAudioDevt setoutratetstoptcloset writeframestwriteframesrawtjointitertstdintreadlinetmorsetplaythasattrRU( RVtoptstargstdevtwaveRRR_Rdtsourcetlinetmline((s*/usr/lib64/python2.7/Demo/scripts/morse.pytmainEsF #             cCsEd}x8|D]0}y|t|d7}Wq tk r<q Xq W|S(NRJs(tmorsetabtKeyError(RwtresR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRoms  cCsqxj|D]b}|dkr,t|t|n0|dkrKt|t|nt|ttt|tqWdS(NRR'(tsinetDOTtDAHtpause(RwRtRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRpws   cCs(x!t|D]}|j|q WdS(N(RKRj(RttlengthRuR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyR}scCs(x!t|D]}|jtq WdS(N(RKRjtnowave(RtRR((s*/usr/lib64/python2.7/Demo/scripts/morse.pyRst__main__(RWRMRdR~RtOCTAVERzRRTR^RyRoRpR}Rt__name__(((s*/usr/lib64/python2.7/Demo/scripts/morse.pytsf$     (   PK!# primes.pycnu[ Afc@s,dZdZedkr(endS(cCs|dko|knr$dGHndg}d}x||krx2|D]*}||dkso|||krIPqIqIW||dkr|j|||kr|GHqn|d7}q6WdS(Niii(tappend(tmintmaxtprimestitp((s+/usr/lib64/python2.7/Demo/scripts/primes.pyRs      cCsoddl}d\}}|jdr^t|jd}|jdr^t|jd}q^nt||dS(Niiii(ii(tsystargvtintR(RRR((s+/usr/lib64/python2.7/Demo/scripts/primes.pytmains    t__main__N(RR t__name__(((s+/usr/lib64/python2.7/Demo/scripts/primes.pyts  PK!й markov.pycnu[ Afc@s6dddYZdZedkr2endS(tMarkovcBs,eZdZdZdZdZRS(cCs||_||_i|_dS(N(thistsizetchoicettrans(tselfRR((s+/usr/lib64/python2.7/Demo/scripts/markov.pyt__init__s  cCs |jj|gj|dS(N(Rt setdefaulttappend(Rtstatetnext((s+/usr/lib64/python2.7/Demo/scripts/markov.pytadd scCs|j}|j}|d|d xFtt|D]2}||td|||!|||d!q6W||t||ddS(Nii(RR tNonetrangetlentmax(RtseqtnR ti((s+/usr/lib64/python2.7/Demo/scripts/markov.pytput s   0cCs|j}|j}|j}||d}xQtr~|tdt||}||}||}|sqPn||7}q.W|S(Ni(RRRR tTrueRR (RRRRRtsubseqtoptionsR ((s+/usr/lib64/python2.7/Demo/scripts/markov.pytgets      (t__name__t __module__RR RR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyRs   cCsddl}ddl}ddl}|jd}y|j|d\}}Wnm|jk rd|jdGHdGHdGHdGHd GHd GHd GHd GHd GHdGHdGHdGHdGH|jdnXd}t}d}x|D]\}} d|kodknrt|d}n|dkr&t}n|dkr?|d7}n|dkrTd}n|dkrt}qqW|sdg}nt ||j } yx|D]} | dkr|j } | j rdGHqqnt | d} |rdG| GdGHn| j} | j| jd}xh|D]`}|dkr;dGHn|j}|r!|rbt|}nd j|}| j|q!q!WqWWntk rd!GHnX| jsd"GHdS|rd#GHn|dkrIxN| jjD]=}|dkst||krt|G| j|GHqqW|dkrEtd$G| jd$GHnHnxtr| j}|rm|}n |j}d}d%}xF|D]>}|t||krHd}n|G|t|d7}qWHHqLWdS(&Niit0123456789cdwqs"Usage: %s [-#] [-cddqw] [file] ...isOptions:s$-#: 1-digit history size (default 2)s-c: characters (default)s -w: wordss-d: more debugging outputs-q: no debugging outputs3Input files (default stdin) are split in paragraphss1separated blank lines and each paragraph is splits0in words by whitespace, then reconcatenated withs#exactly one space separating words.s0Output consists of paragraphs separated by blanks4lines, where lines are no longer than 72 characters.is-0s-9s-cs-ds-qs-wt-sSorry, need stdin from filetrt processings...s s feeding ...t s-Interrupted -- continue with data read so farsNo valid input filessdone.tiH(tsystrandomtgetopttargvterrortexittFalsetintRRRtstdintisattytopentreadtclosetsplitttupletjoinRtKeyboardInterruptRtkeysR R treprR(RR R!targstoptsRtdo_wordstdebugtotatmtfilenametfttexttparalisttparatwordstdatatkeyRtlimittw((s+/usr/lib64/python2.7/Demo/scripts/markov.pyttest#s$                           t__main__N((RRCR(((s+/usr/lib64/python2.7/Demo/scripts/markov.pyts U PK!cA-D script.pyonu[ Afc@sddlZddlZddlZddlZddlZdZdZdZdZej j dryej dZny#ejej dd\Z Z Wn9ejk rZd ej d efGHejd nXx>e D]6\ZZed krd ZqedkrdZqqWeeeZejjdeejdejejejeeejdejejejjdedS(iNcCs#tj|d}tj||S(Ni(tostreadtscripttwrite(tfdtdata((s+/usr/lib64/python2.7/Demo/scripts/script.pyR s tsht typescripttwtSHELLitaps%s: %siis-atas-ptpythonsScript started, file is %s sScript started on %s sScript done on %s sScript done, file is %s (RttimetsystgetopttptyRtshelltfilenametmodetenvironthas_keytargvtoptstargsterrortmsgtexittoR topenRtstdoutRtctimetspawn(((s+/usr/lib64/python2.7/Demo/scripts/script.pyt s.0  #      PK!VB queens.pyonu[ Afc@sBdZdZdddYZdZedkr>endS(sN queens problem. The (well-known) problem is due to Niklaus Wirth. This solution is inspired by Dijkstra (Structured Programming). It is a classic recursive backtracking approach. itQueenscBsSeZedZdZddZdZdZdZdZ dZ RS(cCs||_|jdS(N(tntreset(tselfR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyt__init__s cCsf|j}dg||_dg||_dgd|d|_dgd|d|_d|_dS(Niii(RtNonetytrowtuptdowntnfound(RR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs  icCsx}t|jD]l}|j||r|j|||d|jkrX|jn|j|d|j||qqWdS(Ni(trangeRtsafetplacetdisplaytsolvetremove(RtxR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyRs cCs0|j| o/|j|| o/|j|| S(N(RRR (RRR((s+/usr/lib64/python2.7/Demo/scripts/queens.pyR &scCs@||j| s 8  PK!; script.pynuȯ#! /usr/bin/python2.7 # script.py -- Make typescript of terminal session. # Usage: # -a Append to typescript. # -p Use Python as shell. # Author: Steen Lumholt. import os, time, sys, getopt import pty def read(fd): data = os.read(fd, 1024) script.write(data) return data shell = 'sh' filename = 'typescript' mode = 'w' if os.environ.has_key('SHELL'): shell = os.environ['SHELL'] try: opts, args = getopt.getopt(sys.argv[1:], 'ap') except getopt.error, msg: print '%s: %s' % (sys.argv[0], msg) sys.exit(2) for o, a in opts: if o == '-a': mode = 'a' elif o == '-p': shell = 'python' script = open(filename, mode) sys.stdout.write('Script started, file is %s\n' % filename) script.write('Script started on %s\n' % time.ctime(time.time())) pty.spawn(shell, read) script.write('Script done on %s\n' % time.ctime(time.time())) sys.stdout.write('Script done, file is %s\n' % filename) PK!X install.shnuȯ#!/bin/sh # A word about this shell script: # # It must work everywhere, including on systems that lack # a /bin/bash, map 'sh' to ksh, ksh97, bash, ash, or zsh, # and potentially have either a posix shell or bourne # shell living at /bin/sh. # # See this helpful document on writing portable shell scripts: # https://www.gnu.org/s/hello/manual/autoconf/Portable-Shell.html # # The only shell it won't ever work on is cmd.exe. if [ "x$0" = "xsh" ]; then # run as curl | sh # on some systems, you can just do cat>npm-install.sh # which is a bit cuter. But on others, &1 is already closed, # so catting to another script file won't do anything. # Follow Location: headers, and fail on errors curl -f -L -s https://www.npmjs.org/install.sh > npm-install-$$.sh ret=$? if [ $ret -eq 0 ]; then (exit 0) else echo "Uninstalling npm-install-$$.sh" >&2 rm npm-install-$$.sh echo "Failed to download script" >&2 exit $ret fi sh npm-install-$$.sh ret=$? echo "Uninstalling npm-install-$$.sh" >&2 rm npm-install-$$.sh exit $ret fi # See what "npm_config_*" things there are in the env, # and make them permanent. # If this fails, it's not such a big deal. configures="`env | grep 'npm_config_' | sed -e 's|^npm_config_||g'`" npm_config_loglevel="error" if [ "x$npm_debug" = "x" ]; then (exit 0) else echo "Running in debug mode." echo "Note that this requires bash or zsh." set -o xtrace set -o pipefail npm_config_loglevel="verbose" fi export npm_config_loglevel # make sure that node exists node=`which node 2>&1` ret=$? # if not found, try "nodejs" as it is the case on debian if [ $ret -ne 0 ]; then node=`which nodejs 2>&1` ret=$? fi if [ $ret -eq 0 ] && [ -x "$node" ]; then (exit 0) else echo "npm cannot be installed without node.js." >&2 echo "Install node first, and then try again." >&2 echo "" >&2 echo "Maybe node is installed, but not in the PATH?" >&2 echo "Note that running as sudo can change envs." >&2 echo "" echo "PATH=$PATH" >&2 exit $ret fi # set the temp dir TMP="${TMPDIR}" if [ "x$TMP" = "x" ]; then TMP="/tmp" fi TMP="${TMP}/npm.$$" rm -rf "$TMP" || true mkdir "$TMP" if [ $? -ne 0 ]; then echo "failed to mkdir $TMP" >&2 exit 1 fi BACK="$PWD" ret=0 tar="${TAR}" if [ -z "$tar" ]; then tar="${npm_config_tar}" fi if [ -z "$tar" ]; then tar=`which tar 2>&1` ret=$? fi if [ $ret -eq 0 ] && [ -x "$tar" ]; then echo "tar=$tar" if [ $tar --version > /dev/null 2>&1 ]; then echo "version:" $tar --version fi ret=$? fi if [ $ret -eq 0 ]; then (exit 0) else echo "No suitable tar program found." exit 1 fi # Try to find a suitable make # If the MAKE environment var is set, use that. # otherwise, try to find gmake, and then make. # If no make is found, then just execute the necessary commands. # XXX For some reason, make is building all the docs every time. This # is an annoying source of bugs. Figure out why this happens. MAKE=NOMAKE if [ "x$MAKE" = "x" ]; then make=`which gmake 2>&1` if [ $? -eq 0 ] && [ -x "$make" ]; then (exit 0) else make=`which make 2>&1` if [ $? -eq 0 ] && [ -x "$make" ]; then (exit 0) else make=NOMAKE fi fi else make="$MAKE" fi if [ -x "$make" ]; then (exit 0) else # echo "Installing without make. This may fail." >&2 make=NOMAKE fi # If there's no bash, then don't even try to clean if [ -x "/bin/bash" ]; then (exit 0) else clean="no" fi node_version=`"$node" --version 2>&1` ret=$? if [ $ret -ne 0 ]; then echo "You need node to run this program." >&2 echo "node --version reports: $node_version" >&2 echo "with exit code = $ret" >&2 echo "Please install node before continuing." >&2 exit $ret fi t="${npm_install}" if [ -z "$t" ]; then # switch based on node version. # note that we can only use strict sh-compatible patterns here. case $node_version in 0.[01234567].* | v0.[01234567].*) echo "You are using an outdated and unsupported version of" >&2 echo "node ($node_version). Please update node and try again." >&2 exit 99 ;; *) echo "install npm@latest" t="latest" ;; esac fi # need to echo "" after, because Posix sed doesn't treat EOF # as an implied end of line. url=`(curl -SsL https://registry.npmjs.org/npm/$t; echo "") \ | sed -e 's/^.*tarball":"//' \ | sed -e 's/".*$//'` ret=$? if [ "x$url" = "x" ]; then ret=125 # try without the -e arg to sed. url=`(curl -SsL https://registry.npmjs.org/npm/$t; echo "") \ | sed 's/^.*tarball":"//' \ | sed 's/".*$//'` ret=$? if [ "x$url" = "x" ]; then ret=125 fi fi if [ $ret -ne 0 ]; then echo "Failed to get tarball url for npm/$t" >&2 exit $ret fi echo "fetching: $url" >&2 cd "$TMP" \ && curl -SsL "$url" \ | $tar -xzf - \ && cd "$TMP"/* \ && (ret=0 if [ $ret -ne 0 ]; then echo "Aborted 0.x cleanup. Exiting." >&2 exit $ret fi) \ && (if [ "x$configures" = "x" ]; then (exit 0) else echo "./configure $configures" echo "$configures" > npmrc fi) \ && (if [ "$make" = "NOMAKE" ]; then (exit 0) elif "$make" uninstall install; then (exit 0) else make="NOMAKE" fi if [ "$make" = "NOMAKE" ]; then "$node" bin/npm-cli.js rm npm -gf "$node" bin/npm-cli.js install -gf $("$node" bin/npm-cli.js pack | tail -1) fi) \ && cd "$BACK" \ && rm -rf "$TMP" \ && echo "It worked" ret=$? if [ $ret -ne 0 ]; then echo "It failed" >&2 fi exit $ret PK!RT++gen-dev-ignores.jsnu[const fs = require('fs') const plock = require('../package-lock.json') fs.writeFileSync(`${__dirname}/../node_modules/.gitignore`, '## Automatically generated dev dependency ignores\n' + Object.keys(plock.dependencies).filter(_ => plock.dependencies[_].dev).map(_ => `/${_}`).join('\n') + '\n') PK!Vpublish-tag.jsnu[var semver = require('semver') var version = semver.parse(require('../package.json').version) console.log('v%s.%s-next', version.major, version.minor) PK! release.shnu[#!/usr/bin/env bash # script for creating a zip and tarball for inclusion in node unset CDPATH set -e rm -rf release *.tgz || true mkdir release node ./bin/npm-cli.js pack --loglevel error >/dev/null mv *.tgz release cd release tar xzf *.tgz cp -r ../test package/ mkdir node_modules mv package node_modules/npm # make the zip for windows users cp node_modules/npm/bin/*.cmd . zipname=npm-$(node ../bin/npm-cli.js -v).zip zip -q -9 -r -X "$zipname" *.cmd node_modules # make the tar for node's deps cd node_modules tarname=npm-$(node ../../bin/npm-cli.js -v).tgz tar czf "$tarname" npm cd .. mv "node_modules/$tarname" . rm -rf *.cmd rm -rf node_modules cd .. echo "release/$tarname" echo "release/$zipname" PK!y} relocate.shnuȯ#!/usr/bin/bash # Change the cli shebang to point at the specified node # Useful for when the program is moved around after install. # Also used by the default 'make install' in node to point # npm at the newly installed node, rather than the first one # in the PATH, which would be the default otherwise. # bash /path/to/npm/scripts/relocate.sh $nodepath # If $nodepath is blank, then it'll use /usr/bin/env dir="$(dirname "$(dirname "$0")")" cli="$dir"/bin/npm-cli.js tmp="$cli".tmp node="$1" if [ "x$node" = "x" ]; then node="/usr/bin/env node" fi node="#!$node" sed -e 1d "$cli" > "$tmp" echo "$node" > "$cli" cat "$tmp" >> "$cli" rm "$tmp" chmod ogu+x $cli PK!+ FFmaketestnuȯ#!/opt/alt/alt-nodejs8/root/usr/bin/node 'use strict' const loadFromDir = require('tacks/load-from-dir.js') process.exit(main(process.argv.slice(2))) function main (argv) { if (argv.length !== 1) { console.error('Usage: maketest ') return 1 } const fixturedir = process.argv[2] console.log(generateFromDir(fixturedir)) return 0 } function indent (ind, str) { return str.replace(/\n/g, '\n' + ind) } function generateFromDir (dir) { const tacks = loadFromDir(dir) return `'use strict' const path = require('path') const test = require('tap').test const Tacks = require('tacks') const File = Tacks.File const Symlink = Tacks.Symlink const Dir = Tacks.Dir const common = require('../common-tap.js') const basedir = path.join(__dirname, path.basename(__filename, '.js')) const testdir = path.join(basedir, 'testdir') const cachedir = path.join(basedir, 'cache') const globaldir = path.join(basedir, 'global') const tmpdir = path.join(basedir, 'tmp') const conf = { cwd: testdir, env: common.newEnv().extend({ npm_config_cache: cachedir, npm_config_tmp: tmpdir, npm_config_prefix: globaldir, npm_config_registry: common.registry, npm_config_loglevel: 'warn' }) } const fixture = new Tacks(Dir({ cache: Dir(), global: Dir(), tmp: Dir(), testdir: ${indent(' ', tacks.fixture.toSource())} })) function setup () { cleanup() fixture.create(basedir) } function cleanup () { fixture.remove(basedir) } test('setup', t => { setup() return common.fakeRegistry.listen() }) test('example', t => { return common.npm(['install'], conf).then(([code, stdout, stderr]) => { t.is(code, 0, 'command ran ok') t.comment(stdout.trim()) t.comment(stderr.trim()) // your assertions here }) }) test('cleanup', t => { common.fakeRegistry.close() cleanup() t.done() })\n` } PK!CSdev-dep-updatenuȯ#!/usr/bin/bash node . install --save --save-dev $1@$2 &&\ node scripts/gen-dev-ignores.js &&\ git add package.json package-lock.json &&\ git commit -m"$1@$2" &&\ node . repo $1 &&\ git commit --amend PK!% dep-updatenuȯ#!/usr/bin/bash node . install --save $1@$2 &&\ node scripts/gen-dev-ignores.js &&\ git add node_modules package.json package-lock.json &&\ git commit -m"$1@$2" &&\ node . repo $1 &&\ git commit --amend PK!!R changelog.jsnu['use strict' /* Usage: node scripts/changelog.js [comittish] Generates changelog entries in our format as best as its able based on commits starting at comittish, or if that's not passed, latest. Ordinarily this is run via the gen-changelog shell script, which appends the result to the changelog. */ const execSync = require('child_process').execSync const branch = process.argv[2] || 'origin/latest' const log = execSync(`git log --reverse --pretty='format:%h %H%d %s (%aN)%n%b%n---%n' ${branch}...`).toString().split(/\n/) main() function shortname (url) { let matched = url.match(/https:\/\/github\.com\/([^/]+\/[^/]+)\/(?:pull|issues)\/(\d+)/) || url.match(/https:\/\/(npm\.community)\/t\/(?:[^/]+\/)(\d+)/) if (!matched) return false let repo = matched[1] let id = matched[2] if (repo !== 'npm/cli') { return `${repo}#${id}` } else { return `#${id}` } } function printCommit (c) { console.log(`* [\`${c.shortid}\`](https://github.com/npm/cli/commit/${c.fullid})`) if (c.fixes) { let label = shortname(c.fixes) if (label) { console.log(` [${label}](${c.fixes})`) } else { console.log(` [npm.community#${c.fixes}](https://npm.community/t/${c.fixes})`) } } else if (c.prurl) { let label = shortname(c.prurl) if (label) { console.log(` [${label}](${c.prurl})`) } else { console.log(` [#](${c.prurl})`) } } let msg = c.message .replace(/^\s+/mg, '') .replace(/^[-a-z]+: /, '') .replace(/^/mg, ' ') .replace(/\n$/, '') // backtickify package@version .replace(/^(\s*[^@\s]+@\d+[.]\d+[.]\d+)(\s*\S)/g, '$1:$2') .replace(/\b([^@\s]+@\d+[.]\d+[.]\d+)\b/g, '`$1`') // linkify commitids .replace(/\b([a-f0-9]{7,8})\b/g, '[`$1`](https://github.com/npm/cli/commit/$1)') .replace(/\b#(\d+)\b/g, '[#$1](https://npm.community/t/$1)') console.log(msg) if (c.credit) { c.credit.forEach(function (credit) { console.log(` ([@${credit}](https://github.com/${credit}))`) }) } else { console.log(` ([@${c.author}](https://github.com/${c.author}))`) } } function main () { let commit log.forEach(function (line) { line = line.replace(/\r/g, '') let m /* eslint no-cond-assign:0 */ if (/^---$/.test(line)) { printCommit(commit) } else if (m = line.match(/^([a-f0-9]{7,10}) ([a-f0-9]+) (?:[(]([^)]+)[)] )?(.*?) [(](.*?)[)]/)) { commit = { shortid: m[1], fullid: m[2], branch: m[3], message: m[4], author: m[5], prurl: null, fixes: null, credit: null } } else if (m = line.match(/^PR-URL: (.*)/)) { commit.prurl = m[1] } else if (m = line.match(/^Credit: @(.*)/)) { if (!commit.credit) commit.credit = [] commit.credit.push(m[1]) } else if (m = line.match(/^Fixes: #?(.*)/)) { commit.fixes = m[1] } else if (m = line.match(/^Reviewed-By: @(.*)/)) { commit.reviewed = m[1] } else if (/\S/.test(line)) { commit.message += `\n${line}` } }) } PK!umindex-build.jsnuȯ#!/opt/alt/alt-nodejs9/root/usr/bin/node var fs = require('fs') var path = require('path') var root = path.resolve(__dirname, '..') var glob = require('glob') var conversion = { 'cli': 1, 'api': 3, 'files': 5, 'misc': 7 } glob(root + '/{README.md,doc/*/*.md}', function (er, files) { if (er) throw er output(files.map(function (f) { var b = path.basename(f) if (b === 'README.md') return [0, b] if (b === 'index.md') return null var s = conversion[path.basename(path.dirname(f))] return [s, f] }).filter(function (f) { return f }).sort(function (a, b) { return (a[0] === b[0]) ? (path.basename(a[1]) === 'npm.md' ? -1 : path.basename(b[1]) === 'npm.md' ? 1 : a[1] > b[1] ? 1 : -1) : a[0] - b[0] })) }) function output (files) { console.log( 'npm-index(7) -- Index of all npm documentation\n' + '==============================================\n') writeLines(files, 0) writeLines(files, 1, 'Command Line Documentation', 'Using npm on the command line') writeLines(files, 3, 'API Documentation', 'Using npm in your Node programs') writeLines(files, 5, 'Files', 'File system structures npm uses') writeLines(files, 7, 'Misc', 'Various other bits and bobs') } function writeLines (files, sxn, heading, desc) { if (heading) { console.log('## %s\n\n%s\n', heading, desc) } files.filter(function (f) { return f[0] === sxn }).forEach(writeLine) } function writeLine (sd) { var sxn = sd[0] || 1 var doc = sd[1] var d = path.basename(doc, '.md') var content = fs.readFileSync(doc, 'utf8').split('\n')[0].split('-- ')[1] console.log('### %s(%d)\n', d, sxn) console.log(content + '\n') } PK!LKupdate-authors.shnuȯ#!/bin/sh git log --use-mailmap --reverse --format='%aN <%aE>' | perl -wnE ' BEGIN { say "# Authors sorted by whether or not they\x27re me"; } print $seen{$_} = $_ unless $seen{$_} ' > AUTHORS PK!RWN gen-changelognuȯ#!/bin/sh # Usage: gen-changelog [comittish] # Reads all the commits since comittish and produces changelog entries in # our style as best as it can, appendning them to CHANGELOG.md. If it # encounters a git error it won't modify CHANGELOG.md # @iarna uses this as the first step in producing changelogs for a release. (node $(npm prefix)/scripts/changelog.js "$@"; cat CHANGELOG.md) > new.md && mv new.md CHANGELOG.md PK!a; doc-build.shnuȯ#!/usr/bin/bash if [[ $DEBUG != "" ]]; then set -x fi set -o errexit set -o pipefail src=$1 dest=$2 name=$(basename ${src%.*}) date=$(date -u +'%Y-%m-%d %H:%M:%S') version=$(node bin/npm-cli.js -v) mkdir -p $(dirname $dest) html_replace_tokens () { local url=$1 sed "s|@NAME@|$name|g" \ | sed "s|@DATE@|$date|g" \ | sed "s|@URL@|$url|g" \ | sed "s|@VERSION@|$version|g" \ | perl -p -e 's/]*)>([^\(]*\([0-9]\)) -- (.*?)<\/h1>/

\2<\/h1>

\3<\/p>/g' \ | perl -p -e 's/npm-npm/npm/g' \ | perl -p -e 's/([^"-])(npm-)?README(?!\.html)(\(1\))?/\1README<\/a>/g' \ | perl -p -e 's/<a href="[^"]+README.html">README<\/a><\/title>/<title>README<\/title>/g' \ | perl -p -e 's/([^"-])([^\(> ]+)(\(1\))/\1<a href="..\/cli\/\2.html">\2\3<\/a>/g' \ | perl -p -e 's/([^"-])([^\(> ]+)(\(3\))/\1<a href="..\/api\/\2.html">\2\3<\/a>/g' \ | perl -p -e 's/([^"-])([^\(> ]+)(\(5\))/\1<a href="..\/files\/\2.html">\2\3<\/a>/g' \ | perl -p -e 's/([^"-])([^\(> ]+)(\(7\))/\1<a href="..\/misc\/\2.html">\2\3<\/a>/g' \ | perl -p -e 's/\([1357]\)<\/a><\/h1>/<\/a><\/h1>/g' \ | (if [ $(basename $(dirname $dest)) == "doc" ]; then perl -p -e 's/ href="\.\.\// href="/g' else cat fi) } man_replace_tokens () { sed "s|@VERSION@|$version|g" \ | perl -p -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(1\)/npm help \2/g' \ | perl -p -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(([57])\)/npm help \3 \2/g' \ | perl -p -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(3\)/npm apihelp \2/g' \ | perl -p -e 's/npm\(1\)/npm help npm/g' \ | perl -p -e 's/npm\(3\)/npm apihelp npm/g' } case $dest in *.[1357]) ./node_modules/.bin/marked-man --roff $src \ | man_replace_tokens > $dest exit $? ;; *.html) url=${dest/html\//} (cat html/dochead.html && \ cat $src | ./node_modules/.bin/marked && cat html/docfoot.html)\ | html_replace_tokens $url \ > $dest exit $? ;; *) echo "Invalid destination type: $dest" >&2 exit 1 ;; esac PK�������!�P���� ��clean-old.shnu�ȯ��������#!/usr/bin/bash # look for old 0.x cruft, and get rid of it. # Should already be sitting in the npm folder. # This doesn't have to be quite as cross-platform as install.sh. # There are some bash-isms, because maintaining *two* # fully-portable posix/bourne sh scripts is too much for # one project with a sane maintainer. # If readlink isn't available, then this is just too tricky. # However, greadlink is fine, so Solaris can join the party, too. readlink="readlink" which $readlink >/dev/null 2>/dev/null if [ $? -ne 0 ]; then readlink="greadlink" which $readlink >/dev/null 2>/dev/null if [ $? -ne 0 ]; then echo "Can't find the readlink or greadlink command. Aborting." exit 1 fi fi if [ "x$npm_config_prefix" != "x" ]; then PREFIXES=$npm_config_prefix else node="$NODE" if [ "x$node" = "x" ]; then node=`which node` fi if [ "x$node" = "x" ]; then echo "Can't find node to determine prefix. Aborting." exit 1 fi PREFIX=`dirname $node` PREFIX=`dirname $PREFIX` echo "cleanup prefix=$PREFIX" PREFIXES=$PREFIX altprefix=`"$node" -e process.installPrefix` if [ "x$altprefix" != "x" ] && [ "x$altprefix" != "x$PREFIX" ]; then echo "altprefix=$altprefix" PREFIXES="$PREFIX $altprefix" fi fi # now prefix is where npm would be rooted by default # go hunting. packages= for prefix in $PREFIXES; do packages="$packages "`ls "$prefix"/lib/node/.npm 2>/dev/null | grep -v .cache` done packages=`echo $packages` filelist=() fid=0 for prefix in $PREFIXES; do # remove any links into the .npm dir, or links to # version-named shims/symlinks. for folder in share/man bin lib/node; do find $prefix/$folder -type l | while read file; do target=`$readlink $file | grep '/\.npm/'` if [ "x$target" != "x" ]; then # found one! filelist[$fid]="$file" let 'fid++' # also remove any symlinks to this file. base=`basename "$file"` base=`echo "$base" | awk -F@ '{print $1}'` if [ "x$base" != "x" ]; then find "`dirname $file`" -type l -name "$base"'*' \ | while read l; do target=`$readlink "$l" | grep "$base"` if [ "x$target" != "x" ]; then filelist[$fid]="$1" let 'fid++' fi done fi fi done # Scour for shim files. These are relics of 0.2 npm installs. # note: grep -r is not portable. find $prefix/$folder -type f \ | xargs grep -sl '// generated by npm' \ | while read file; do filelist[$fid]="$file" let 'fid++' done done # now remove the package modules, and the .npm folder itself. if [ "x$packages" != "x" ]; then for pkg in $packages; do filelist[$fid]="$prefix/lib/node/$pkg" let 'fid++' for i in $prefix/lib/node/$pkg\@*; do filelist[$fid]="$i" let 'fid++' done done fi for folder in lib/node/.npm lib/npm share/npm; do if [ -d $prefix/$folder ]; then filelist[$fid]="$prefix/$folder" let 'fid++' fi done done # now actually clean, but only if there's anything TO clean if [ "${#filelist[@]}" -gt 0 ]; then echo "" echo "This script will find and eliminate any shims, symbolic" echo "links, and other cruft that was installed by npm 0.x." echo "" if [ "x$packages" != "x" ]; then echo "The following packages appear to have been installed with" echo "an old version of npm, and will be removed forcibly:" for pkg in $packages; do echo " $pkg" done echo "Make a note of these. You may want to install them" echo "with npm 1.0 when this process is completed." echo "" fi OK= if [ "x$1" = "x-y" ]; then OK="yes" fi while [ "$OK" != "y" ] && [ "$OK" != "yes" ] && [ "$OK" != "no" ]; do echo "Is this OK?" echo " enter 'yes' or 'no'" echo " or 'show' to see a list of files " read OK if [ "x$OK" = "xshow" ] || [ "x$OK" = "xs" ]; then for i in "${filelist[@]}"; do echo "$i" done fi done if [ "$OK" = "no" ]; then echo "Aborting" exit 1 fi for i in "${filelist[@]}"; do rm -rf "$i" done fi echo "" echo 'All clean!' exit 0 PK�������!� vv��v�� ��byteyears.pycnu�[�������� fc�����������@���sQ���d��d�l��Z��d��d�l�Z�d��d�l�Z�d��d�l�Td���Z�e�d�k�rM�e���n��d�S(���iN(���t���*c���� ������C���s��y �t��j�}��Wn�t�k �r)�t��j�}��n�Xt�j�d�d�k�rP�t�}�t�j�d�=nR�t�j�d�d�k�rv�t�}�t�j�d�=n,�t�j�d�d�k�r�t�}�t�j�d�=n�t�}�d �}�t�j���}�d�}�d�}�x*�t�j�d�D]�}�t �|�t �|���}�q�Wx�t�j�d�D]�}�y�|��|��}�Wn<�t��j �k �rO}�t�j �j �d �|�|�f��d�}�d �}�n�X|�r�|�|�} �|�t�} �|�| �} �t�| ��t�| ��|�} �|�j�|��Gt�t�| ���j�d ��GHq�q�Wt�j�|��d��S(���Ni���s���-ms���-cs���-ag�����v@g������8@g����� @i����s���can't stat %r: %r i���g�����@g����8~A(����(���t���ost���lstatt���AttributeErrort���statt���syst���argvt���ST_MTIMEt���ST_CTIMEt���timet���maxt���lent���errort���stderrt���writet���ST_SIZEt���floatt���ljustt���reprt���intt���rjustt���exit( ���t���statfunct���itimet ���secs_per_yeart���nowt���statust���maxlent���filenamet���stt���msgt���anytimet���sizet���aget ���byteyears(����(����s/���/usr/lib64/python2.7/Tools/scripts/byteyears.pyt���main ���sF����            !t���__main__(���R���R���R ���R���R#���t���__name__(����(����(����s/���/usr/lib64/python2.7/Tools/scripts/byteyears.pyt���<module> ���s���$  0 PK�������!�((T��T�� ��eptags.pyonu�[�������� fc�����������@���s_���d��Z��d�d�l�Z�d�d�l�Z�d�Z�e�j�e��Z�d���Z�d���Z�e�d�k�r[�e���n��d�S(���s��Create a TAGS file for Python programs, usable with GNU Emacs. usage: eptags pyfiles... The output TAGS file is usable with Emacs version 18, 19, 20. Tagged are: - functions (even inside other defs or classes) - classes eptags warns about files it cannot open. eptags will not give warnings about duplicate tags. BUGS: Because of tag duplication (methods with the same name in different classes), TAGS files are not very useful for most object-oriented python projects. iNs;���^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]c��� ������C���s ��y�t��|��d��}�Wn�t�j�j�d�|���d�SXd�}�d�}�g��}�d�}�x�|�j���}�|�sc�Pn��|�d�}�t�j�|��}�|�r�|�j�d��d�|�|�f�} �|�j�| ��|�t �| ��}�n��|�t �|��}�qM�W|�j�d�|��|�f��x�|�D]�} �|�j�| ��q�Wd�S(���sC���Append tags found in file named 'filename' to the open file 'outfp't���rs���Cannot open %s Ni����i���s���%d,%d s��� %s,%d ( ���t���opent���syst���stderrt���writet���readlinet���matchert���searcht���groupt���appendt���len( ���t���filenamet���outfpt���fpt���charnot���linenot���tagst���sizet���linet���mt���tag(����(����s,���/usr/lib64/python2.7/Tools/scripts/eptags.pyt ���treat_file���s.����    c����������C���s8���t��d�d��}��x"�t�j�d�D]�}�t�|�|���q�Wd��S(���Nt���TAGSt���wi���(���R���R���t���argvR���(���R ���R ���(����(����s,���/usr/lib64/python2.7/Tools/scripts/eptags.pyt���main2���s����t���__main__( ���t���__doc__R���t���ret���exprt���compileR���R���R���t���__name__(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/eptags.pyt���<module>���s���   PK�������!�pp������cleanfuture.pyonu�[�������� fc�����������@���s���d��Z��d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�a�d�a�d�a�d���Z�d���Z �d���Z �d�d �d�����YZ �e �d �k�r�e ���n��d�S( ���s��cleanfuture [-d][-r][-v] path ... -d Dry run. Analyze, but don't make any changes to, files. -r Recurse. Search for all .py files in subdirectories too. -v Verbose. Print informative msgs. Search Python (.py) files for future statements, and remove the features from such statements that are already mandatory in the version of Python you're using. Pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. Overwrites files in place, renaming the originals with a .bak extension. If cleanfuture finds nothing to change, the file is left alone. If cleanfuture does change a file, the changed file is a fixed-point (i.e., running cleanfuture on the resulting .py file won't change it again, at least not until you try it again with a later Python release). Limitations: You can do these things, but this tool won't help you then: + A future statement cannot be mixed with any other statement on the same physical line (separated by semicolon). + A future statement cannot contain an "as" clause. Example: Assuming you're using Python 2.2, if a file containing from __future__ import nested_scopes, generators is analyzed by cleanfuture, the line is rewritten to from __future__ import generators because nested_scopes is no longer optional in 2.2 but generators is. iNi����c����������G���sO���t��t�|���}�d�j�|��}�|�d�d�k�r;�|�d�7}�n��t�j�j�|��d��S(���Nt��� is��� (���t���mapt���strt���joint���syst���stderrt���write(���t���argst���stringst���msg(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt���errprint2���s ���� c����������C���s���d�d��l��}��y#�|��j��t�j�d�d��\�}�}�Wn!�|��j�k �rR�}�t�|��d��SXx_�|�D]W�\�}�}�|�d�k�r�t�d�7a�qZ�|�d�k�r�t�d�7a�qZ�|�d�k�rZ�t�d�7a�qZ�qZ�W|�s�t�d�t��d��Sx�|�D]�}�t �|��q�Wd��S(���Nii���t���drvs���-ds���-rs���-vs���Usage:( ���t���getoptR���t���argvt���errorR ���t���dryrunt���recurset���verboset���__doc__t���check(���R ���t���optsR���R ���t���ot���at���arg(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt���main9���s$���� #        c���������C���s��t��j�j�|���r�t��j�j�|��� r�t�r7�d�G|��GHn��t��j�|���}�xp�|�D]h�}�t��j�j�|��|��}�t�r�t��j�j�|��r�t��j�j�|�� s�|�j���j �d��rM�t �|��qM�qM�Wd��St�r�d�G|��Gd�Gn��y�t �|���}�Wn.�t �k �r}�t �d�|��t�|��f��d��SXt�|�|���}�|�j���}�|�rA|�j���n��|�j���|�rt�rmd�GHt�rmd�GHqmn��xw�|�D]o�\�}�} �} �d�|��|�d �| �d �f�GHx&�t�|�| �d ��D]�} �|�j�| �GqW| �d��k�rd �GHqtd �GH| �GqtWt�s|��d �} �t��j�j�| ��rt��j�| ��n��t��j�|��| ��t�rCd �G|��Gd�G| �GHn��t �|��d��} �|�j�| ��| �j���t�r~d�G|��GHq~qn�t�rd�GHn��d��S(���Ns���listing directorys���.pyt���checkings���...s���%r: I/O Error: %ss���changed.s+���But this is a dry run, so leaving it alone.s���%r lines %d-%di���s ���-- deleteds ���-- change to:s���.bakt���renamedt���tot���ws ���wrote news ���unchanged.(���t���ost���patht���isdirt���islinkR���t���listdirR���R���t���lowert���endswithR���t���opent���IOErrorR ���R���t ���FutureFindert���runt ���gettherestt���closeR���t���ranget���linest���Nonet���existst���removet���renameR���(���t���filet���namest���namet���fullnamet���fR ���t���fft���changedt���st���et���linet���it���bakt���g(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR���N���sd����%          R&���c�����������B���s5���e��Z�d����Z�d���Z�d���Z�d���Z�d���Z�RS(���c���������C���s1���|�|��_��|�|��_�d�|��_�g��|��_�g��|��_�d��S(���Ni����(���R4���t���fnamet���ateofR+���R6���(���t���selfR4���R=���(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt���__init__���s ����    c���������C���sH���|��j��r �d�S|��j�j���}�|�d�k�r4�d�|��_��n�|��j�j�|��|�S(���Nt����i���(���R>���R4���t���readlineR+���t���append(���R?���R9���(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt���getline���s����   c���������C���s ��t��j�}�t��j�}�t��j�}�t��j�}�t��j�}�t��j�}�|��j�}�t��j�|��j ��j �}�|���\�} �} �\�} �} �\�} �}�}�x=�| �|�|�|�f�k�r�|���\�} �} �\�} �} �\�} �}�}�q{�Wx4�| �|�k�r�|���\�} �} �\�} �} �\�} �}�}�q�Wxx=�| �|�|�|�f�k�r1|���\�} �} �\�} �} �\�} �}�}�q�W| �|�k�oG| �d�k�sNPn��| �d�}�|���\�} �} �\�} �} �\�} �}�}�| �|�k�o| �d�k�sPn��|���\�} �} �\�} �} �\�} �}�}�| �|�k�o| �d�k�sPn��|���\�} �} �\�} �} �\�} �}�}�g��}�x�| �|�k�r|�j �| ��|���\�} �} �\�} �} �\�} �}�}�| �|�k�oW| �d�k�s^Pn��|���\�} �} �\�} �} �\�} �}�}�qWd��}�| �|�k�r| �}�|���\�} �} �\�} �} �\�} �}�}�n��| �|�k �rt �d�|��j�| �|�f��g��S| �d�}�g��}�xs�|�D]k�}�t�t�|�d���}�|�d��k�r:|�j �|��q|�j���}�|�d��k�sq|�t�j�k�rdq|�j �|��qWt�|��t�|��k��r�t�|��d�k�rd��}�n@�d�}�|�d �j�|��7}�|�d��k �r|�d �|�7}�n��|�d �7}�|�j �|�|�|�f��q�q�W|�S( ���Nt���fromi���t ���__future__t���importt���,s)���Skipping file %r; can't parse line %d: %si����s���from __future__ import s���, R����s��� (���t���tokenizet���STRINGt���NLt���NEWLINEt���COMMENTt���NAMEt���OPR6���t���generate_tokensRD���t���nextRC���R,���R ���R=���t���getattrRF���t���getMandatoryReleaseR���t ���version_infot���lenR���(���R?���RJ���RK���RL���RM���RN���RO���R6���t���gett���typet���tokent���srowt���scolt���erowt���ecolR9���t ���startlinet���featurest���commentt���endlinet ���okfeaturesR4���t���objectt���released(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR'������sz����       $((( $$$ $( '        c���������C���s+���|��j��r�d�|��_�n�|��j�j���|��_�d��S(���NRA���(���R>���t���therestR4���t���read(���R?���(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR(������s����  c���������C���s���|��j��}�g��|��_��|�j���xN�|�D]F�\�}�}�}�|�d��k�rR�|��j�|�|�d�5q#�|�g�|��j�|�|�d�+q#�W|�j�|��j��|��j�r�|�j�|��j��n��d��S(���Ni���(���R6���t���reverseR,���R+���t ���writelinesRd���R���(���R?���R4���R6���R7���R8���R9���(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR�����s����     (���t���__name__t ���__module__R@���RD���R'���R(���R���(����(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR&������s ��� _ t���__main__(����( ���R���RF���RI���R���R���R���R���R���R ���R���R���R&���Rh���(����(����(����s1���/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt���<module>'���s���       8 PK�������!�C;���� ��fixheader.pyonu�[�������� fc�����������@���s8���d��d�l��Z��d���Z�d���Z�e�d�k�r4�e���n��d�S(���iNc����������C���s,���t��j�d�}��x�|��D]�}�t�|��q�Wd��S(���Ni���(���t���syst���argvt���process(���t���argst���filename(����(����s/���/usr/lib64/python2.7/Tools/scripts/fixheader.pyt���main���s����  c���������C���s��y�t��|��d��}�Wn4�t�k �rI�}�t�j�j�d�|��t�|��f��d��SX|�j���}�|�j���|�d� d�k�r�t�j�j�d�|���d��Sy�t��|��d��}�Wn4�t�k �r�}�t�j�j�d�|��t�|��f��d��SXt�j�j�d�|���d �}�xI�|��D]A�}�t�|��d �k�r*|�j ���r*|�|�j ���}�q�|�d �}�q�W|�t�_ �d �G|�GHd �G|�GHd�GHd�GHd�GHH|�j�|��Hd�GHd�GHd�GHd�Gd�|�Gd�GHd��S(���Nt���rs���%s: can't open: %s i���s���/*s!���%s does not begin with C comment t���ws���%s: can't write: %s s���Processing %s ... t���Py_i���t���_s���#ifndefs���#defines���#ifdef __cpluspluss ���extern "C" {s���#endift���}s ���#endif /*t���!s���*/( ���t���opent���IOErrorR����t���stderrt���writet���strt���readt���closet���ordt���isalnumt���uppert���stdout(���R���t���ft���msgt���datat���magict���c(����(����s/���/usr/lib64/python2.7/Tools/scripts/fixheader.pyR��� ���sD����         t���__main__(���R����R���R���t���__name__(����(����(����s/���/usr/lib64/python2.7/Tools/scripts/fixheader.pyt���<module>���s���   $ PK�������!�r%~������mailerdaemon.pynu�ȯ��������#! /usr/bin/python2.7 """mailerdaemon - classes to parse mailer-daemon messages""" import rfc822 import calendar import re import os import sys Unparseable = 'mailerdaemon.Unparseable' class ErrorMessage(rfc822.Message): def __init__(self, fp): rfc822.Message.__init__(self, fp) self.sub = '' def is_warning(self): sub = self.getheader('Subject') if not sub: return 0 sub = sub.lower() if sub.startswith('waiting mail'): return 1 if 'warning' in sub: return 1 self.sub = sub return 0 def get_errors(self): for p in EMPARSERS: self.rewindbody() try: return p(self.fp, self.sub) except Unparseable: pass raise Unparseable # List of re's or tuples of re's. # If a re, it should contain at least a group (?P<email>...) which # should refer to the email address. The re can also contain a group # (?P<reason>...) which should refer to the reason (error message). # If no reason is present, the emparse_list_reason list is used to # find a reason. # If a tuple, the tuple should contain 2 re's. The first re finds a # location, the second re is repeated one or more times to find # multiple email addresses. The second re is matched (not searched) # where the previous match ended. # The re's are compiled using the re module. emparse_list_list = [ 'error: (?P<reason>unresolvable): (?P<email>.+)', ('----- The following addresses had permanent fatal errors -----\n', '(?P<email>[^ \n].*)\n( .*\n)?'), 'remote execution.*\n.*rmail (?P<email>.+)', ('The following recipients did not receive your message:\n\n', ' +(?P<email>.*)\n(The following recipients did not receive your message:\n\n)?'), '------- Failure Reasons --------\n\n(?P<reason>.*)\n(?P<email>.*)', '^<(?P<email>.*)>:\n(?P<reason>.*)', '^(?P<reason>User mailbox exceeds allowed size): (?P<email>.+)', '^5\\d{2} <(?P<email>[^\n>]+)>\\.\\.\\. (?P<reason>.+)', '^Original-Recipient: rfc822;(?P<email>.*)', '^did not reach the following recipient\\(s\\):\n\n(?P<email>.*) on .*\n +(?P<reason>.*)', '^ <(?P<email>[^\n>]+)> \\.\\.\\. (?P<reason>.*)', '^Report on your message to: (?P<email>.*)\nReason: (?P<reason>.*)', '^Your message was not delivered to +(?P<email>.*)\n +for the following reason:\n +(?P<reason>.*)', '^ was not +(?P<email>[^ \n].*?) *\n.*\n.*\n.*\n because:.*\n +(?P<reason>[^ \n].*?) *\n', ] # compile the re's in the list and store them in-place. for i in range(len(emparse_list_list)): x = emparse_list_list[i] if type(x) is type(''): x = re.compile(x, re.MULTILINE) else: xl = [] for x in x: xl.append(re.compile(x, re.MULTILINE)) x = tuple(xl) del xl emparse_list_list[i] = x del x del i # list of re's used to find reasons (error messages). # if a string, "<>" is replaced by a copy of the email address. # The expressions are searched for in order. After the first match, # no more expressions are searched for. So, order is important. emparse_list_reason = [ r'^5\d{2} <>\.\.\. (?P<reason>.*)', '<>\.\.\. (?P<reason>.*)', re.compile(r'^<<< 5\d{2} (?P<reason>.*)', re.MULTILINE), re.compile('===== stderr was =====\nrmail: (?P<reason>.*)'), re.compile('^Diagnostic-Code: (?P<reason>.*)', re.MULTILINE), ] emparse_list_from = re.compile('^From:', re.IGNORECASE|re.MULTILINE) def emparse_list(fp, sub): data = fp.read() res = emparse_list_from.search(data) if res is None: from_index = len(data) else: from_index = res.start(0) errors = [] emails = [] reason = None for regexp in emparse_list_list: if type(regexp) is type(()): res = regexp[0].search(data, 0, from_index) if res is not None: try: reason = res.group('reason') except IndexError: pass while 1: res = regexp[1].match(data, res.end(0), from_index) if res is None: break emails.append(res.group('email')) break else: res = regexp.search(data, 0, from_index) if res is not None: emails.append(res.group('email')) try: reason = res.group('reason') except IndexError: pass break if not emails: raise Unparseable if not reason: reason = sub if reason[:15] == 'returned mail: ': reason = reason[15:] for regexp in emparse_list_reason: if type(regexp) is type(''): for i in range(len(emails)-1,-1,-1): email = emails[i] exp = re.compile(re.escape(email).join(regexp.split('<>')), re.MULTILINE) res = exp.search(data) if res is not None: errors.append(' '.join((email.strip()+': '+res.group('reason')).split())) del emails[i] continue res = regexp.search(data) if res is not None: reason = res.group('reason') break for email in emails: errors.append(' '.join((email.strip()+': '+reason).split())) return errors EMPARSERS = [emparse_list, ] def sort_numeric(a, b): a = int(a) b = int(b) if a < b: return -1 elif a > b: return 1 else: return 0 def parsedir(dir, modify): os.chdir(dir) pat = re.compile('^[0-9]*$') errordict = {} errorfirst = {} errorlast = {} nok = nwarn = nbad = 0 # find all numeric file names and sort them files = filter(lambda fn, pat=pat: pat.match(fn) is not None, os.listdir('.')) files.sort(sort_numeric) for fn in files: # Lets try to parse the file. fp = open(fn) m = ErrorMessage(fp) sender = m.getaddr('From') print '%s\t%-40s\t'%(fn, sender[1]), if m.is_warning(): fp.close() print 'warning only' nwarn = nwarn + 1 if modify: os.rename(fn, ','+fn) ## os.unlink(fn) continue try: errors = m.get_errors() except Unparseable: print '** Not parseable' nbad = nbad + 1 fp.close() continue print len(errors), 'errors' # Remember them for e in errors: try: mm, dd = m.getdate('date')[1:1+2] date = '%s %02d' % (calendar.month_abbr[mm], dd) except: date = '??????' if not errordict.has_key(e): errordict[e] = 1 errorfirst[e] = '%s (%s)' % (fn, date) else: errordict[e] = errordict[e] + 1 errorlast[e] = '%s (%s)' % (fn, date) fp.close() nok = nok + 1 if modify: os.rename(fn, ','+fn) ## os.unlink(fn) print '--------------' print nok, 'files parsed,',nwarn,'files warning-only,', print nbad,'files unparseable' print '--------------' list = [] for e in errordict.keys(): list.append((errordict[e], errorfirst[e], errorlast[e], e)) list.sort() for num, first, last, e in list: print '%d %s - %s\t%s' % (num, first, last, e) def main(): modify = 0 if len(sys.argv) > 1 and sys.argv[1] == '-d': modify = 1 del sys.argv[1] if len(sys.argv) > 1: for folder in sys.argv[1:]: parsedir(folder, modify) else: parsedir('/ufs/jack/Mail/errorsinbox', modify) if __name__ == '__main__' or sys.argv[0] == __name__: main() PK�������!�GiA[���� ��checkpyc.pycnu�[�������� fc�����������@���s`���d��d�l��Z��d��d�l�Z�d��d�l�m�Z�d��d�l�Z�d���Z�d���Z�e�d�k�r\�e���n��d�S(���iN(���t���ST_MTIMEc���� ������C���sg��d�}��d�}�t��j�d�rT�t��j�d�d�k�r5�d�}�qT�t��j�d�d�k�rT�d�}��qT�n��t�j���}�|��sx�d�Gt�|��GHn��xt��j�D]}�y�t�j�|��}�Wn&�t�j�k �r�d�Gt�|��GHq�n�X|��s�d�Gt�|��Gd�GHn��|�j ���xr|�D]j}�|�d �d �k�r�t�j�j �|�|��}�y�t�j �|��}�Wn&�t�j�k �rWd �Gt�|��GHq�n�X|�rtd �Gt�|��Gd�GHn��|�d �}�y�t �|�d��}�Wn#�t �k �rd�Gt�|��GHq�n�X|�j�d��} �|�j�d��} �|�j���| �|�k�r�d�Gt�|��GHq�n��t�| ��} �| �d�k�s$| �d�k�r6d�Gt�|��GHq[| �|�t�k�r[d�Gt�|��GHq[q�q�Wq�Wd��S(���Ni����i���s���-vs���-ss���Using MAGIC words���Cannot list directorys ���Checking s���...is���.pys ���Cannot statt���Checkt���ct���rs ���Cannot openi���s���Bad MAGIC word in ".pyc" fileis���Bad ".pyc" files���Out-of-date ".pyc" file(���t���syst���argvt���impt ���get_magict���reprt���patht���ost���listdirt���errort���sortt���joint���statt���opent���IOErrort���readt���closet���get_longR����( ���t���silentt���verboset���MAGICt���dirnamet���namest���namet���stt���name_ct���ft ���magic_strt ���mtime_strt���mtime(����(����s.���/usr/lib64/python2.7/Tools/scripts/checkpyc.pyt���main ���s`����            c���������C���sZ���t��|���d�k�r�d�St�|��d��t�|��d��d�>t�|��d��d�>t�|��d��d �>S( ���Ni���ii����i���i���i���i���i���i���(���t���lent���ord(���t���s(����(����s.���/usr/lib64/python2.7/Tools/scripts/checkpyc.pyR���<���s����t���__main__(���R���R ���R���R����R���R!���R���t���__name__(����(����(����s.���/usr/lib64/python2.7/Tools/scripts/checkpyc.pyt���<module>���s���    2  PK�������!�Fcf��f�� ��pickle2db.pynu�ȯ��������#! /usr/bin/python2.7 """ Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile Read the given picklefile as a series of key/value pairs and write to a new database. If the database already exists, any contents are deleted. The optional flags indicate the type of the output database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for read access. If no pickle file is named, the pickle input is read from standard input. Note that recno databases can only contain integer keys, so you can't dump a hash or btree database using db2pickle.py and reconstitute it to a recno database with %(prog)s unless your keys are integers. """ import getopt try: import bsddb except ImportError: bsddb = None try: import dbm except ImportError: dbm = None try: import gdbm except ImportError: gdbm = None try: import anydbm except ImportError: anydbm = None import sys try: import cPickle as pickle except ImportError: import pickle prog = sys.argv[0] def usage(): sys.stderr.write(__doc__ % globals()) def main(args): try: opts, args = getopt.getopt(args, "hbrdag", ["hash", "btree", "recno", "dbm", "anydbm", "gdbm"]) except getopt.error: usage() return 1 if len(args) == 0 or len(args) > 2: usage() return 1 elif len(args) == 1: pfile = sys.stdin dbfile = args[0] else: try: pfile = open(args[0], 'rb') except IOError: sys.stderr.write("Unable to open %s\n" % args[0]) return 1 dbfile = args[1] dbopen = None for opt, arg in opts: if opt in ("-h", "--hash"): try: dbopen = bsddb.hashopen except AttributeError: sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-b", "--btree"): try: dbopen = bsddb.btopen except AttributeError: sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-r", "--recno"): try: dbopen = bsddb.rnopen except AttributeError: sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-a", "--anydbm"): try: dbopen = anydbm.open except AttributeError: sys.stderr.write("anydbm module unavailable.\n") return 1 elif opt in ("-g", "--gdbm"): try: dbopen = gdbm.open except AttributeError: sys.stderr.write("gdbm module unavailable.\n") return 1 elif opt in ("-d", "--dbm"): try: dbopen = dbm.open except AttributeError: sys.stderr.write("dbm module unavailable.\n") return 1 if dbopen is None: if bsddb is None: sys.stderr.write("bsddb module unavailable - ") sys.stderr.write("must specify dbtype.\n") return 1 else: dbopen = bsddb.hashopen try: db = dbopen(dbfile, 'c') except bsddb.error: sys.stderr.write("Unable to open %s. " % dbfile) sys.stderr.write("Check for format or version mismatch.\n") return 1 else: for k in db.keys(): del db[k] while 1: try: (key, val) = pickle.load(pfile) except EOFError: break db[key] = val db.close() pfile.close() return 0 if __name__ == "__main__": sys.exit(main(sys.argv[1:])) PK�������!�R���� ��pysource.pycnu�[�������� fc�����������@���s���d��Z��d�Z�d�d�d�d�g�Z�d�d�l�Z�d�d�l�Z�e�j�d��Z�e�Z�d ���Z �d ���Z �d ���Z �d ���Z �d ���Z �e �d�d��Z�e�d�k�r�x�e�d�g��D] �Z�e�GHq�Wd�GHx%�e�d�g�d�e �D] �Z�e�GHq�Wn��d�S(���sC��List python source files. There are three functions to check whether a file is a Python source, listed here with increasing complexity: - has_python_ext() checks whether a file name ends in '.py[w]'. - look_like_python() checks whether the file is not binary and either has the '.py[w]' extension or the first line contains the word 'python'. - can_be_compiled() checks whether the file can be compiled by compile(). The file also must be of appropriate size - not bigger than a megabyte. walk_python_files() recursively lists all Python files under the given directories. s���Oleg Broytmann, Georg Brandlt���has_python_extt���looks_like_pythont���can_be_compiledt���walk_python_filesiNs ���[�--]c���������C���s���t��r�|��GHn��d��S(���N(���t���debug(���t���msg(����(����s.���/usr/lib64/python2.7/Tools/scripts/pysource.pyt ���print_debug���s�����c���������C���s���y�t��j�|���j�}�Wn(�t�k �r@�}�t�d�|��|�f��d��SX|�d�k�re�t�d�|��|�f��d��Sy�t�|��d��SWn(�t�k �r�}�t�d�|��|�f��d��SXd��S(���Ns���%s: permission denied: %si���s!���%s: the file is too big: %d bytest���rUs���%s: access denied: %si���(���t���ost���statt���st_sizet���OSErrorR���t���Nonet���opent���IOError(���t���fullpatht���sizet���err(����(����s.���/usr/lib64/python2.7/Tools/scripts/pysource.pyt���_open!���s���� c���������C���s���|��j��d��p�|��j��d��S(���Ns���.pys���.pyw(���t���endswith(���R���(����(����s.���/usr/lib64/python2.7/Tools/scripts/pysource.pyR����2���s����c���������C���s���t��|���}�|�d��k�r�t�S|�j���}�|�j���t�j�|��rS�t�d�|���t�S|��j�d��sq�|��j�d��ru�t �Sd�|�k�r�t �St�S(���Ns���%s: appears to be binarys���.pys���.pywt���python( ���R���R ���t���Falset���readlinet���closet ���binary_ret���searchR���R���t���True(���R���t���infilet���line(����(����s.���/usr/lib64/python2.7/Tools/scripts/pysource.pyR���5���s����     c���������C���su���t��|���}�|�d��k�r�t�S|�j���}�|�j���y�t�|�|��d��Wn(�t�k �rp�}�t�d�|��|�f��t�SXt�S(���Nt���execs���%s: cannot compile: %s( ���R���R ���R���t���readR���t���compilet ���ExceptionR���R���(���R���R���t���codeR���(����(����s.���/usr/lib64/python2.7/Tools/scripts/pysource.pyR���J���s����    c��� ������c���s"��|�d�k�r�g��}�n��x|��D]�}�t�d�|��t�j�j�|��rY�|�|��r|�Vqq�t�j�j�|��rt�d��x�t�j�|��D]�\�}�}�}�x*�|�D]"�}�|�|�k�r�|�j�|��q�q�WxE�|�D]=�}�t�j�j�|�|��} �t�d�| ��|�| ��r�| �Vq�q�Wq�Wq�t�d��q�Wd�S(���s^�� Recursively yield all Python source files below the given paths. paths: a list of files and/or directories to be checked. is_python: a function that takes a file name and checks whether it is a Python source file exclude_dirs: a list of directory base names that should be excluded in the search s ���testing: %ss��� it is a directorys��� unknown typeN( ���R ���R���R���t���patht���isfilet���isdirt���walkt���removet���join( ���t���pathst ���is_pythont ���exclude_dirsR"���t���dirpatht���dirnamest ���filenamest���excludet���filenameR���(����(����s.���/usr/lib64/python2.7/Tools/scripts/pysource.pyR���[���s&����          t���__main__t���.s ���----------R)���(���t���__doc__t ���__author__t���__all__R���t���reR���R���R���R���R���R���R����R���R���R ���R���t���__name__R���(����(����(����s.���/usr/lib64/python2.7/Tools/scripts/pysource.pyt���<module>���s"���     !  PK�������!� k������rgrep.pynu�ȯ��������#! /usr/bin/python2.7 """Reverse grep. Usage: rgrep [-i] pattern file """ import sys import re import getopt def main(): bufsize = 64*1024 reflags = 0 opts, args = getopt.getopt(sys.argv[1:], "i") for o, a in opts: if o == '-i': reflags = reflags | re.IGNORECASE if len(args) < 2: usage("not enough arguments") if len(args) > 2: usage("exactly one file argument required") pattern, filename = args try: prog = re.compile(pattern, reflags) except re.error, msg: usage("error in regular expression: %s" % str(msg)) try: f = open(filename) except IOError, msg: usage("can't open %s: %s" % (repr(filename), str(msg)), 1) f.seek(0, 2) pos = f.tell() leftover = None while pos > 0: size = min(pos, bufsize) pos = pos - size f.seek(pos) buffer = f.read(size) lines = buffer.split("\n") del buffer if leftover is None: if not lines[-1]: del lines[-1] else: lines[-1] = lines[-1] + leftover if pos > 0: leftover = lines[0] del lines[0] else: leftover = None lines.reverse() for line in lines: if prog.search(line): print line def usage(msg, code=2): sys.stdout = sys.stderr print msg print __doc__ sys.exit(code) if __name__ == '__main__': main() PK�������!�+���� ��pysource.pynu�ȯ��������#! /usr/bin/python2.7 """\ List python source files. There are three functions to check whether a file is a Python source, listed here with increasing complexity: - has_python_ext() checks whether a file name ends in '.py[w]'. - look_like_python() checks whether the file is not binary and either has the '.py[w]' extension or the first line contains the word 'python'. - can_be_compiled() checks whether the file can be compiled by compile(). The file also must be of appropriate size - not bigger than a megabyte. walk_python_files() recursively lists all Python files under the given directories. """ __author__ = "Oleg Broytmann, Georg Brandl" __all__ = ["has_python_ext", "looks_like_python", "can_be_compiled", "walk_python_files"] import os, re binary_re = re.compile('[\x00-\x08\x0E-\x1F\x7F]') debug = False def print_debug(msg): if debug: print msg def _open(fullpath): try: size = os.stat(fullpath).st_size except OSError, err: # Permission denied - ignore the file print_debug("%s: permission denied: %s" % (fullpath, err)) return None if size > 1024*1024: # too big print_debug("%s: the file is too big: %d bytes" % (fullpath, size)) return None try: return open(fullpath, 'rU') except IOError, err: # Access denied, or a special file - ignore it print_debug("%s: access denied: %s" % (fullpath, err)) return None def has_python_ext(fullpath): return fullpath.endswith(".py") or fullpath.endswith(".pyw") def looks_like_python(fullpath): infile = _open(fullpath) if infile is None: return False line = infile.readline() infile.close() if binary_re.search(line): # file appears to be binary print_debug("%s: appears to be binary" % fullpath) return False if fullpath.endswith(".py") or fullpath.endswith(".pyw"): return True elif "python" in line: # disguised Python script (e.g. CGI) return True return False def can_be_compiled(fullpath): infile = _open(fullpath) if infile is None: return False code = infile.read() infile.close() try: compile(code, fullpath, "exec") except Exception, err: print_debug("%s: cannot compile: %s" % (fullpath, err)) return False return True def walk_python_files(paths, is_python=looks_like_python, exclude_dirs=None): """\ Recursively yield all Python source files below the given paths. paths: a list of files and/or directories to be checked. is_python: a function that takes a file name and checks whether it is a Python source file exclude_dirs: a list of directory base names that should be excluded in the search """ if exclude_dirs is None: exclude_dirs=[] for path in paths: print_debug("testing: %s" % path) if os.path.isfile(path): if is_python(path): yield path elif os.path.isdir(path): print_debug(" it is a directory") for dirpath, dirnames, filenames in os.walk(path): for exclude in exclude_dirs: if exclude in dirnames: dirnames.remove(exclude) for filename in filenames: fullpath = os.path.join(dirpath, filename) print_debug("testing: %s" % fullpath) if is_python(fullpath): yield fullpath else: print_debug(" unknown type") if __name__ == "__main__": # Two simple examples/tests for fullpath in walk_python_files(['.']): print fullpath print "----------" for fullpath in walk_python_files(['.'], is_python=can_be_compiled): print fullpath PK�������!�yIo������win_add2path.pycnu�[�������� fc�����������@���s}���d��Z��d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�e�j�Z�d�Z�d�Z�d�Z �d���Z �d���Z �e �d�k�ry�e ���n��d�S( ���s��Add Python to the search path on Windows This is a simple script to add Python to the Windows search path. It modifies the current user (HKCU) tree of the registry. Copyright (c) 2008 by Christian Heimes <christian@cheimes.de> Licensed to PSF under a Contributor Agreement. iNt ���Environmentt���PATHu���%PATH%c���� ��� ���C���sg��t��j�j�t��j�j�t�j���}��t��j�j�|��d��}�t��j�d�}�t�t �d��r�t �j �j �|�d��}�t��j�j�|�d��}�n�d��}�t �j�t�t���}�y�t �j�|�t��d�}�Wn�t�k �r�t�}�n�X|�g�}�xK�|��|�|�f�D]:�}�|�r�|�|�k�r�t��j�j�|��r�|�j�|��q�q�Wt��j�j�|��}�t �j�|�t�d�t �j�|��|�|�f�SWd��QXd��S(���Nt���Scriptst���APPDATAt ���USER_SITEs ���%APPDATA%i����(���t���ost���patht���dirnamet���normpatht���syst ���executablet���joint���environt���hasattrt���siteR���t���replacet���Nonet���_winregt ���CreateKeyt���HKCUt���ENVt ���QueryValueExR���t ���WindowsErrort���DEFAULTt���isdirt���appendt���pathsept ���SetValueExt ���REG_EXPAND_SZ( ���t ���pythonpatht���scriptst���appdatat���userpatht ���userscriptst���keyt���envpatht���pathsR���(����(����s2���/usr/lib64/python2.7/Tools/scripts/win_add2path.pyt���modify���s&����!    $c����������C���s`���t����\�}��}�t�|���d�k�r;�d�GHd�j�|��d��GHn�d�GHd�|�GHd�GHt�j�|��GHd��S(���Ni���s���Path(s) added:s��� s���No path was addeds��� PATH is now: %s s ���Expanded:(���R%���t���lenR ���R���t���ExpandEnvironmentStrings(���R$���R#���(����(����s2���/usr/lib64/python2.7/Tools/scripts/win_add2path.pyt���main-���s���� t���__main__( ���t���__doc__R ���R���R���R���t���HKEY_CURRENT_USERR���R���R���R���R%���R(���t���__name__(����(����(����s2���/usr/lib64/python2.7/Tools/scripts/win_add2path.pyt���<module>���s���       PK�������!�j3%q���� ��patchcheck.pynu�ȯ��������#! /usr/bin/python2.7 import re import sys import shutil import os.path import subprocess import sysconfig import reindent import untabify # Excluded directories which are copies of external libraries: # don't check their coding style EXCLUDE_DIRS = [os.path.join('Modules', '_ctypes', 'libffi'), os.path.join('Modules', '_ctypes', 'libffi_osx'), os.path.join('Modules', '_ctypes', 'libffi_msvc'), os.path.join('Modules', 'expat'), os.path.join('Modules', 'zlib')] SRCDIR = sysconfig.get_config_var('srcdir') def n_files_str(count): """Return 'N file(s)' with the proper plurality on 'file'.""" return "{} file{}".format(count, "s" if count != 1 else "") def status(message, modal=False, info=None): """Decorator to output status info to stdout.""" def decorated_fxn(fxn): def call_fxn(*args, **kwargs): sys.stdout.write(message + ' ... ') sys.stdout.flush() result = fxn(*args, **kwargs) if not modal and not info: print "done" elif info: print info(result) else: print "yes" if result else "NO" return result return call_fxn return decorated_fxn def get_git_branch(): """Get the symbolic name for the current git branch""" cmd = "git rev-parse --abbrev-ref HEAD".split() try: return subprocess.check_output(cmd, stderr=subprocess.PIPE) except subprocess.CalledProcessError: return None def get_git_upstream_remote(): """Get the remote name to use for upstream branches Uses "upstream" if it exists, "origin" otherwise """ cmd = "git remote get-url upstream".split() try: subprocess.check_output(cmd, stderr=subprocess.PIPE) except subprocess.CalledProcessError: return "origin" return "upstream" @status("Getting base branch for PR", info=lambda x: x if x is not None else "not a PR branch") def get_base_branch(): if not os.path.exists(os.path.join(SRCDIR, '.git')): # Not a git checkout, so there's no base branch return None version = sys.version_info if version.releaselevel == 'alpha': base_branch = "master" else: base_branch = "{0.major}.{0.minor}".format(version) this_branch = get_git_branch() if this_branch is None or this_branch == base_branch: # Not on a git PR branch, so there's no base branch return None upstream_remote = get_git_upstream_remote() return upstream_remote + "/" + base_branch @status("Getting the list of files that have been added/changed", info=lambda x: n_files_str(len(x))) def changed_files(base_branch=None): """Get the list of changed or added files from git.""" if os.path.exists(os.path.join(SRCDIR, '.git')): # We just use an existence check here as: # directory = normal git checkout/clone # file = git worktree directory if base_branch: cmd = 'git diff --name-status ' + base_branch else: cmd = 'git status --porcelain' filenames = [] st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) try: for line in st.stdout: line = line.decode().rstrip() status_text, filename = line.split(None, 1) status = set(status_text) # modified, added or unmerged files if not status.intersection('MAU'): continue if ' -> ' in filename: # file is renamed filename = filename.split(' -> ', 2)[1].strip() filenames.append(filename) finally: st.stdout.close() else: sys.exit('need a git checkout to get modified files') filenames2 = [] for filename in filenames: # Normalize the path to be able to match using .startswith() filename = os.path.normpath(filename) if any(filename.startswith(path) for path in EXCLUDE_DIRS): # Exclude the file continue filenames2.append(filename) return filenames2 def report_modified_files(file_paths): count = len(file_paths) if count == 0: return n_files_str(count) else: lines = ["{}:".format(n_files_str(count))] for path in file_paths: lines.append(" {}".format(path)) return "\n".join(lines) @status("Fixing whitespace", info=report_modified_files) def normalize_whitespace(file_paths): """Make sure that the whitespace for .py files have been normalized.""" reindent.makebackup = False # No need to create backups. fixed = [] for path in (x for x in file_paths if x.endswith('.py')): if reindent.check(os.path.join(SRCDIR, path)): fixed.append(path) return fixed @status("Fixing C file whitespace", info=report_modified_files) def normalize_c_whitespace(file_paths): """Report if any C files """ fixed = [] for path in file_paths: abspath = os.path.join(SRCDIR, path) with open(abspath, 'r') as f: if '\t' not in f.read(): continue untabify.process(abspath, 8, verbose=False) fixed.append(path) return fixed ws_re = re.compile(br'\s+(\r?\n)$') @status("Fixing docs whitespace", info=report_modified_files) def normalize_docs_whitespace(file_paths): fixed = [] for path in file_paths: abspath = os.path.join(SRCDIR, path) try: with open(abspath, 'rb') as f: lines = f.readlines() new_lines = [ws_re.sub(br'\1', line) for line in lines] if new_lines != lines: shutil.copyfile(abspath, abspath + '.bak') with open(abspath, 'wb') as f: f.writelines(new_lines) fixed.append(path) except Exception as err: print 'Cannot fix %s: %s' % (path, err) return fixed @status("Docs modified", modal=True) def docs_modified(file_paths): """Report if any file in the Doc directory has been changed.""" return bool(file_paths) @status("Misc/ACKS updated", modal=True) def credit_given(file_paths): """Check if Misc/ACKS has been changed.""" return os.path.join('Misc', 'ACKS') in file_paths @status("Misc/NEWS.d updated with `blurb`", modal=True) def reported_news(file_paths): """Check if Misc/NEWS.d has been changed.""" return any(p.startswith(os.path.join('Misc', 'NEWS.d', 'next')) for p in file_paths) def main(): base_branch = get_base_branch() file_paths = changed_files(base_branch) python_files = [fn for fn in file_paths if fn.endswith('.py')] c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))] doc_files = [fn for fn in file_paths if fn.startswith('Doc') and fn.endswith(('.rst', '.inc'))] misc_files = {p for p in file_paths if p.startswith('Misc')} # PEP 8 whitespace rules enforcement. normalize_whitespace(python_files) # C rules enforcement. normalize_c_whitespace(c_files) # Doc whitespace enforcement. normalize_docs_whitespace(doc_files) # Docs updated. docs_modified(doc_files) # Misc/ACKS changed. credit_given(misc_files) # Misc/NEWS changed. reported_news(misc_files) # Test suite run and passed. if python_files or c_files: end = " and check for refleaks?" if c_files else "?" print print "Did you run the test suite" + end if __name__ == '__main__': main() PK�������!�oHq]��]�� ��classfix.pycnu�[�������� fc�����������@���s���d��d�l��Z��d��d�l�Z�d��d�l�Z�d��d�l�Te��j�j�Z�e�Z�e��j�j�Z �d���Z �e�j �d��Z �d���Z �d���Z�d���Z�d�Z�e�j �e��Z�d �Z�e�j �e��Z�d ���Z�e�d �k�r�e ���n��d�S( ���iN(���t���*c����������C���s���d�}��t��j�d�s<�t�d�t��j�d�d��t��j�d��n��x}�t��j�d�D]n�}�t�j�j�|��rz�t�|��r�d�}��q�qJ�t�j�j�|��r�t�|�d��d�}��qJ�t �|��rJ�d�}��qJ�qJ�Wt��j�|���d��S(���Ni����i���s���usage: s��� file-or-directory ... i���s"���: will not process symbolic links ( ���t���syst���argvt���errt���exitt���ost���patht���isdirt ���recursedownt���islinkt���fix(���t���badt���arg(����(����s.���/usr/lib64/python2.7/Tools/scripts/classfix.pyt���main)���s����  �   � s���^[a-zA-Z0-9_]+\.py$c���������C���s���t��j�|���d�k�S(���Ni����(���t ���ispythonprogt���match(���t���name(����(����s.���/usr/lib64/python2.7/Tools/scripts/classfix.pyt���ispython9���s����c���������C���s1��t��d�|��f��d�}�y�t�j�|���}�Wn+�t�j�k �rW�}�t�d�|��|�f��d�SX|�j���g��}�x�|�D]�}�|�t�j�t�j�f�k�r�qo�n��t�j�j �|��|��}�t�j�j �|��r�qo�t�j�j �|��r�|�j �|��qo�t �|��ro�t�|��rd�}�qqo�qo�Wx#�|�D]�}�t�|��rd�}�qqW|�S(���Ns���recursedown(%r) i����s���%s: cannot list directory: %r i���(���t���dbgR���t���listdirt���errorR���t���sortt���curdirt���pardirR���t���joinR ���R���t���appendR���R ���R���(���t���dirnameR ���t���namest���msgt���subdirsR���t���fullname(����(����s.���/usr/lib64/python2.7/Tools/scripts/classfix.pyR���<���s0����  ��  �  � c��� ������C���s��y�t��|��d��}�Wn(�t�k �r=�}�t�d�|��|�f��d�SXt�j�j�|���\�}�}�t�j�j�|�d�|��}�d��}�d�}�xG|�j���}�|�s�Pn��|�d�}�x>�|�d�d�k�r�|�j���} �| �s�Pn��|�| �}�|�d�}�q�Wt �|��} �| �|�k�r|�d��k�rry�t��|�d��}�Wn2�t�k �rJ}�|�j ���t�d �|�|�f��d�SX|�j �d��d�}�t �|��d ��q~�n��t �t �|��d ��t �d �|��t �d �| ��n��|�d��k �r~�|�j�| ��q~�q~�W|�j ���|�sd�Sy+�t�j�|���} �t�j�|�| �t�d�@�Wn*�t�j�k �r0}�t�d�|�|�f��n�Xy�t�j�|��|��d��Wn*�t�j�k �ru}�t�d�|��|�f��n�Xy�t�j�|�|���Wn+�t�j�k �r}�t�d�|��|�f��d�SXd�S(���Nt���rs���%s: cannot open: %r i���t���@i����is���\ t���ws���%s: cannot create: %r s���: s��� s���< s���> i��s���%s: warning: chmod failed (%r) t���~s ���%s: warning: backup failed (%r) s���%s: rename failed (%r) (���t���opent���IOErrorR���R���R���t���splitR���t���Nonet���readlinet���fixlinet���closet���seekt���rept���reprt���writet���statt���chmodt���ST_MODER���t���rename( ���t���filenamet���fR���t���headt���tailt���tempnamet���gt���linenot���linet���nextlinet���newlinet���statbuf(����(����s.���/usr/lib64/python2.7/Tools/scripts/classfix.pyR ���R���sp���� �  �        �s-���^([ ]*class +[a-zA-Z0-9_]+) *( *) *((=.*)?):s���^ *(.*) *( *) *$c���������C���s��t��j�|���d�k��r�|��St��j�d� \�\�}�}�\�}�}�\�}�}�|��|� }�|��|�}�|�|�k�rm�|�d�|�S|��|�d�|�!} �| �j�d��} �x^�t�t�| ���D]J�} �t�j�| �| ��d�k�r�t�j�d�\�} �} �| �| �| �| �!| �| �<q�q�Wd�j�| ��} �|�d�| �d�|�S( ���Ni����i���t���:i���t���,s���, t���(s���):(���t ���classprogR���t���regsR%���t���ranget���lent���baseprogR���(���R9���t���a0t���b0t���a1t���b1t���a2t���b2R4���R5���t���basepartt���basest���it���x1t���y1(����(����s.���/usr/lib64/python2.7/Tools/scripts/classfix.pyR(������s����(    t���__main__(���R���t���reR���R.���t���stderrR-���R���R���t���stdoutR+���R ���t���compileR���R���R���R ���t ���classexprR@���t���baseexprRD���R(���t���__name__(����(����(����s.���/usr/lib64/python2.7/Tools/scripts/classfix.pyt���<module> ���s$���          E  PK�������!� ]������hotshotmain.pynu�ȯ��������#! /usr/bin/python2.7 # -*- coding: iso-8859-1 -*- """ Run a Python script under hotshot's control. Adapted from a posting on python-dev by Walter Drwald usage %prog [ %prog args ] filename [ filename args ] Any arguments after the filename are used as sys.argv for the filename. """ import sys import optparse import os import hotshot import hotshot.stats PROFILE = "hotshot.prof" def run_hotshot(filename, profile, args): prof = hotshot.Profile(profile) sys.path.insert(0, os.path.dirname(filename)) sys.argv = [filename] + args prof.run("execfile(%r)" % filename) prof.close() stats = hotshot.stats.load(profile) stats.sort_stats("time", "calls") # print_stats uses unadorned print statements, so the only way # to force output to stderr is to reassign sys.stdout temporarily save_stdout = sys.stdout sys.stdout = sys.stderr stats.print_stats() sys.stdout = save_stdout return 0 def main(args): parser = optparse.OptionParser(__doc__) parser.disable_interspersed_args() parser.add_option("-p", "--profile", action="store", default=PROFILE, dest="profile", help='Specify profile file to use') (options, args) = parser.parse_args(args) if len(args) == 0: parser.print_help("missing script to execute") return 1 filename = args[0] return run_hotshot(filename, options.profile, args[1:]) if __name__ == "__main__": sys.exit(main(sys.argv[1:])) PK�������!����� ��ptags.pycnu�[�������� fc�����������@���sk���d��d�l��Z��d��d�l�Z�d��d�l�Z�g��Z�d���Z�d�Z�e�j�e��Z�d���Z�e �d�k�rg�e���n��d�S(���iNc����������C���sl���t��j�d�}��x�|��D]�}�t�|��q�Wt�rh�t�d�d��}�t�j���x�t�D]�}�|�j�|��qN�Wn��d��S(���Ni���t���tagst���w(���t���syst���argvt ���treat_fileR����t���opent���sortt���write(���t���argst���filenamet���fpt���s(����(����s+���/usr/lib64/python2.7/Tools/scripts/ptags.pyt���main���s����    �s/���^[ ]*(def|class)[ ]+([a-zA-Z0-9_]+)[ ]*[:\(]c���������C���s��y�t��|��d��}�Wn�t�j�j�d�|���d��SXt�j�j�|���}�|�d�d�k�ra�|�d� }�n��|�d�|��d�d�}�t�j�|��xw�|�j ���}�|�s�Pn��t �j �|��}�|�r�|�j �d��}�|�j �d��}�|�d�|��d �|�d �}�t�j�|��q�q�Wd��S( ���Nt���rs���Cannot open %s is���.pys��� s���1 i����i���s��� /^s���/ ( ���R���R���t���stderrR���t���ost���patht���basenameR����t���appendt���readlinet���matchert���matcht���group(���R ���R ���t���baseR ���t���linet���mt���contentt���name(����(����s+���/usr/lib64/python2.7/Tools/scripts/ptags.pyR������s(����   t���__main__( ���R���t���reR���R����R ���t���exprt���compileR���R���t���__name__(����(����(����s+���/usr/lib64/python2.7/Tools/scripts/ptags.pyt���<module> ���s���$   PK�������!�/��/�� ��untabify.pyonu�[�������� fc�����������@���sY���d��Z��d�d�l�Z�d�d�l�Z�d�d�l�Z�d���Z�e�d��Z�e�d�k�rU�e���n��d�S(���sJ���Replace tabs with spaces in argument files. Print names of changed files.iNc����������C���s���d�}��y8�t��j��t�j�d�d��\�}�}�|�s=�t��j�d��n��Wn0�t��j�k �rp�}�|�GHd�Gt�j�d�Gd�GHd��SXx/�|�D]'�\�}�}�|�d�k�rx�t�|��}��qx�qx�Wx�|�D]�}�t�|�|���q�Wd��S( ���Ni���i���s���t:s#���At least one file argument requireds���usage:i����s���[-t tabwidth] file ...s���-t(���t���getoptt���syst���argvt���errort���intt���process(���t���tabsizet���optst���argst���msgt���optnamet���optvaluet���filename(����(����s.���/usr/lib64/python2.7/Tools/scripts/untabify.pyt���main ���s����  c���������C���s���y&�t��|���}�|�j���}�|�j���Wn#�t�k �rK�}�d�|��|�f�GHd��SX|�j�|��}�|�|�k�rk�d��S|��d�}�y�t�j�|��Wn�t�j�k �r�n�Xy�t�j�|��|��Wn�t�j�k �r�n�Xt��|��d���}�|�j �|��Wd��QX|�r�|��GHn��d��S(���Ns���%r: I/O error: %st���~t���w( ���t���opent���readt���closet���IOErrort ���expandtabst���ost���unlinkR���t���renamet���write(���R ���R���t���verboset���ft���textR ���t���newtextt���backup(����(����s.���/usr/lib64/python2.7/Tools/scripts/untabify.pyR������s.����    t���__main__(���t���__doc__R���R���R����R ���t���TrueR���t���__name__(����(����(����s.���/usr/lib64/python2.7/Tools/scripts/untabify.pyt���<module>���s���      PK�������!�l:E���� ��google.pyonu�[�������� fc�����������@���s;���d��d�l��Z��d��d�l�Z�d���Z�e�d�k�r7�e���n��d�S(���iNc����������C���s���t��j�d�}��|��s'�d�t��j�d�GHd��Sg��}�xg�|��D]_�}�d�|�k�r[�|�j�d�d��}�n��d�|�k�rt�d�|�}�n��|�j�d�d��}�|�j�|��q4�Wd�j�|��}�d�|�}�t�j�|��d��S( ���Ni���s���Usage: %s querystringi����t���+s���%2Bt��� s���"%s"s!���http://www.google.com/search?q=%s(���t���syst���argvt���replacet���appendt���joint ���webbrowsert���open(���t���argst���listt���argt���st���url(����(����s,���/usr/lib64/python2.7/Tools/scripts/google.pyt���main���s����      t���__main__(���R���R���R���t���__name__(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/google.pyt���<module>���s���  PK�������!�hX ��X �� ��svneol.pycnu�[�������� fc�����������@���s���d��Z��d�d�l�Z�d�d�l�Z�d���Z�d���Z�e�j�d��j�Z�x�e�j�d��D]�\�Z �Z �Z �d�e �k�r}�e �j �d��n��x[�e �D]S�Z �e�e ��r�d�e�e �e ��k�r�e�j�j�e �e ��Z�e�j�d �e��q�q�q�WqR�Wd�S( ���s�� SVN helper script. Try to set the svn:eol-style property to "native" on every .py, .txt, .c and .h file in the directory tree rooted at the current directory. Files with the svn:eol-style property already set (to anything) are skipped. svn will itself refuse to set this property on a file that's not under SVN control, or that has a binary mime-type property set. This script inherits that behavior, and passes on whatever warning message the failing "svn propset" command produces. In the Python project, it's safe to invoke this script from the root of a checkout. No output is produced for files that are ignored. For a file that gets svn:eol-style set, output looks like: property 'svn:eol-style' set on 'Lib\ctypes\__init__.py' For a file not under version control: svn: warning: 'patch-finalizer.txt' is not under version control and for a file with a binary mime-type property: svn: File 'Lib est est_pep263.py' has binary mime type property iNc���������C���s���t��j�j�|��d�d�|�d��}�y4�t�t�t��j�j�|��d�d���j���j����}�Wn�t�k �rg�g��SX|�d �k�r�t��j�j�|��d�d�|�d��t��j�j�|��d�d�|�d��g�St�d ��d��S( ���Ns���.svnt���propss ���.svn-workt���formati���i ���s ���prop-bases ���.svn-bases���Unknown repository format(���i���i ���( ���t���ost���patht���joint���intt���opent���readt���stript���IOErrort ���ValueError(���t���roott���fnt���defaultR���(����(����s,���/usr/lib64/python2.7/Tools/scripts/svneol.pyt ���propfiles$���s����4   c��� ������C���s��g��}�xt��|��|��D]�}�y�t�|��}�Wn�t�k �rB�q�n�Xx�|�j���}�|�j�d��re�Pn��|�j�d��sz�t��t�|�j���d��}�|�j�|��}�|�j �|��|�j���|�j���}�|�j�d��s�t��t�|�j���d��}�|�j�|��}�|�j���qF�W|�j ���q�W|�S(���s=���Return a list of property names for file fn in directory roott���ENDs���K i���s���V ( ���R���R���R ���t���readlinet ���startswitht���AssertionErrorR���t���splitR���t���appendt���close( ���R ���R ���t���resultR���t���ft���linet���Lt���keyt���value(����(����s,���/usr/lib64/python2.7/Tools/scripts/svneol.pyt���proplist1���s,����     s���\.([hc]|py|txt|sln|vcproj)$t���.s���.svns ���svn:eol-styles%���svn propset svn:eol-style native "%s"(���t���__doc__t���reR���R���R���t���compilet���searcht���possible_text_filet���walkR ���t���dirst���filest���removeR ���R���R���t���system(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/svneol.pyt���<module>���s���   !   PK�������!�RA���� ��byext.pycnu�[�������� fc�����������@��sd���d��Z��d�d�l�m�Z�d�d�l�Z�d�d�l�Z�d�d�d�����YZ�d���Z�e�d�k�r`�e���n��d�S( ���s"���Show file statistics by extension.i(���t���print_functionNt���Statsc�����������B��s>���e��Z�d����Z�d���Z�d���Z�d���Z�d���Z�d���Z�RS(���c���������C��s ���i��|��_��d��S(���N(���t���stats(���t���self(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyt���__init__ ���s����c���������C��s���xy�|�D]q�}�t��j�j�|��r/�|��j�|��q�t��j�j�|��rQ�|��j�|��q�t�j�j�d�|��|��j �d�d�d��q�Wd��S(���Ns���Can't find %s s���<???>t���unknowni���( ���t���ost���patht���isdirt���statdirt���isfilet���statfilet���syst���stderrt���writet���addstats(���R���t���argst���arg(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyt���statargs���s���� c���������C��s��|��j��d�d�d��y�t�t�j�|���}�WnD�t�j�k �rr�}�t�j�j�d�|�|�f��|��j��d�d�d��d��SXx�|�D]�}�|�j�d��r�qz�n��|�j �d��r�qz�n��t�j �j �|�|��}�t�j �j �|��r�|��j��d�d �d��qz�t�j �j �|��r |��j�|��qz�|��j�|��qz�Wd��S( ���Ns���<dir>t���dirsi���s���Can't list %s: %s t ���unlistables���.#t���~s���<lnk>t���links(���R���t���sortedR���t���listdirt���errorR ���R ���R���t ���startswitht���endswithR���t���joint���islinkR���R ���R ���(���R���t���dirt���namest���errt���namet���full(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyR ������s$���� c��� ������C��s��t��j�j�|��\�}�}�t��j�j�|��\�}�}�|�|�k�rE�d�}�n��t��j�j�|��}�|�sf�d�}�n��|��j�|�d�d��y�t�|�d��}�WnA�t�k �r�}�t�j �j �d�|�|�f��|��j�|�d�d��d��SX|�j ���}�|�j ���|��j�|�d�t �|���d �|�k�r"|��j�|�d �d��d��S|�s>|��j�|�d �d��n��|�j���}�|��j�|�d �t �|���~�|�j���} �|��j�|�d �t �| ���d��S(���Nt����s���<none>t���filesi���t���rbs���Can't open %s: %s t ���unopenablet���bytess����t���binaryt���emptyt���linest���words(���R���R���t���splitextt���splitt���normcaseR���t���opent���IOErrorR ���R ���R���t���readt���closet���lent ���splitlines( ���R���t���filenamet���headt���extt���baset���fR ���t���dataR*���R+���(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyR ���.���s6����        c���������C��s3���|��j��j�|�i���}�|�j�|�d��|�|�|�<d��S(���Ni����(���R���t ���setdefaultt���get(���R���R7���t���keyt���nt���d(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyR���L���s����c��� ��������s��t��|��j�j����}�i��}�x"�|�D]�}�|�j�|��j�|��q"�Wt��|�j������i���t�g��|�D]�}�t�|��^�qb���d�<d�}�i��|��j�d�<x���D]�}�d�}�t�|�t�|���}�xb�|�D]Z�}�|��j�|�j�|��}�|�d��k�r�d�} �n�t�d�|��} �|�|�7}�t�|�| ��}�q�Wt�|�t�t�|����}�|��|�<|�|��j�d�|�<q�W|�j �d��x�|�D]�}�|�|��j�|�d�<qoW��j �d�d�����f�d���} �| ���x]�|�D]U�}�xE���D]=�}�|��j�|�j�|�d��}�t �d��|�|�f�d �d �qWt ���qW| ���d��S( ���NR7���i���t���TOTALi����s���%dc������������s:���x,���D]$�}��t��d��|��|��f�d�d�q�Wt����d��S(���Ns���%*st���endt��� (���t���print(���t���col(���t���colst���colwidth(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyt ���printheaderm���s���� "R#���s���%*sRA���RB���( ���R���R���t���keyst���updatet���maxR3���R<���t���Nonet���strt���appendt���insertRC���( ���R���t���extst���columnsR7���t���minwidthRD���t���totalt���cwt���valuet���wRG���(����(���RE���RF���s+���/usr/lib64/python2.7/Tools/scripts/byext.pyt���reportP���sD���� )           " (���t���__name__t ���__module__R���R���R ���R ���R���RV���(����(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyR��� ���s ���    c����������C��sF���t��j�d�}��|��s"�t�j�g�}��n��t���}�|�j�|���|�j���d��S(���Ni���(���R ���t���argvR���t���curdirR���R���RV���(���R���t���s(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyt���mainy���s ����   t���__main__(����(���t���__doc__t ���__future__R����R���R ���R���R\���RW���(����(����(����s+���/usr/lib64/python2.7/Tools/scripts/byext.pyt���<module>���s���  o  PK�������!�&l���� ��copytime.pyonu�[�������� fc�����������@���sQ���d��d�l��Z��d��d�l�Z�d��d�l�m�Z�m�Z�d���Z�e�d�k�rM�e���n��d�S(���iN(���t���ST_ATIMEt���ST_MTIMEc����������C���s���t��t�j��d�k�r5�t�j�j�d��t�j�d��n��t�j�d�t�j�d�}��}�y�t�j�|���}�Wn5�t�j�k �r�t�j�j�|��d��t�j�d��n�Xy"�t�j �|�|�t �|�t �f��Wn5�t�j�k �r�t�j�j�|�d��t�j�d��n�Xd��S(���Ni���s#���usage: copytime source destination i���i���s���: cannot stat s���: cannot change time ( ���t���lent���syst���argvt���stderrt���writet���exitt���ost���statt���errort���utimeR����R���(���t���file1t���file2t���stat1(����(����s.���/usr/lib64/python2.7/Tools/scripts/copytime.pyt���main ���s����"t���__main__(���R���R���R ���R����R���R���t���__name__(����(����(����s.���/usr/lib64/python2.7/Tools/scripts/copytime.pyt���<module>���s ���    PK�������!� ������lll.pyonu�[�������� fc�����������@���sN���d��d�l��Z��d��d�l�Z�d���Z�d���Z�e�d�k�rJ�e�e��j�d��n��d�S(���iNc���������C���sy���xr�t��j�|���D]a�}�|�t��j�t��j�f�k�r�t��j�j�|��|��}�t��j�j�|��rq�|�Gd�Gt��j�|��GHqq�q�q�Wd��S(���Ns���->(���t���ost���listdirt���curdirt���pardirt���patht���joint���islinkt���readlink(���t���dirnamet���namet���full(����(����s)���/usr/lib64/python2.7/Tools/scripts/lll.pyt���lll ���s ����c���������C���sh���|��s�t��j�g�}��n��d�}�xF�|��D]>�}�t�|���d�k�rV�|�sD�Hn��d�}�|�d�GHn��t�|��q"�Wd��S(���Ni���i����t���:(���R����R���t���lenR ���(���t���argst���firstt���arg(����(����s)���/usr/lib64/python2.7/Tools/scripts/lll.pyt���main���s����� � t���__main__i���(���t���sysR����R ���R���t���__name__t���argv(����(����(����s)���/usr/lib64/python2.7/Tools/scripts/lll.pyt���<module>���s���  PK�������!�-Ő �� �� ��nm2def.pycnu�[�������� fc�����������@���s���d��Z��d�d�l�Z�d�d�l�Z�d�e�j�d� d�Z�d�e�j�d�e�j�d�d �Z�d �Z�e�d�d��Z�d���Z�d�Z �d�Z �e �d��Z �d���Z �e �d�k�r�e ���n��d�S(���sE��nm2def.py Helpers to extract symbols from Unix libs and auto-generate Windows definition files from them. Depends on nm(1). Tested on Linux and Solaris only (-p option to nm is for Solaris only). By Marc-Andre Lemburg, Aug 1998. Additional notes: the output of nm is supposed to look like this: acceler.o: 000001fd T PyGrammar_AddAccelerators U PyGrammar_FindDFA 00000237 T PyGrammar_RemoveAccelerators U _IO_stderr_ U exit U fprintf U free U malloc U printf grammar1.o: 00000000 T PyGrammar_FindDFA 00000034 T PyGrammar_LabelRepr U _PyParser_TokenNames U abort U printf U sprintf ... Even if this isn't the default output of your nm, there is generally an option to produce this format (since it is the original v7 Unix format). iNt ���libpythoni���s���.at���Pythoni����i���s���.dlls ���nm -p -g %st���Tt���Ct���Dc��� ������C���s���t��j�t�|���j���}�g��|�D]�}�|�j���^�q �}�i��}�x�|�D]�}�t�|��d�k�sE�d�|�k�ro�qE�n��|�j���}�t�|��d�k�r�qE�n��|�\�}�}�} �|�|�k�r�qE�n��|�|�f�|�| �<qE�W|�S(���Ni����t���:i���(���t���ost���popent���NMt ���readlinest���stript���lent���split( ���t���libt���typest���linest���st���symbolst���linet���itemst���addresst���typet���name(����(����s,���/usr/lib64/python2.7/Tools/scripts/nm2def.pyR���+���s����   c���������C���s���g��}�g��}�xQ�|��j����D]C�\�}�\�}�}�|�d�k�rK�|�j�d�|��q�|�j�d�|��q�W|�j���|�j�d��|�j���d�j�|��d�d�j�|��S(���NR���R���s��� t����s��� DATA s��� (���R���R���(���R���t���appendt���sortt���join(���R���t���datat���codeR���t���addrR���(����(����s,���/usr/lib64/python2.7/Tools/scripts/nm2def.pyt ���export_list<���s����    s ���EXPORTS %s c���������C���sT���xM�|��j����D]?�}�|�d� d�k�sL�|�d� d�k�r6�q �|�|�k�r �|��|�=q �q �Wd��S(���Ni���t���Pyi���t���_Py(���t���keys(���R���t���specialsR���(����(����s,���/usr/lib64/python2.7/Tools/scripts/nm2def.pyt ���filter_PythonU���s ����  c����������C���sJ���t��t��}��t�|���t�|���}�t�j�}�|�j�t�|��|�j���d��S(���N( ���R���t ���PYTHONLIBR#���R���t���syst���stdoutt���writet ���DEF_TEMPLATEt���close(���R���t���exportst���f(����(����s,���/usr/lib64/python2.7/Tools/scripts/nm2def.pyt���main]���s ����    t���__main__(���R���R���R���(����(���t���__doc__R���R%���t���versionR$���t ���PC_PYTHONLIBR���R���R���R(���t���SPECIALSR#���R,���t���__name__(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/nm2def.pyt���<module>$���s���    PK�������!�Dx ��x �� ��linktree.pynu�ȯ��������#! /usr/bin/python2.7 # linktree # # Make a copy of a directory tree with symbolic links to all files in the # original tree. # All symbolic links go to a special symbolic link at the top, so you # can easily fix things if the original source tree moves. # See also "mkreal". # # usage: mklinks oldtree newtree import sys, os LINK = '.LINK' # Name of special symlink at the top. debug = 0 def main(): if not 3 <= len(sys.argv) <= 4: print 'usage:', sys.argv[0], 'oldtree newtree [linkto]' return 2 oldtree, newtree = sys.argv[1], sys.argv[2] if len(sys.argv) > 3: link = sys.argv[3] link_may_fail = 1 else: link = LINK link_may_fail = 0 if not os.path.isdir(oldtree): print oldtree + ': not a directory' return 1 try: os.mkdir(newtree, 0777) except os.error, msg: print newtree + ': cannot mkdir:', msg return 1 linkname = os.path.join(newtree, link) try: os.symlink(os.path.join(os.pardir, oldtree), linkname) except os.error, msg: if not link_may_fail: print linkname + ': cannot symlink:', msg return 1 else: print linkname + ': warning: cannot symlink:', msg linknames(oldtree, newtree, link) return 0 def linknames(old, new, link): if debug: print 'linknames', (old, new, link) try: names = os.listdir(old) except os.error, msg: print old + ': warning: cannot listdir:', msg return for name in names: if name not in (os.curdir, os.pardir): oldname = os.path.join(old, name) linkname = os.path.join(link, name) newname = os.path.join(new, name) if debug > 1: print oldname, newname, linkname if os.path.isdir(oldname) and \ not os.path.islink(oldname): try: os.mkdir(newname, 0777) ok = 1 except: print newname + \ ': warning: cannot mkdir:', msg ok = 0 if ok: linkname = os.path.join(os.pardir, linkname) linknames(oldname, newname, linkname) else: os.symlink(linkname, newname) if __name__ == '__main__': sys.exit(main()) PK�������!�X>���� ��fixcid.pyonu�[�������� fc�����������@���s��d��d�l��Z��d��d�l�Z�d��d�l�Z�d��d�l�Td��d�l�Z�e��j�j�Z�e�Z�e��j �j�Z �d���Z �d���Z �d�Z �d���Z�d���Z�d���Z�d �Z�d �Z�d �Z�d �Z�d �Z�d�Z�d�Z�d�Z�e�d�e�d�e�Z�d�Z�d�e�d�Z�d�e�Z�e�d�e�Z�e�d�e�Z�e�e�e�e�e�f�Z�d�d�j �e��d�Z!�e�j"�e!��Z#�e�e�e�f�Z$�d�d�j �e$��d�Z%�e�j"�e%��Z&�d���Z'�d���Z(�d�a)�d���Z*�d�a+�d���Z,�i��Z-�i��Z.�d���Z/�e0�d�k�re ���n��d�S(���iN(���t���*c����������C���s���t��j�d�}��t�d�|��d��t�d��t�d��t�d��t�d��t�d��t�d��t�d ��t�d ��t�d ��t�d ��d��S( ���Ni����s���Usage: s/��� [-c] [-r] [-s file] ... file-or-directory ... s��� s*���-c : substitute inside comments s:���-r : reverse direction for following -s options s+���-s substfile : add a file of substitutions s<���Each non-empty non-comment line in a substitution file must s>���contain exactly two words: an identifier and its replacement. s:���Comments start with a # character and end at end of line. s=���If an identifier is preceded with a *, it is not substituted s,���inside a comment even when -c is specified. (���t���syst���argvt���err(���t���progname(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyt���usage/���s����           c����������C���sq��y#�t��j��t�j�d�d��\�}��}�WnB�t��j�k �rg�}�t�d�t�|��d��t���t�j�d��n�Xd�}�|�s�t���t�j�d��n��xY�|��D]Q�\�}�}�|�d�k�r�t���n��|�d�k�r�t ���n��|�d �k�r�t �|��q�q�Wxv�|�D]n�}�t �j �j �|��rt�|��r\d�}�q\q�t �j �j�|��rGt�|�d ��d�}�q�t�|��r�d�}�q�q�Wt�j�|��d��S( ���Ni���s���crs:s���Options error: s��� i���i����s���-cs���-rs���-ss"���: will not process symbolic links (���t���getoptR���R���t���errorR���t���strR���t���exitt ���setdocommentst ���setreverset���addsubstt���ost���patht���isdirt ���recursedownt���islinkt���fix(���t���optst���argst���msgt���badt���optt���arg(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyt���main>���s6����#       �   � s���^[a-zA-Z0-9_]+\.[ch]$c���������C���s���t��j�t�|���S(���N(���t���ret���matcht���Wanted(���t���name(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyt���wanted\���s����c���������C���s9��t��d�|��f��d�}�y�t�j�|���}�Wn3�t�j�k �r_�}�t�|��d�t�|��d��d�SX|�j���g��}�x�|�D]�}�|�t�j�t�j�f�k�r�qw�n��t�j �j �|��|��}�t�j �j �|��r�qw�t�j �j �|��r�|�j �|��qw�t�|��rw�t�|��r d�}�q qw�qw�Wx#�|�D]�}�t�|��rd�}�qqW|�S(���Ns���recursedown(%r) i����s���: cannot list directory: s��� i���(���t���dbgR ���t���listdirR���R���R���t���sortt���curdirt���pardirR���t���joinR���R���t���appendR���R���R���(���t���dirnameR���t���namesR���t���subdirsR���t���fullname(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyR���_���s0����  ��  �  � c��� ������C���s-��|��d�k�r!�t��j�}�t��j�}�n}�y�t�|��d��}�Wn0�t�k �rf�}�t�|��d�t�|��d��d�SXt�j�j �|���\�}�}�t�j�j �|�d�|��}�d��}�d�}�t ���xV|�j ���}�|�s�Pn��|�d�}�x>�|�d�d �k�r|�j ���} �| �s�Pn��|�| �}�|�d�}�q�Wt�|��} �| �|�k�r|�d��k�ry�t�|�d ��}�Wn:�t�k �r}�|�j���t�|�d �t�|��d��d�SX|�j�d��d�}�t ���t�|��d ��q�n��t�t�|��d��t�d �|��t�d�| ��n��|�d��k �r�|�j�| ��q�q�W|��d�k�rd�S|�j���|�s(d�S|�j���y+�t�j�|���} �t�j�|�| �t�d�@�Wn2�t�j�k �r}�t�|�d�t�|��d��n�Xy�t�j�|��|��d��Wn2�t�j�k �r}�t�|��d�t�|��d��n�Xy�t�j�|�|���Wn3�t�j�k �r(}�t�|��d�t�|��d��d�SXd�S(���Nt���-t���rs���: cannot open: s��� i���t���@i����is���\ t���ws���: cannot create: s���: s���< s���> i��s���: warning: chmod failed (s���) t���~s���: warning: backup failed (s���: rename failed ((���R���t���stdint���stdoutt���opent���IOErrorR���R���R ���R���t���splitR$���t���Nonet ���initfixlinet���readlinet���fixlinet���closet���seekt���rept���reprt���writet���statt���chmodt���ST_MODER���t���rename( ���t���filenamet���ft���gR���t���headt���tailt���tempnamet���linenot���linet���nextlinet���newlinet���statbuf(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyR���u���s����    �  �        � �   s ���(struct )?[a-zA-Z_][a-zA-Z0-9_]+s���"([^\n\\"]|\\.)*"s���'([^\n\\']|\\.)*'s���/\*s���\*/s���0[xX][0-9a-fA-F]*[uUlL]*s���0[0-7]*[uUlL]*s���[1-9][0-9]*[uUlL]*t���|s���[eE][-+]?[0-9]+s���([0-9]+\.[0-9]*|\.[0-9]+)(s���)?s���[0-9]+t���(t���)c�����������C���s ���t��a�d��S(���N(���t���OutsideCommentProgramt���Program(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyR5������s����c���������C���s7��d�}�x*|�t��|���k��r2t�j�|��|��}�|�d��k�r=�Pn��|�j���}�|�j�d��}�t��|��d�k�r�|�d�k�r�t�a�q�|�d�k�r�t�a�q�n��t��|��}�|�t�k�r%t�|�}�t�t�k�r�t �s�d�G|�GH|�|�}�q �n��|�t �k�r�|�}�q�n��|��|� |�|��|�|�}��t��|��}�n��|�|�}�q �W|��S(���Ni����i���s���/*s���*/s���Found in comment:( ���t���lenRP���t���searchR4���t���startt���groupt���InsideCommentProgramRO���t���Dictt ���Docommentst ���NotInComment(���RH���t���iR���t���foundt���nt���subst(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyR7������s4���� �             i����c�����������C���s ���d�a��d��S(���Ni���(���RW���(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyR ��� ��s����c�����������C���s ���t�� a��d��S(���N(���t���Reverse(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyR �����s����c��� ������C���s��y�t��|��d��}�Wn<�t�k �rQ�}�t�|��d�t�|��d��t�j�d��n�Xd�}�x|�j���}�|�sq�Pn��|�d�}�y�|�j�d��}�Wn�t�k �r�d�}�n�X|�|� j ���}�|�s�q[�n��t �|��d�k�r|�d�d �k�r|�d�d �|�d�g�|�d �*n3�t �|��d �k�r9t�|��d �|��|�|�f��q[�n��t �rN|�\�}�}�n �|�\�}�}�|�d�d �k�rw|�d�}�n��|�d�d �k�r|�d�}�|�t �|�<n��|�t �k�rt�d�|��|�|�|�f��t�d�|��|�t �|�f��n��|�t �|�<q[�W|�j���d��S(���NR+���s���: cannot read substfile: s��� i���i����t���#ii���t���structt��� i���s���%s:%r: warning: bad line: %rR����s"���%s:%r: warning: overriding: %r %r s���%s:%r: warning: previous: %r (���R1���R2���R���R���R���R ���R6���t���indext ���ValueErrorR3���RQ���R]���RX���RV���R8���( ���t ���substfilet���fpR���RG���RH���RY���t���wordst���valuet���key(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyR �����sH���� �   �"      t���__main__(1���R���R���R ���R=���R���t���stderrR<���R���R���R0���R:���R���R���R���R���R���R���t ���Identifiert���Stringt���Chart ���CommentStartt ���CommentEndt ���Hexnumbert ���Octnumbert ���Decnumbert ���Intnumbert���Exponentt ���Pointfloatt���Expfloatt ���Floatnumbert���Numbert���OutsideCommentR$���t���OutsideCommentPatternt���compileRO���t ���InsideCommentt���InsideCommentPatternRU���R5���R7���RW���R ���R]���R ���RV���RX���R ���t���__name__(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/fixcid.pyt���<module>%���sX���            P   '   % PK�������!�n\6)��)����find_recursionlimit.pycnu�[�������� fc�����������@���sG��d��Z��d�d�l�Z�d�d�l�Z�d�d�d�����YZ�d���Z�d�d �d�����YZ�d���Z�d �d!�d �����YZ�d ���Z�d �d"�d �����YZ �d���Z �d�d#�d�����YZ �d���Z �d���Z �i��d��Z�d���Z�d�Z�xr�e�e�d��e�e�d��e�e�d��e�e�d��e�e�d��e�e�d��e�e�d��d�e�GHe�d�Z�q�Wd�S($���sA��Find the maximum recursion limit that prevents interpreter termination. This script finds the maximum safe recursion limit on a particular platform. If you need to change the recursion limit on your system, this script will tell you a safe upper bound. To use the new limit, call sys.setrecursionlimit(). This module implements several ways to create infinite recursion in Python. Different implementations end up pushing different numbers of C stack frames, depending on how many calls through Python's abstract C API occur. After each round of tests, it prints a message: "Limit of NNNN is fine". The highest printed value of "NNNN" is therefore the highest potentially safe limit for your system (which depends on the OS, architecture, but also the compilation flags). Please note that it is practically impossible to test all possible recursion paths in the interpreter, so the results of this test should not be trusted blindly -- although they give a good hint of which values are reasonable. NOTE: When the C stack space allocated by your system is exceeded due to excessive recursion, exact behaviour depends on the platform, although the interpreter will always fail in a likely brutal way: either a segmentation fault, a MemoryError, or just a silent abort. NB: A program that does not use __methods__ can set a higher limit. iNt���RecursiveBlowup1c�����������B���s���e��Z�d����Z�RS(���c���������C���s���|��j����d��S(���N(���t���__init__(���t���self(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR���$���s����(���t���__name__t ���__module__R���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR����#���s���c�����������C���s���t����S(���N(���R����(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���test_init'���s����t���RecursiveBlowup2c�����������B���s���e��Z�d����Z�RS(���c���������C���s ���t��|���S(���N(���t���repr(���R���(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt���__repr__+���s����(���R���R���R���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR���*���s���c�����������C���s ���t��t����S(���N(���R���R���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���test_repr.���s����t���RecursiveBlowup4c�����������B���s���e��Z�d����Z�RS(���c���������C���s���|�|��S(���N(����(���R���t���x(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt���__add__2���s����(���R���R���R ���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR ���1���s���c�����������C���s���t����t����S(���N(���R ���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt���test_add5���s����t���RecursiveBlowup5c�����������B���s���e��Z�d����Z�RS(���c���������C���s ���t��|��|��S(���N(���t���getattr(���R���t���attr(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���__getattr__9���s����(���R���R���R���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR���8���s���c�����������C���s ���t����j�S(���N(���R���R���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���test_getattr<���s����t���RecursiveBlowup6c�����������B���s���e��Z�d����Z�RS(���c���������C���s���|��|�d�|��|�d�S(���Ni���i���(����(���R���t���item(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���__getitem__@���s����(���R���R���R���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR���?���s���c�����������C���s ���t����d�S(���Ni���(���R���(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���test_getitemC���s����c�����������C���s���t����S(���N(���t ���test_recurse(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR���F���s����c���������C���s���y�d�d��l��}�Wn�t�k �r)�d�GHd��SXd��}�xv�t�j���D]h�}�y�|��|�}�w=�Wn1�t�k �r�x!�t�d��D]�}�|�g�}�qq�Wn�X|�j�|�d�d�|�|��|�<q=�Wd��S(���Nis���cannot import cPickle, skipped!id���t���protocol(���t���cPicklet ���ImportErrort���Nonet ���itertoolst���countt���KeyErrort���ranget���dumps(���t���_cacheR���t���lt���nt���i(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���test_cpickleI���s����   c���������C���sh���t��j�|���|�j�d��r(�|�d�GHn�|�GHt���|�}�y �|���Wn�t�t�f�k �r^�n�Xd�GHd��S(���Nt���test_i���s���Yikes!(���t���syst���setrecursionlimitt ���startswitht���globalst ���RuntimeErrort���AttributeError(���R#���t���test_func_namet ���test_func(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt ���check_limitZ���s����    i��R���R ���R ���R���R���R���R%���s���Limit of %d is fineid���(����(����(����(����(����(���t���__doc__R'���R���R����R���R���R ���R ���R ���R���R���R���R���R���R%���R/���t���limit(����(����(����s9���/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt���<module>���s4���                  PK�������!�@wG��G����hotshotmain.pycnu�[�������� fc�����������@���s���d��Z��d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�Z�d���Z�d���Z�e �d�k�r�e�j �e�e�j �d���n��d�S(���s��� Run a Python script under hotshot's control. Adapted from a posting on python-dev by Walter Drwald usage %prog [ %prog args ] filename [ filename args ] Any arguments after the filename are used as sys.argv for the filename. iNs ���hotshot.profc���������C���s���t��j�|��}�t�j�j�d�t�j�j�|����|��g�|�t�_�|�j�d�|���|�j ���t��j �j �|��}�|�j �d�d��t�j �}�t�j�t�_ �|�j���|�t�_ �d�S(���Ni����s ���execfile(%r)t���timet���calls(���t���hotshott���Profilet���syst���patht���insertt���ost���dirnamet���argvt���runt���closet���statst���loadt ���sort_statst���stdoutt���stderrt ���print_stats(���t���filenamet���profilet���argst���profR ���t ���save_stdout(����(����s1���/usr/lib64/python2.7/Tools/scripts/hotshotmain.pyt ���run_hotshot���s����     c������ ���C���s���t��j�t��}�|�j���|�j�d�d�d�d�d�t�d�d�d�d �|�j�|���\�}�}��t�|���d �k�ry�|�j�d ��d �S|��d �}�t �|�|�j �|��d ��S( ���Ns���-ps ���--profilet���actiont���storet���defaultt���destR���t���helps���Specify profile file to usei����s���missing script to executei���( ���t���optparset ���OptionParsert���__doc__t���disable_interspersed_argst ���add_optiont���PROFILEt ���parse_argst���lent ���print_helpR���R���(���R���t���parsert���optionsR���(����(����s1���/usr/lib64/python2.7/Tools/scripts/hotshotmain.pyt���main(���s����    t���__main__i���( ���R���R���R���R���R���t ���hotshot.statsR"���R���R(���t���__name__t���exitR ���(����(����(����s1���/usr/lib64/python2.7/Tools/scripts/hotshotmain.pyt���<module> ���s���        PK�������!����� ��redemo.pyonu�[�������� fc�����������@���sR���d��Z��d�d�l�Td�d�l�Z�d�d�d�����YZ�d���Z�e�d�k�rN�e���n��d�S( ���sD���Basic regular expression demonstration facility (Perl style syntax).i(���t���*Nt���ReDemoc�����������B���s;���e��Z�d����Z�d���Z�d���Z�d�d��Z�d�d��Z�RS(���c������ ���C���s��|�|��_��t�|��j��d�t�d�d�|��_�|��j�j�d�t�d�t��t�|��j���|��_�|��j�j�d�t��|��j�j ���|��j ���t�|��j��d�d�d�t�|��_ �|��j �j�d�t�d�t��t�|��j��d�t�d�d�|��_ �|��j �j�d�t��|��j �j�d�t��t �|��|��_�|��j�j�d�t�d�t��t�|��|��_�|��j�j�d��t�|��j�d�d �d �|��j�d �d�d �|��j�|��_�|��j�j�d�t��t�|��j�d�d �d �|��j�d �d�d �|��j�|��_�|��j�j�d�t��t�|��j��d�d�d�d�|��_�|��j�j�d�t�d�d��|��j�j�d�d�d�t�|��j��d�d�d�t�|��_�|��j�j�d�t��t�|��j���|��_�|��j�j�d�d�d�t��|��j�j�d�|��j��|��j�j�d�|��j��d��|��_!�|��j���|��j�j"���}�|��j�j"�|�d�|�d� �|��j�j"���}�|��j�j"�|�d�|�d� �d��S(���Nt���anchort���texts&���Enter a Perl-style regular expression:t���sidet���fillt����s���Enter a string to search:t���firsts���Highlight first matcht���variablet���valuet���commands���Highlight all matchest���allt���widthi<���t���heighti���t���expandi���t���hitt ���backgroundt���yellows���Groups:s���<Key>(#���t���mastert���Labelt���Wt ���promptdisplayt���packt���TOPt���Xt���Entryt ���regexdisplayt ���focus_sett ���addoptionst ���statusdisplayt ���labeldisplayt���Framet ���showframet ���StringVart���showvart���sett ���Radiobuttont ���recompilet���showfirstradiot���LEFTt ���showallradiot���Textt ���stringdisplayt���BOTHt ���tag_configuret ���grouplabelt���Listboxt ���grouplistt���bindt ���reevaluatet���Nonet���compiledt���bindtags(���t���selfR���t���btags(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyt���__init__ ���sZ����           c������ ���C���s���g��|��_��g��|��_�g��|��_�x�d�D]�}�t�|��j��d�d�k�rs�t�|��j��}�|�j�d�t��|��j��j�|��n��t �t �|��}�t ���}�t �|�d �|�d �|�d �d�d �|�d �|��j �}�|�j�d�t��|��j�j�|��|��j�j�|��q"�Wd��S(���Nt ���IGNORECASEt���LOCALEt ���MULTILINEt���DOTALLt���VERBOSEi���i����R���R���R���t���offvaluet���onvalueR ���R���(���R8���R9���R:���R;���R<���(���t���framest���boxest���varst���lenR���R���R���R���t���appendt���getattrt���ret���IntVart ���CheckbuttonR%���R'���(���R5���t���namet���framet���valt���vart���box(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyR���H���s*����   ���      c���������C���s4���d�}�x!�|��j��D]�}�|�|�j���B}�q�W|�}�|�S(���Ni����(���RA���t���get(���R5���t���flagsRK���(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyt���getflags_���s ����c���������C���s���yN�t��j�|��j�j���|��j����|��_�|��j�d�}�|��j�j�d�d�d�|��WnB�t��j �k �r�}�d��|��_�|��j�j�d�d�t �|��d�d��n�X|��j ���d��S(���NR���R���R���s ���re.error: %st���red( ���RE���t���compileR���RM���RO���R3���R���R���t���configt���errorR2���t���strR1���(���R5���t���eventt���bgt���msg(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyR%���f���s����    c��� ������C���sU��y�|��j��j�d�d�t��Wn�t�k �r-�n�Xy�|��j��j�d�d�t��Wn�t�k �r[�n�X|��j�j�d�t��|��j�s|�d��S|��j��j�d�d�d�|��j��j�d�d�d�|��j��j�d�t��}�d�}�d�}�xJ|�t �|��k�r|��j�j �|�|��}�|�d��k�rPn��|�j ���\�}�}�|�|�k�r4|�d�}�d�}�n�d�}�d �|�}�d �|�} �|��j��j �|�|�| ��|�d�k�r|��j��j�|��t�|�j����} �| �j�d�|�j����xD�t�t �| ���D]-�} �d �| �| �| �f�} �|��j�j�t�| ��qWn��|�d�}�|��j�j���d �k�r�Pq�q�W|�d�k�r>|��j�j�d �d �d�d��n�|��j�j�d �d��d��S(���NR���s���1.0t���hit0i����R���R���t���orangei���s���1.0 + %d charss���%2d: %rR���R���s ���(no match)R���(���R*���t ���tag_removet���ENDt���TclErrorR/���t���deleteR3���R,���RM���RB���t���searchR2���t���spant���tag_addt���yview_pickplacet���listt���groupst���insertt���groupt���rangeR"���R���RR���( ���R5���RU���R���t���lastt���nmatchest���mR���t���tagt���pfirstt���plastRc���t���it���g(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyR1���s���sT����             N(���t���__name__t ���__module__R7���R���RO���R2���R%���R1���(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyR������s ��� ?   c����������C���s6���t����}��t�|���}�|��j�d�|��j��|��j���d��S(���Nt���WM_DELETE_WINDOW(���t���TkR���t���protocolt���quitt���mainloop(���t���roott���demo(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyt���main���s����  t���__main__(����(���t���__doc__t���TkinterRE���R���Rx���Ro���(����(����(����s,���/usr/lib64/python2.7/Tools/scripts/redemo.pyt���<module>���s ���    PK�������!�=~w��w�� ��gprof2html.pynu�ȯ��������#! /usr/bin/python2.7 """Transform gprof(1) output into useful HTML.""" import re, os, sys, cgi, webbrowser header = """\ <html> <head> <title>gprof output (%s)

"""

trailer = """\
""" def add_escapes(input): for line in input: yield cgi.escape(line) def main(): filename = "gprof.out" if sys.argv[1:]: filename = sys.argv[1] outputfilename = filename + ".html" input = add_escapes(file(filename)) output = file(outputfilename, "w") output.write(header % filename) for line in input: output.write(line) if line.startswith(" time"): break labels = {} for line in input: m = re.match(r"(.* )(\w+)\n", line) if not m: output.write(line) break stuff, fname = m.group(1, 2) labels[fname] = fname output.write('%s%s\n' % (stuff, fname, fname, fname)) for line in input: output.write(line) if line.startswith("index % time"): break for line in input: m = re.match(r"(.* )(\w+)(( <cycle.*>)? \[\d+\])\n", line) if not m: output.write(line) if line.startswith("Index by function name"): break continue prefix, fname, suffix = m.group(1, 2, 3) if fname not in labels: output.write(line) continue if line.startswith("["): output.write('%s%s%s\n' % (prefix, fname, fname, fname, suffix)) else: output.write('%s%s%s\n' % (prefix, fname, fname, suffix)) for line in input: for part in re.findall(r"(\w+(?:\.c)?|\W+)", line): if part in labels: part = '%s' % (part, part) output.write(part) output.write(trailer) output.close() webbrowser.open("file:" + os.path.abspath(outputfilename)) if __name__ == '__main__': main() PK!((h2py.pyonu[ fc@sddlZddlZddlZddlZejdZejdZejdZejdZejdZ ee gZ ejdZ ejdZ ia iZyejd jd ZWnek ryejd jd ZWqek ryfejjd d kr9ejdjd Zn1ejjdrdejdjdZneWqek rdgZy*ejd ejjdejdWqek rqXqXqXnXdZdZidZedkrendS(iNs+^[ ]*#[ ]*define[ ]+([a-zA-Z0-9_]+)[ ]+sG^[ ]*#[ ]*define[ ]+([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[ ]+s"^[ ]*#[ ]*include[ ]+<([^> ]+)>s/\*([^*]+|\*+[^/])*(\*+/)?s//.*s'(\\.[^\\]*|[^\\])'s0x([0-9a-fA-F]+)L?tincludet;tINCLUDEtbeosit BEINCLUDEStatheostC_INCLUDE_PATHt:s /usr/includet MULTIARCHc Cstjtjdd\}}x9|D]1\}}|dkr&tjtj|q&q&W|smdg}nxA|D]9}|dkrtjjdt tj tjqtt |d}t j j|}|jd}|dkr|| }n|j}|d }t |d } | jd |iaxXtD]P} |t|  | kr8dt|t| d<|t|t| d|ddkr~|j}|sgPn|d}||}qAW|jd}||j}e|}d} d||jf} y | |UWnejj d| qX|j | ne j|}|r|jdd\} } ||j}e|}d| | |f} y | |UWnejj d| qX|j | ne j|}|r |j } | d\}}|||!}e j|r|j d e |qej|sde|sF0           = PK!mx~[[ mkreal.pynuȯ#! /usr/bin/python2.7 # mkreal # # turn a symlink to a directory into a real directory import sys import os from stat import * join = os.path.join error = 'mkreal error' BUFSIZE = 32*1024 def mkrealfile(name): st = os.stat(name) # Get the mode mode = S_IMODE(st[ST_MODE]) linkto = os.readlink(name) # Make sure again it's a symlink f_in = open(name, 'r') # This ensures it's a file os.unlink(name) f_out = open(name, 'w') while 1: buf = f_in.read(BUFSIZE) if not buf: break f_out.write(buf) del f_out # Flush data to disk before changing mode os.chmod(name, mode) def mkrealdir(name): st = os.stat(name) # Get the mode mode = S_IMODE(st[ST_MODE]) linkto = os.readlink(name) files = os.listdir(name) os.unlink(name) os.mkdir(name, mode) os.chmod(name, mode) linkto = join(os.pardir, linkto) # for filename in files: if filename not in (os.curdir, os.pardir): os.symlink(join(linkto, filename), join(name, filename)) def main(): sys.stdout = sys.stderr progname = os.path.basename(sys.argv[0]) if progname == '-c': progname = 'mkreal' args = sys.argv[1:] if not args: print 'usage:', progname, 'path ...' sys.exit(2) status = 0 for name in args: if not os.path.islink(name): print progname+':', name+':', 'not a symlink' status = 1 else: if os.path.isdir(name): mkrealdir(name) else: mkrealfile(name) sys.exit(status) if __name__ == '__main__': main() PK!Fw|!!cleanfuture.pynuȯ#! /usr/bin/python2.7 """cleanfuture [-d][-r][-v] path ... -d Dry run. Analyze, but don't make any changes to, files. -r Recurse. Search for all .py files in subdirectories too. -v Verbose. Print informative msgs. Search Python (.py) files for future statements, and remove the features from such statements that are already mandatory in the version of Python you're using. Pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. Overwrites files in place, renaming the originals with a .bak extension. If cleanfuture finds nothing to change, the file is left alone. If cleanfuture does change a file, the changed file is a fixed-point (i.e., running cleanfuture on the resulting .py file won't change it again, at least not until you try it again with a later Python release). Limitations: You can do these things, but this tool won't help you then: + A future statement cannot be mixed with any other statement on the same physical line (separated by semicolon). + A future statement cannot contain an "as" clause. Example: Assuming you're using Python 2.2, if a file containing from __future__ import nested_scopes, generators is analyzed by cleanfuture, the line is rewritten to from __future__ import generators because nested_scopes is no longer optional in 2.2 but generators is. """ import __future__ import tokenize import os import sys dryrun = 0 recurse = 0 verbose = 0 def errprint(*args): strings = map(str, args) msg = ' '.join(strings) if msg[-1:] != '\n': msg += '\n' sys.stderr.write(msg) def main(): import getopt global verbose, recurse, dryrun try: opts, args = getopt.getopt(sys.argv[1:], "drv") except getopt.error, msg: errprint(msg) return for o, a in opts: if o == '-d': dryrun += 1 elif o == '-r': recurse += 1 elif o == '-v': verbose += 1 if not args: errprint("Usage:", __doc__) return for arg in args: check(arg) def check(file): if os.path.isdir(file) and not os.path.islink(file): if verbose: print "listing directory", file names = os.listdir(file) for name in names: fullname = os.path.join(file, name) if ((recurse and os.path.isdir(fullname) and not os.path.islink(fullname)) or name.lower().endswith(".py")): check(fullname) return if verbose: print "checking", file, "...", try: f = open(file) except IOError, msg: errprint("%r: I/O Error: %s" % (file, str(msg))) return ff = FutureFinder(f, file) changed = ff.run() if changed: ff.gettherest() f.close() if changed: if verbose: print "changed." if dryrun: print "But this is a dry run, so leaving it alone." for s, e, line in changed: print "%r lines %d-%d" % (file, s+1, e+1) for i in range(s, e+1): print ff.lines[i], if line is None: print "-- deleted" else: print "-- change to:" print line, if not dryrun: bak = file + ".bak" if os.path.exists(bak): os.remove(bak) os.rename(file, bak) if verbose: print "renamed", file, "to", bak g = open(file, "w") ff.write(g) g.close() if verbose: print "wrote new", file else: if verbose: print "unchanged." class FutureFinder: def __init__(self, f, fname): self.f = f self.fname = fname self.ateof = 0 self.lines = [] # raw file lines # List of (start_index, end_index, new_line) triples. self.changed = [] # Line-getter for tokenize. def getline(self): if self.ateof: return "" line = self.f.readline() if line == "": self.ateof = 1 else: self.lines.append(line) return line def run(self): STRING = tokenize.STRING NL = tokenize.NL NEWLINE = tokenize.NEWLINE COMMENT = tokenize.COMMENT NAME = tokenize.NAME OP = tokenize.OP changed = self.changed get = tokenize.generate_tokens(self.getline).next type, token, (srow, scol), (erow, ecol), line = get() # Chew up initial comments and blank lines (if any). while type in (COMMENT, NL, NEWLINE): type, token, (srow, scol), (erow, ecol), line = get() # Chew up docstring (if any -- and it may be implicitly catenated!). while type is STRING: type, token, (srow, scol), (erow, ecol), line = get() # Analyze the future stmts. while 1: # Chew up comments and blank lines (if any). while type in (COMMENT, NL, NEWLINE): type, token, (srow, scol), (erow, ecol), line = get() if not (type is NAME and token == "from"): break startline = srow - 1 # tokenize is one-based type, token, (srow, scol), (erow, ecol), line = get() if not (type is NAME and token == "__future__"): break type, token, (srow, scol), (erow, ecol), line = get() if not (type is NAME and token == "import"): break type, token, (srow, scol), (erow, ecol), line = get() # Get the list of features. features = [] while type is NAME: features.append(token) type, token, (srow, scol), (erow, ecol), line = get() if not (type is OP and token == ','): break type, token, (srow, scol), (erow, ecol), line = get() # A trailing comment? comment = None if type is COMMENT: comment = token type, token, (srow, scol), (erow, ecol), line = get() if type is not NEWLINE: errprint("Skipping file %r; can't parse line %d:\n%s" % (self.fname, srow, line)) return [] endline = srow - 1 # Check for obsolete features. okfeatures = [] for f in features: object = getattr(__future__, f, None) if object is None: # A feature we don't know about yet -- leave it in. # They'll get a compile-time error when they compile # this program, but that's not our job to sort out. okfeatures.append(f) else: released = object.getMandatoryRelease() if released is None or released <= sys.version_info: # Withdrawn or obsolete. pass else: okfeatures.append(f) # Rewrite the line if at least one future-feature is obsolete. if len(okfeatures) < len(features): if len(okfeatures) == 0: line = None else: line = "from __future__ import " line += ', '.join(okfeatures) if comment is not None: line += ' ' + comment line += '\n' changed.append((startline, endline, line)) # Loop back for more future statements. return changed def gettherest(self): if self.ateof: self.therest = '' else: self.therest = self.f.read() def write(self, f): changed = self.changed assert changed # Prevent calling this again. self.changed = [] # Apply changes in reverse order. changed.reverse() for s, e, line in changed: if line is None: # pure deletion del self.lines[s:e+1] else: self.lines[s:e+1] = [line] f.writelines(self.lines) # Copy over the remainder of the file. if self.therest: f.write(self.therest) if __name__ == '__main__': main() PK!((h2py.pycnu[ fc@sddlZddlZddlZddlZejdZejdZejdZejdZejdZ ee gZ ejdZ ejdZ ia iZyejd jd ZWnek ryejd jd ZWqek ryfejjd d kr9ejdjd Zn1ejjdrdejdjdZneWqek rdgZy*ejd ejjdejdWqek rqXqXqXnXdZdZidZedkrendS(iNs+^[ ]*#[ ]*define[ ]+([a-zA-Z0-9_]+)[ ]+sG^[ ]*#[ ]*define[ ]+([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[ ]+s"^[ ]*#[ ]*include[ ]+<([^> ]+)>s/\*([^*]+|\*+[^/])*(\*+/)?s//.*s'(\\.[^\\]*|[^\\])'s0x([0-9a-fA-F]+)L?tincludet;tINCLUDEtbeosit BEINCLUDEStatheostC_INCLUDE_PATHt:s /usr/includet MULTIARCHc Cstjtjdd\}}x9|D]1\}}|dkr&tjtj|q&q&W|smdg}nxA|D]9}|dkrtjjdt tj tjqtt |d}t j j|}|jd}|dkr|| }n|j}|d }t |d } | jd |iaxXtD]P} |t|  | kr8dt|t| d<|t|t| d|ddkr~|j}|sgPn|d}||}qAW|jd}||j}e|}d} d||jf} y | |UWnejj d| qX|j | ne j|}|r|jdd\} } ||j}e|}d| | |f} y | |UWnejj d| qX|j | ne j|}|r |j } | d\}}|||!}e j|r|j d e |qej|sde|sF0           = PK!:W--findlinksto.pynuȯ#! /usr/bin/python2.7 # findlinksto # # find symbolic links to a path matching a regular expression import os import sys import re import getopt def main(): try: opts, args = getopt.getopt(sys.argv[1:], '') if len(args) < 2: raise getopt.GetoptError('not enough arguments', None) except getopt.GetoptError, msg: sys.stdout = sys.stderr print msg print 'usage: findlinksto pattern directory ...' sys.exit(2) pat, dirs = args[0], args[1:] prog = re.compile(pat) for dirname in dirs: os.path.walk(dirname, visit, prog) def visit(prog, dirname, names): if os.path.islink(dirname): names[:] = [] return if os.path.ismount(dirname): print 'descend into', dirname for name in names: name = os.path.join(dirname, name) try: linkto = os.readlink(name) if prog.search(linkto) is not None: print name, '->', linkto except os.error: pass if __name__ == '__main__': main() PK!H9 checkpip.pyonu[ fc@sYdZddlZddlZddlZddlZdZedkrUendS(sa Checks that the version of the projects bundled in ensurepip are the latest versions available. iNcCst}x~tjD]s\}}tjtjdj|jj d}|dd}||krt }dj|||GHqqW|rt j dndS(Ns$https://pypi.python.org/pypi/{}/jsontutf8tinfotversions<The latest version of {} on PyPI is {}, but ensurepip has {}i( tFalset ensurepipt _PROJECTStjsontloadsturllib2turlopentformattreadtdecodetTruetsystexit(t outofdatetprojectRtdatatupstream_version((s./usr/lib64/python2.7/Tools/scripts/checkpip.pytmain s   t__main__(t__doc__RRRRRt__name__(((s./usr/lib64/python2.7/Tools/scripts/checkpip.pyts      PK!) untabify.pynuȯ#! /usr/bin/python2.7 "Replace tabs with spaces in argument files. Print names of changed files." import os import sys import getopt def main(): tabsize = 8 try: opts, args = getopt.getopt(sys.argv[1:], "t:") if not args: raise getopt.error, "At least one file argument required" except getopt.error, msg: print msg print "usage:", sys.argv[0], "[-t tabwidth] file ..." return for optname, optvalue in opts: if optname == '-t': tabsize = int(optvalue) for filename in args: process(filename, tabsize) def process(filename, tabsize, verbose=True): try: f = open(filename) text = f.read() f.close() except IOError, msg: print "%r: I/O error: %s" % (filename, msg) return newtext = text.expandtabs(tabsize) if newtext == text: return backup = filename + "~" try: os.unlink(backup) except os.error: pass try: os.rename(filename, backup) except os.error: pass with open(filename, "w") as f: f.write(newtext) if verbose: print filename if __name__ == '__main__': main() PK!c3`` which.pycnu[ fc@szddlZejdd kr,ejd=nddlZddlZddlTdZdZedkrvendS( iNit.t(t*cCstjj|ddS(Ns (tsyststderrtwrite(tstr((s+/usr/lib64/python2.7/Tools/scripts/which.pytmsg sc Cstjdjtj}d}d}tjdrctjdd dkrctjd}tjd=nx]tjdD]N}d}x"|D]}tjj||}ytj|}Wntj k rqnXt |t st |dnpt |t }|d@rO|s|GH|d }q]|d |kr8d } nd } t | |nt |d |rtjd |d|}|rt dt|qqqW|sqt |dd}qqqqWtj|dS(NtPATHiRiis-ls: not a disk fileiIis same as: salso: s: not executablesls t s"ls -l" exit status: s : not found((tostenvirontsplittpathsepRtargvtpathtjointstatterrortS_ISREGtST_MODERtS_IMODEtsystemtreprtexit( tpathlisttststlonglisttprogtidenttdirtfilenametsttmodets((s+/usr/lib64/python2.7/Tools/scripts/which.pytmainsD$       t__main__(RR(RRR RRR#t__name__(((s+/usr/lib64/python2.7/Tools/scripts/which.pyts     + PK!QZ texcheck.pycnu[ fc@sdZddlZddlZddlZddlmZmZmZddlZdZ dZ gdZ ddZ edkreje ndS( s TeXcheck.py -- rough syntax checking on Python style LaTeX documents. Written by Raymond D. Hettinger Copyright (c) 2003 Python Software Foundation. All rights reserved. Designed to catch common markup errors including: * Unbalanced or mismatched parenthesis, brackets, and braces. * Unbalanced or mismatched \begin and \end blocks. * Misspelled or invalid LaTeX commands. * Use of forward slashes instead of backslashes for commands. * Table line size mismatches. Sample command line usage: python texcheck.py -k chapterheading -m lib/librandomtex *.tex Options: -m Munge parenthesis and brackets. [0,n) would normally mismatch. -k keyword: Keyword is a valid LaTeX command. Do not include the backslash. -d: Delimiter check only (useful for non-LaTeX files). -h: Help -s lineno: Start at lineno (useful for skipping complex sections). -v: Verbose. Trace the matching of //begin and //end blocks. iN(tiziptcounttislices \section \module \declaremodule \modulesynopsis \moduleauthor \sectionauthor \versionadded \code \class \method \begin \optional \var \ref \end \subsection \lineiii \hline \label \indexii \textrm \ldots \keyword \stindex \index \item \note \withsubitem \ttindex \footnote \citetitle \samp \opindex \noindent \exception \strong \dfn \ctype \obindex \character \indexiii \function \bifuncindex \refmodule \refbimodindex \subsubsection \nodename \member \chapter \emph \ASCII \UNIX \regexp \program \production \token \productioncont \term \grammartoken \lineii \seemodule \file \EOF \documentclass \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp \tableofcontents \kbd \programopt \envvar \refstmodindex \cfunction \constant \NULL \moreargs \cfuncline \cdata \textasciicircum \n \ABC \setindexsubitem \versionchanged \deprecated \seetext \newcommand \POSIX \pep \warning \rfc \verbatiminput \methodline \textgreater \seetitle \lineiv \funclineni \ulink \manpage \funcline \dataline \unspecified \textbackslash \mimetype \mailheader \seepep \textunderscore \longprogramopt \infinity \plusminus \shortversion \version \refmodindex \seerfc \makeindex \makemodindex \renewcommand \indexname \appendix \protect \indexiv \mbox \textasciitilde \platform \seeurl \leftmargin \labelwidth \localmoduletable \LaTeX \copyright \memberline \backslash \pi \centerline \caption \vspace \textwidth \menuselection \textless \makevar \csimplemacro \menuselection \bfcode \sub \release \email \kwindex \refexmodindex \filenq \e \menuselection \exindex \linev \newsgroup \verbatim \setshortversion \author \authoraddress \paragraph \subparagraph \cmemberline \textbar \C \seelink cCsry|j\}}Wn!tk r9d||fGHdSX||j||gkrYdSd||||fGHdS(sCVerify that closing delimiter matches most recent opening delimitersU Delimiter mismatch. On line %d, encountered closing '%s' without corresponding openNsJ Opener '%s' on line %d was not closed before encountering '%s' on line %d(tpopt IndexErrortget(tc_linenotc_symboltopenerstpairmapto_linenoto_symbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt matchclose?s c#CsPtjd}tjd}ttj}x|D]}|jd|q7Wd|kruidd6dd6}nid d6d d6}td}tjd } tjd } tjd } tjd} g} g}tjd}tjd}tjd}d}d}t|jdd}d}xtt |t ||dd/D]\}}|j }x| j |D]\}}}d|kr|GdG|G|G|Gn|dkrd|kr| j||fnr||kr| j||fnP|dkr2d|kr2t||| |n"||krTt||| |nd|krdG| GHqqWxv| j |D]e\}}|dkr|j|n|dkry|jWqtk rd|fGHqXqqWd|krqZnxW|j |D]F}d |ks d!|kr/q nd||kr d"||fGHq q Wx)| j |D]}d#|||fGHqeW|jd$}|d%kr|jd|}|jd|}|j||d|!nx5|j |D]$}||krd&||fGHqqW|j|}|r@|jd}|}n|j|}|r|jd|krd'|jd|||fGHn|j|rd}nd(|ksd)|krd*|fGHnx&| j |D]} d+| |fGHqWqZW|}!x#| D]\}}"d,|"|fGHqWx|D]}d-|fGHq*Wd.|!fGHdS(0sCheck the LaTeX formatting in a sequence of lines. Opts is a mapping of options to option values if any: -m munge parenthesis and brackets -d delimiters only checking -v verbose trace of delimiter matching -s lineno: linenumber to start scan (default is 1). Morecmds is a sequence of LaTeX commands (without backslashes) that are to be considered valid in the scan. s \\[A-Za-z]+s \/([A-Za-z]+)s\s-ms[(t]s([t)t[t(s&\\(begin|end){([_a-zA-Z]+)}|([()\[\]])s({)|(})s(\b[A-za-z]+\b) \b\1\bs<\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\ss\\begin{(?:long)?table([iv]+)}s\\line([iv]+){s\\end{(?:long)?table([iv]+)}tis-st1is-vt|tbegins-dtends --> t{t}s Warning, unmatched } on line %s.t822s.htmls4Warning, forward slash used on line %d with cmd: /%ss2Warning, \%s should be written as \%s{} on line %ds \newcommandis(Warning, unknown tex cmd on line %d: \%ss>Warning, \line%s on line %d does not match \table%s on line %dse.g.si.e.s2Style warning, avoid use of i.e or e.g. on line %ds&Doubled word warning. "%s" on line %ds(Unmatched open delimiter '%s' on line %dsUnmatched { on line %dsDone checking %d lines.N(tretcompiletsettcmdstrtsplittaddtintRRRRtNonetrstriptfindalltappendR RRtfindtsearchtgroup(#tsourcetoptstmorecmdsttexcmdt falsetexcmdt validcmdstcmdR t openpunctt delimiterstbracest doubledwordst spacingmarkupRt bracestackt tablestartt tablelinettableendt tablelevelttablestartlinet startlinetlinenotlinetbegendtnametpuncttopentclosetnctstartRtmtdwtlastlinetsymbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytcheckitJs    2            !   c Cs|dkrtjd}ntj|d\}}t|}d|ksX|gkratGHdSt|dkr|dGHdSxOt|D]A\}}d|ksd|krtj||||d+qqWg|D]\}}|dkr|^q}g} x}|D]u} d d GHd G| GHyt | } Wnt k rOd |dGHd SXz| j t | ||Wd| j XqWt| S(Nisk:mdhs:vs-his#Please specify a file to be checkedt*t?s-kt=itCheckingsCannot open file %s.i(R tsystargvtgetopttdictt__doc__tlent enumeratetglobR?tIOErrorR#RGR@tmax( targstoptitemstarglistR(titfilespectktvR)terrtfilenametf((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytmains6  !+     t__main__(RPRRLRNt itertoolsRRRRSRR RGR R`t__name__texit(((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyts     z $ PK!x methfix.pyonu[ fc@sddlZddlZddlZddlTejjZeZejjZ dZ ej dZ dZ dZdZdZej eZd Zed kre ndS( iN(t*cCsd}tjds<tdtjddtjdnx}tjdD]n}tjj|rzt|rd}qqJtjj|rt|dd}qJt |rJd}qJqJWtj|dS(Niisusage: s file-or-directory ... is": will not process symbolic links ( tsystargvterrtexittostpathtisdirt recursedowntislinktfix(tbadtarg((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytmain&s    s^[a-zA-Z0-9_]+\.py$cCstj|dkS(Ni(t ispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytispython6scCs1td|fd}ytj|}Wn+tjk rW}td||fdSX|jg}x|D]}|tjtjfkrqontjj ||}tjj |rqotjj |r|j |qot |rot|rd}qqoqoWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR RtappendRR R(tdirnameR tnamestmsgtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR9s0      c Csyt|d}Wn(tk r=}td||fdSXtjj|\}}tjj|d|}d}d}x |j}|sPn|d}|dkrd|krt|d|j dS|dkrc|dkrc|d d krc|dj} | rct j d | ddkrc|d | d}|d }t||j dSnx>|d dkr|j} | sPn|| }|d}qfWt |} | |krj|dkr7yt|d}Wn2tk r}|j td||fdSX|j dd}t|dq~ntt|dtd|td| n|dk r~|j| q~q~W|j |sdSy+tj|} tj|| td@Wn*tjk r}td||fnXytj||dWn*tjk r:}td||fnXytj||Wn+tjk r|}td||fdSXdS(Ntrs%s: cannot open: %r it@iss!: contains null bytes; not fixed is#!s [pP]ythons: s script; not fixed is\ tws%s: cannot create: %r s: s s< s> is%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) (topentIOErrorRRRtsplitRtNonetreadlinetclosetretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename( tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR Os   ("            s8^[ ]+def +[a-zA-Z0-9_]+ *( *self *, *(( *(.*) *)) *) *:cCs[tj|dkrWtjdd!\\}}\}}|| |||!||}n|S(Niii(tfixprogRtregs(R;tatbtctd((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR+s" t__main__(RR)RR0tstderrR/RRtstdoutR-R tcompileRRRR tfixpatR@R+t__name__(((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyts          R  PK! vvv byteyears.pyonu[ fc@sQddlZddlZddlZddlTdZedkrMendS(iN(t*c Csy tj}Wntk r)tj}nXtjddkrPt}tjd=nRtjddkrvt}tjd=n,tjddkrt}tjd=nt}d }tj}d}d}x*tjdD]}t |t |}qWxtjdD]}y||}Wn<tj k rO}tj j d ||fd}d }nX|r||} |t} || } t| t| |} |j|Gtt| jd GHqqWtj|dS(Nis-ms-cs-agv@g8@g @iscan't stat %r: %r ig@g8~A((tostlstattAttributeErrortstattsystargvtST_MTIMEtST_CTIMEttimetmaxtlenterrortstderrtwritetST_SIZEtfloattljusttreprtinttrjusttexit( tstatfunctitimet secs_per_yeartnowtstatustmaxlentfilenametsttmsgtanytimetsizetaget byteyears((s//usr/lib64/python2.7/Tools/scripts/byteyears.pytmain sF            !t__main__(RRR RR#t__name__(((s//usr/lib64/python2.7/Tools/scripts/byteyears.pyt s$  0 PK!N66 fixdiv.pycnu[ fc@sdZddlZddlZddlZddlZdadZdZdZdZ dZ d Z d Z d dd YZ d ZdZedkrejendS(s(fixdiv - tool to fix division operators. To use this tool, first run `python -Qwarnall yourscript.py 2>warnings'. This runs the script `yourscript.py' while writing warning messages about all uses of the classic division operator to the file `warnings'. The warnings look like this: :: DeprecationWarning: classic division The warnings are written to stderr, so you must use `2>' for the I/O redirect. I know of no way to redirect stderr on Windows in a DOS box, so you will have to modify the script to set sys.stderr to some kind of log file if you want to do this on Windows. The warnings are not limited to the script; modules imported by the script may also trigger warnings. In fact a useful technique is to write a test script specifically intended to exercise all code in a particular module or set of modules. Then run `python fixdiv.py warnings'. This first reads the warnings, looking for classic division warnings, and sorts them by file name and line number. Then, for each file that received at least one warning, it parses the file and tries to match the warnings up to the division operators found in the source code. If it is successful, it writes its findings to stdout, preceded by a line of dashes and a line of the form: Index: If the only findings found are suggestions to change a / operator into a // operator, the output is acceptable input for the Unix 'patch' program. Here are the possible messages on stdout (N stands for a line number): - A plain-diff-style change ('NcN', a line marked by '<', a line containing '---', and a line marked by '>'): A / operator was found that should be changed to //. This is the recommendation when only int and/or long arguments were seen. - 'True division / operator at line N' and a line marked by '=': A / operator was found that can remain unchanged. This is the recommendation when only float and/or complex arguments were seen. - 'Ambiguous / operator (..., ...) at line N', line marked by '?': A / operator was found for which int or long as well as float or complex arguments were seen. This is highly unlikely; if it occurs, you may have to restructure the code to keep the classic semantics, or maybe you don't care about the classic semantics. - 'No conclusive evidence on line N', line marked by '*': A / operator was found for which no warnings were seen. This could be code that was never executed, or code that was only executed with user-defined objects as arguments. You will have to investigate further. Note that // can be overloaded separately from /, using __floordiv__. True division can also be separately overloaded, using __truediv__. Classic division should be the same as either of those. (XXX should I add a warning for division on user-defined objects, to disambiguate this case from code that was never executed?) - 'Phantom ... warnings for line N', line marked by '*': A warning was seen for a line not containing a / operator. The most likely cause is a warning about code executed by 'exec' or eval() (see note below), or an indirect invocation of the / operator, for example via the div() function in the operator module. It could also be caused by a change to the file between the time the test script was run to collect warnings and the time fixdiv was run. - 'More than one / operator in line N'; or 'More than one / operator per statement in lines N-N': The scanner found more than one / operator on a single line, or in a statement split across multiple lines. Because the warnings framework doesn't (and can't) show the offset within the line, and the code generator doesn't always give the correct line number for operations in a multi-line statement, we can't be sure whether all operators in the statement were executed. To be on the safe side, by default a warning is issued about this case. In practice, these cases are usually safe, and the -m option suppresses these warning. - 'Can't find the / operator in line N', line marked by '*': This really shouldn't happen. It means that the tokenize module reported a '/' operator but the line it returns didn't contain a '/' character at the indicated position. - 'Bad warning for line N: XYZ', line marked by '*': This really shouldn't happen. It means that a 'classic XYZ division' warning was read with XYZ being something other than 'int', 'long', 'float', or 'complex'. Notes: - The augmented assignment operator /= is handled the same way as the / operator. - This tool never looks at the // operator; no warnings are ever generated for use of this operator. - This tool never looks at the / operator when a future division statement is in effect; no warnings are generated in this case, and because the tool only looks at files for which at least one classic division warning was seen, it will never look at files containing a future division statement. - Warnings may be issued for code not read from a file, but executed using an exec statement or the eval() function. These may have in the filename position, in which case the fixdiv script will attempt and fail to open a file named '' and issue a warning about this failure; or these may be reported as 'Phantom' warnings (see above). You're on your own to deal with these. You could make all recommended changes and add a future division statement to all affected files, and then re-run the test script; it should not issue any warnings. If there are any, and you have a hard time tracking down where they are generated, you can use the -Werror option to force an error instead of a first warning, generating a traceback. - The tool should be run from the same directory as that from which the original script was run, otherwise it won't be able to open files given by relative pathnames. iNic CsJy#tjtjdd\}}Wn!tjk rF}t|dSXx>|D]6\}}|dkrotGHdS|dkrNdaqNqNW|stddS|drtjjdtjdnt |d}|dkrdS|j }|sd G|dGHdS|j d}x-|D]%}t |||} |p?| }qW|S( Nithmis-hs-ms&at least one file argument is requireds!%s: extra file arguments ignored is&No classic division warnings read from(tgetopttsystargvterrortusaget__doc__tmulti_oktstderrtwritet readwarningstNonetkeystsorttprocess( toptstargstmsgtotatwarningstfilestexittfilenametx((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytmains:#           cCs[tjjdtjd|ftjjdtjdtjjdtjddS(Ns%s: %s isUsage: %s [-m] warnings s"Try `%s -h' for more information. (RRR R(R((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRs!sL^(.+?):(\d+): DeprecationWarning: classic (int|long|float|complex) division$c Cs"tjt}yt|}Wn(tk rI}tjjd|dSXi}x|j}|siPn|j |}|s|j ddkrStjjd|qSqSn|j \}}} |j |} | dkrg||<} n| jt|t| fqSW|j|S(Nscan't open: %s tdivisionisWarning: ignored input (tretcompiletPATTERNtopentIOErrorRRR treadlinetmatchtfindtgroupstgetR tappendtinttinterntclose( t warningsfiletprogtfRRtlinetmRtlinenotwhattlist((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR s.  # cCs@ddGH|styt|}Wn(tk rO}tjjd|dSXdG|GHt|}|jd}tj |j }xt |\}}} } |dkrPn||kodk nstg} xE|t |kr"||d|kr"| j|||d7}qW| r9t| |ng} xE|t |kr||d|kr| j|||d7}qBW| r| rq| r| rt| dq| r| rt| |qt | dkrtsg} d}x?| D]7\\}}}||kr!qn| j||}qW| sDtt | dkrfdG| dGHqd Gd | d| d fGHqng}g}g}xY| D]Q\}}|dkr|j|q|dkr|j|q|j|qWd}x0| D](\\}}}||kr&qn|}t|}|||d!dkrgd|GHdG|GHqn|rd|G|GHdG|GHq|r| rd||fGHdG|GHdGHdG|| d||GHq|r| rd|GHdG|GHq|r|rddj|dj||fGHdG|GHqqWqW|jdS(Nt-iFscan't open: %s isIndex:isNo conclusive evidences$*** More than one / operator in lines**** More than one / operator per statementsin lines %d-%diR&tlongtfloattcomplext/s)*** Can't find the / operator in line %d:t*s*** Bad warning for line %d:s%dc%dts$True division / operator at line %d:t=s-*** Ambiguous / operator (%s, %s) at line %d:t|t?(R&R2(R3R4(tAssertionErrorRRRRR t FileContextR ttokenizetgenerate_tokensR tscanlineR tlenR%treportphantomwarningstreportRtchoptjoinR((RR0tfpRR+tindextgt startlinenot endlinenotslashestlineinfotorphansRtrowstlastrowtrowtcolR,tintlongt floatcomplextbadR.R/((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRs      "))                    !c Csg}d}d}xF|D]>\}}||krJ|g}|j|n|j|qWxM|D]E}|d}dj|d}d||fGH|j|ddqbWdS(NiR5is$*** Phantom %s warnings for line %d:tmarkR6(R R%RERC( RR+tblocksROt lastblockRPR/tblocktwhats((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRB$s    cCsZd}xM|D]E\\}}}||kr d||fGHdGt|GH|}q q WdS(Ns*** %s on line %d:R6(R RD(RKtmessageRORPRQR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRC3s  R=cBsAeZdddZdZdZdZdddZRS( iicCs:||_d|_d|_d|_g|_g|_dS(Niii(RFtwindowR.t eoflookaheadt lookaheadtbuffer(tselfRFR[R.((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt__init__<s      cCs_xXt|j|jkrZ|j rZ|jj}|sGd|_Pn|jj|qWdS(Ni(RAR]R[R\RFR R%(R_R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytfillCs % cCsL|j|jsdS|jjd}|jj||jd7_|S(Ntii(RaR]tpopR^R%R.(R_R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR Js  cCs|j|jt|j}|jt|j}||koP|jknrd|j||S|j|ko~|knr|j||jStdS(N(RaR.RAR^R]tKeyError(R_RGtbufstarttlookend((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt __getitem__Rs R6cCsn|dkr|}nxRt||dD]=}y||}Wntk rVd}nX|Gt|GHq)WdS(Nis(R trangeRdRD(R_tfirsttlastRUtiR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRC[s    N(t__name__t __module__R`RaR RgR RC(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR=;s    c Csg}d}d}xq|D]i\}}}}}|d}|dkrM|}n|dkro|j||fn|tjkrPqqW|||fS(NiR5s/=(R5s/=(R R%R>tNEWLINE( RHRKRIRJttypettokentstarttendR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR@es    cCs|jdr|d S|SdS(Ns i(tendswith(R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRDsst__main__((RRRRR>RRRRR RRBRCR=R@RDRlR(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyts"       W  *   PK!8>}EE objgraph.pyonu[ fc@sddlZddlZddlZddlZdZdZdZejdZdZ dZ iZ iZ iZ iZdZd Zd Zd Zd Zd ZedkryejeWqek rejdqXndS(iNt TRGDSBAECtUVt Nntrgdsbavucs(.*): ?........ (.) (.*)$cCs4|j|r#||j|n |g||s0          5  PK!]o#combinerefs.pyonu[ fc@sTdZddlZddlZdZdZedkrPeejdndS(sL combinerefs path A helper for analyzing PYTHONDUMPREFS output. When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown time Py_Finalize() prints the list of all live objects twice: first it prints the repr() of each object while the interpreter is still fully intact. After cleaning up everything it can, it prints all remaining live objects again, but the second time just prints their addresses, refcounts, and type names (because the interpreter has been torn down, calling repr methods at this point can get into infinite loops or blow up). Save all this output into a file, then run this script passing the path to that file. The script finds both output chunks, combines them, then prints a line of output for each object still alive at the end: address refcnt typename repr address is the address of the object, in whatever format the platform C produces for a %p format code. refcnt is of the form "[" ref "]" when the object's refcount is the same in both PYTHONDUMPREFS output blocks, or "[" ref_before "->" ref_after "]" if the refcount changed. typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS output block. repr is repr(object), extracted from the first PYTHONDUMPREFS output block. CAUTION: If object is a container type, it may not actually contain all the objects shown in the repr: the repr was captured from the first output block, and some of the containees may have been released since then. For example, it's common for the line showing the dict of interned strings to display strings that no longer exist at the end of Py_Finalize; this can be recognized (albeit painfully) because such containees don't have a line of their own. The objects are listed in allocation order, with most-recently allocated printed first, and the first object allocated printed last. Simple examples: 00857060 [14] str '__len__' The str object '__len__' is alive at shutdown time, and both PYTHONDUMPREFS output blocks said there were 14 references to it. This is probably due to C modules that intern the string "__len__" and keep a reference to it in a file static. 00857038 [46->5] tuple () 46-5 = 41 references to the empty tuple were removed by the cleanup actions between the times PYTHONDUMPREFS produced output. 00858028 [1025->1456] str '' The string '', which is used in dictobject.c to overwrite a real key that gets deleted, grew several hundred references during cleanup. It suggests that stuff did get removed from dicts by cleanup, but that the dicts themselves are staying alive for some reason. iNccs9x2|D]*}t|j||kr0|VqPqWdS(N(tbooltmatch(tfileitertpatt whilematchtline((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytreadQs c Cst|}t|}x#t|tjdtD]}q4Wtjd}i}i}d}xkt|tjdtD]N}|j|}|r|j\} || <|| <|d7}q{dG|GHq{Wd} xt||tD]}| d7} |j|}|j\} } } | |kr;dG|j GHqn| G| || krZd| Gnd || | fG| G|| GHqW|j d || fGHdS( Ns^Remaining objects:$s([a-zA-Z\d]+) \[(\d+)\] (.*)is^Remaining object addresses:$is ??? skipped:s*??? new object created while tearing down:s[%s]s[%s->%s]s%d objects before, %d after( tfiletiterRtretcompiletFalseRtgroupstTruetrstriptclose( tfnametftfiRtcracktaddr2rct addr2gutstbeforetmtaddrtaftertrctguts((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytcombineXs:  ""      t__main__i(t__doc__R tsysRRt__name__targv(((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytFs     & PK!jv google.pynuȯ#! /usr/bin/python2.7 import sys, webbrowser def main(): args = sys.argv[1:] if not args: print "Usage: %s querystring" % sys.argv[0] return list = [] for arg in args: if '+' in arg: arg = arg.replace('+', '%2B') if ' ' in arg: arg = '"%s"' % arg arg = arg.replace(' ', '+') list.append(arg) s = '+'.join(list) url = "http://www.google.com/search?q=%s" % s webbrowser.open(url) if __name__ == '__main__': main() PK!-Ő nm2def.pyonu[ fc@sdZddlZddlZdejd dZdejdejdd Zd ZeddZdZdZ dZ e dZ dZ e dkre ndS(sEnm2def.py Helpers to extract symbols from Unix libs and auto-generate Windows definition files from them. Depends on nm(1). Tested on Linux and Solaris only (-p option to nm is for Solaris only). By Marc-Andre Lemburg, Aug 1998. Additional notes: the output of nm is supposed to look like this: acceler.o: 000001fd T PyGrammar_AddAccelerators U PyGrammar_FindDFA 00000237 T PyGrammar_RemoveAccelerators U _IO_stderr_ U exit U fprintf U free U malloc U printf grammar1.o: 00000000 T PyGrammar_FindDFA 00000034 T PyGrammar_LabelRepr U _PyParser_TokenNames U abort U printf U sprintf ... Even if this isn't the default output of your nm, there is generally an option to produce this format (since it is the original v7 Unix format). iNt libpythonis.atPythoniis.dlls nm -p -g %stTtCtDc Cstjt|j}g|D]}|j^q }i}x|D]}t|dksEd|kroqEn|j}t|dkrqEn|\}}} ||krqEn||f|| $s    PK!G_o##patchcheck.pyonu[ fc@sddlZddlZddlZddlZddlZddlZddlZddlZej j dddej j dddej j dddej j ddej j ddgZ ej d Z d Zedd Zd Zd ZeddddZedddddZdZeddedZeddedZejdZeddedZeddedZed ded!Zed"ded#Zd$Z e!d%kre ndS(&iNtModulest_ctypestlibffit libffi_osxt libffi_msvctexpattzlibtsrcdircCs"dj||dkrdndS(s7Return 'N file(s)' with the proper plurality on 'file'.s {} file{}itst(tformat(tcount((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt n_files_strscsfd}|S(s*Decorator to output status info to stdout.csfd}|S(Ncsotjjdtjj||} rF rFdGHn%rZ|GHn|rfdndGH|S(Ns ... tdonetyestNO(tsyststdouttwritetflush(targstkwargstresult(tfxntinfotmessagetmodal(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcall_fxns ((RR(RRR(Rs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt decorated_fxns ((RRRR((RRRs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytstatuss cCsBdj}ytj|dtjSWntjk r=dSXdS(s0Get the symbolic name for the current git branchsgit rev-parse --abbrev-ref HEADtstderrN(tsplitt subprocesst check_outputtPIPEtCalledProcessErrortNone(tcmd((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_branch.s  cCsBdj}ytj|dtjWntjk r=dSXdS(skGet the remote name to use for upstream branches Uses "upstream" if it exists, "origin" otherwise sgit remote get-url upstreamRtorigintupstream(RR R!R"R#(R%((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_upstream_remote7s  sGetting base branch for PRRcCs|dk r|SdS(Nsnot a PR branch(R$(tx((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytER cCstjjtjjtds%dStj}|jdkrFd}ndj |}t }|dksv||krzdSt }|d|S(Ns.gittalphatmasters{0.major}.{0.minor}t/( tostpathtexiststjointSRCDIRR$Rt version_infot releaselevelR R&R)(tversiont base_brancht this_branchtupstream_remote((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_base_branchDs!    s6Getting the list of files that have been added/changedcCstt|S(N(R tlen(R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyR+XR csvtjjtjjtdr |r4d|}nd}g}tj|jdtj}zx|j D]}|j j }|jd d\}t |}|jdsqkndkrjdddjn|jqkWWd |j jXn tjd g}xO|D]Gtjjtfd tDraq'n|jq'W|S( s0Get the list of changed or added files from git.s.gitsgit diff --name-status sgit status --porcelainRitMAUs -> iNs)need a git checkout to get modified filesc3s|]}j|VqdS(N(t startswith(t.0R0(tfilename(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys zs(R/R0R1R2R3R tPopenRR"RtdecodetrstripR$tsett intersectiontstriptappendtcloseRtexittnormpathtanyt EXCLUDE_DIRS(R7R%t filenameststtlinet status_textRt filenames2((R?s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt changed_filesWs2!     cCsrt|}|dkr"t|Sdjt|g}x$|D]}|jdj|qAWdj|SdS(Nis{}:s {}s (R;R R RFR2(t file_pathsR tlinesR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytreport_modified_filess    sFixing whitespacecCs\tt_g}xFd|DD]4}tjtjjt|r |j|q q W|S(sAMake sure that the whitespace for .py files have been normalized.css$|]}|jdr|VqdS(s.pyN(tendswith(R>R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys s( tFalsetreindentt makebackuptcheckR/R0R2R3RF(RRtfixedR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_whitespaces  sFixing C file whitespacecCsg}xv|D]n}tjjt|}t|d}d|jkrRw nWdQXtj|ddt|j |q W|S(sReport if any C files trs Nitverbose( R/R0R2R3topentreadtuntabifytprocessRVRF(RRRZR0tabspathtf((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_c_whitespaces  s \s+(\r?\n)$sFixing docs whitespacec Csg}x|D]}tjjt|}yt|d}|j}WdQXg|D]}tjd|^qV}||krtj ||dt|d}|j |WdQX|j |nWq t k r}d||fGHq Xq W|S(Ntrbs\1s.baktwbsCannot fix %s: %s( R/R0R2R3R^t readlinestws_retsubtshutiltcopyfilet writelinesRFt Exception( RRRZR0RbRcRSRNt new_linesterr((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_docs_whitespaces % s Docs modifiedRcCs t|S(s9Report if any file in the Doc directory has been changed.(tbool(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt docs_modifiedssMisc/ACKS updatedcCstjjdd|kS(s$Check if Misc/ACKS has been changed.tMisctACKS(R/R0R2(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt credit_givenss Misc/NEWS.d updated with `blurb`cCstd|DS(s&Check if Misc/NEWS.d has been changed.css0|]&}|jtjjdddVqdS(RssNEWS.dtnextN(R=R/R0R2(R>tp((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys s(RJ(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt reported_newss cCst}t|}g|D]}|jdr|^q}g|D]}|jd rD|^qD}g|D]*}|jdrl|jd rl|^ql}d|D}t|t|t|t|t|t ||s|r|rdnd }Hd |GHndS( Ns.pys.cs.htDocs.rsts.inccSs%h|]}|jdr|qS(Rs(R=(R>Rw((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys s s and check for refleaks?t?sDid you run the test suite(s.cs.h(s.rsts.inc( R:RQRUR=R[RdRpRrRuRx(R7RRtfnt python_filestc_filest doc_filest misc_filestend((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytmains"  ((       t__main__("treRRjtos.pathR/R t sysconfigRWR`R0R2RKtget_config_varR3R RVR$RR&R)R:RQRTR[RdtcompileRhRptTrueRrRuRxRt__name__(((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytsB            )    PK!Bpplfcr.pyonu[ fc@sMdZddlZddlZddlZdZedkrIendS(sFReplace LF with CRLF in argument files. Print names of changed files.iNcCsxtjdD]}tjj|r5|GdGHqnt|dj}d|kre|GdGHqntjdd|}||kr|GHt|d}|j ||j qqWdS( Nis Directory!trbssBinary!s ? s twb( tsystargvtostpathtisdirtopentreadtretsubtwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pytmains     t__main__(t__doc__RR RRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pyts$  PK! G findnocoding.pynuȯ#! /usr/bin/python2.7 """List all those Python files that require a coding directive Usage: nocoding.py dir1 [dir2...] """ __author__ = "Oleg Broytmann, Georg Brandl" import sys, os, re, getopt # our pysource module finds Python source files try: import pysource except ImportError: # emulate the module with a simple os.walk class pysource: has_python_ext = looks_like_python = can_be_compiled = None def walk_python_files(self, paths, *args, **kwargs): for path in paths: if os.path.isfile(path): yield path.endswith(".py") elif os.path.isdir(path): for root, dirs, files in os.walk(path): for filename in files: if filename.endswith(".py"): yield os.path.join(root, filename) pysource = pysource() print >>sys.stderr, ("The pysource module is not available; " "no sophisticated Python source file search will be done.") decl_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)') blank_re = re.compile(r'^[ \t\f]*(?:[#\r\n]|$)') def get_declaration(line): match = decl_re.match(line) if match: return match.group(1) return b'' def has_correct_encoding(text, codec): try: unicode(text, codec) except UnicodeDecodeError: return False else: return True def needs_declaration(fullpath): try: infile = open(fullpath, 'rU') except IOError: # Oops, the file was removed - ignore it return None line1 = infile.readline() line2 = infile.readline() if (get_declaration(line1) or blank_re.match(line1) and get_declaration(line2)): # the file does have an encoding declaration, so trust it infile.close() return False # check the whole file for non-ASCII characters rest = infile.read() infile.close() if has_correct_encoding(line1+line2+rest, "ascii"): return False return True usage = """Usage: %s [-cd] paths... -c: recognize Python source files trying to compile them -d: debug output""" % sys.argv[0] try: opts, args = getopt.getopt(sys.argv[1:], 'cd') except getopt.error, msg: print >>sys.stderr, msg print >>sys.stderr, usage sys.exit(1) is_python = pysource.looks_like_python debug = False for o, a in opts: if o == '-c': is_python = pysource.can_be_compiled elif o == '-d': debug = True if not args: print >>sys.stderr, usage sys.exit(1) for fullpath in pysource.walk_python_files(args, is_python): if debug: print "Testing for coding: %s" % fullpath result = needs_declaration(fullpath) if result: print fullpath PK!d8fOO dutree.pynuȯ#! /usr/bin/python2.7 # Format du output in a tree shape import os, sys, errno def main(): p = os.popen('du ' + ' '.join(sys.argv[1:]), 'r') total, d = None, {} for line in p.readlines(): i = 0 while line[i] in '0123456789': i = i+1 size = eval(line[:i]) while line[i] in ' \t': i = i+1 filename = line[i:-1] comps = filename.split('/') if comps[0] == '': comps[0] = '/' if comps[len(comps)-1] == '': del comps[len(comps)-1] total, d = store(size, comps, total, d) try: display(total, d) except IOError, e: if e.errno != errno.EPIPE: raise def store(size, comps, total, d): if comps == []: return size, d if not d.has_key(comps[0]): d[comps[0]] = None, {} t1, d1 = d[comps[0]] d[comps[0]] = store(size, comps[1:], t1, d1) return total, d def display(total, d): show(total, d, '') def show(total, d, prefix): if not d: return list = [] sum = 0 for key in d.keys(): tsub, dsub = d[key] list.append((tsub, key)) if tsub is not None: sum = sum + tsub ## if sum < total: ## list.append((total - sum, os.curdir)) list.sort() list.reverse() width = len(repr(list[0][0])) for tsub, key in list: if tsub is None: psub = prefix else: print prefix + repr(tsub).rjust(width) + ' ' + key psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1) if d.has_key(key): show(tsub, d[key][1], psub) if __name__ == '__main__': main() PK!oHq]] classfix.pyonu[ fc@sddlZddlZddlZddlTejjZeZejjZ dZ ej dZ dZ dZdZdZej eZd Zej eZd Zed kre ndS( iN(t*cCsd}tjds<tdtjddtjdnx}tjdD]n}tjj|rzt|rd}qqJtjj|rt|dd}qJt |rJd}qJqJWtj|dS(Niisusage: s file-or-directory ... is": will not process symbolic links ( tsystargvterrtexittostpathtisdirt recursedowntislinktfix(tbadtarg((s./usr/lib64/python2.7/Tools/scripts/classfix.pytmain)s    s^[a-zA-Z0-9_]+\.py$cCstj|dkS(Ni(t ispythonprogtmatch(tname((s./usr/lib64/python2.7/Tools/scripts/classfix.pytispython9scCs1td|fd}ytj|}Wn+tjk rW}td||fdSX|jg}x|D]}|tjtjfkrqontjj ||}tjj |rqotjj |r|j |qot |rot|rd}qqoqoWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR RtappendRR R(tdirnameR tnamestmsgtsubdirsRtfullname((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR<s0      c Csyt|d}Wn(tk r=}td||fdSXtjj|\}}tjj|d|}d}d}xG|j}|sPn|d}x>|ddkr|j} | sPn|| }|d}qWt |} | |kr|dkrryt|d}Wn2tk rJ}|j td ||fdSX|j dd}t |d q~nt t |d t d |t d | n|dk r~|j| q~q~W|j |sdSy+tj|} tj|| td@Wn*tjk r0}td||fnXytj||dWn*tjk ru}td||fnXytj||Wn+tjk r}td||fdSXdS(Ntrs%s: cannot open: %r it@iis\ tws%s: cannot create: %r s: s s< s> is%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) (topentIOErrorRRRtsplitRtNonetreadlinetfixlinetclosetseektreptreprtwritetstattchmodtST_MODERtrename( tfilenametfRtheadttailttempnametgtlinenotlinetnextlinetnewlinetstatbuf((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR Rsp           s-^([ ]*class +[a-zA-Z0-9_]+) *( *) *((=.*)?):s^ *(.*) *( *) *$cCstj|dkr|Stjd \\}}\}}\}}|| }||}||krm|d|S||d|!} | jd} x^tt| D]J} tj| | dkrtjd\} } | | | | !| | s$          E  PK!l8setup.pynu[from distutils.core import setup if __name__ == '__main__': setup( scripts=[ 'byteyears.py', 'checkpyc.py', 'copytime.py', 'crlf.py', 'dutree.py', 'ftpmirror.py', 'h2py.py', 'lfcr.py', '../i18n/pygettext.py', 'logmerge.py', '../../Lib/tabnanny.py', '../../Lib/timeit.py', 'untabify.py', ], ) PK!TFm logmerge.pycnu[ fc@sdZddlZddlZddlZddlZdddZdddZdZd Zdd Z d Z e d kry eWqe k rZejejkrqqXndS( sConsolidate a bunch of CVS or RCS logs read from stdin. Input should be the output of a CVS or RCS logging command, e.g. cvs log -rrelease14: which dumps all log messages from release1.4 upwards (assuming that release 1.4 was tagged with tag 'release14'). Note the trailing colon! This collects all the revision records and outputs them sorted by date rather than by file, collapsing duplicate revision record, i.e., records with the same message for different files. The -t option causes it to truncate (discard) the last revision log entry; this is useful when using something like the above cvs log command, which shows the revisions including the given tag, while you probably want everything *since* that tag. The -r option reverses the output (oldest first; the default is oldest last). The -b tag option restricts the output to *only* checkin messages belonging to the given branch tag. The form -b HEAD restricts the output to checkin messages belonging to the CVS head (trunk). (It produces some output if tag is a non-branch tag, but this output is not very useful.) -h prints this message and exits. XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7 from their output. iNt=iMs t-ic Cs(d}d}d }tjtjdd\}}xt|D]l\}}|dkrYd}q8|dkrnd}q8|dkr|}q8|dkr8tGHtjdq8q8Wg}xLttj}|sPnt||} |r| d=n| |t |)qW|j |s|j nt |d S( s Main programiistrb:hs-ts-rs-bs-hiN( tNonetgetopttsystargvt__doc__texitt read_chunktstdint digest_chunktlentsorttreverset format_output( t truncate_lastR tbranchtoptstargstotatdatabasetchunktrecords((s./usr/lib64/python2.7/Tools/scripts/logmerge.pytmain*s6          cCsg}g}xx|j}|s%Pn|tkrK|rG|j|nPn|tkrv|r|j|g}qq|j|qW|S(skRead a chunk -- data for one file, ending with sep1. Split the chunk in parts separated by sep2. (treadlinetsep1tappendtsep2(tfpRtlinestline((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRHs      cCs5|d}d}t|}x8|D]*}|| |kr#||j}Pq#q#Wd}|dkrfn"|dkrtjd}ni}d}d}x~|D]v}||krd}q|r|ddkr |j\} } | dd kr| d } n| || $s.0.t.t^s\.\d+$iisdate:t;t isauthor:itrevisionN( R tstripRtretcompiletsplittgettfindtreplacetescapetinserttmatchR(RRRtkeytkeylenRt working_filet revisionstfoundttagtrevRtrevlinetdatelinettexttwordstauthortdatewordttimewordtdate((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyR `sx           &    "   "  "   c Csd}g}|jdx|D]\}}}}}||kr|rtGx+|D]#\}} } } |G| G| G| GHqRWtjj|ng}n|j||||f|}q WdS(N(NNNNN(RRRRtstdoutt writelines( RtprevtexttprevR?R3R7R<R:tp_datetp_working_filetp_revtp_author((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRs   t__main__(RRterrnoRR(RRRRRR Rt__name__tIOErrortetEPIPE(((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyt#s0   E   PK!!0ee byteyears.pynuȯ#! /usr/bin/python2.7 # Print the product of age and size of each file, in suitable units. # # Usage: byteyears [ -a | -m | -c ] file ... # # Options -[amc] select atime, mtime (default) or ctime as age. import sys, os, time from stat import * def main(): # Use lstat() to stat files if it exists, else stat() try: statfunc = os.lstat except AttributeError: statfunc = os.stat # Parse options if sys.argv[1] == '-m': itime = ST_MTIME del sys.argv[1] elif sys.argv[1] == '-c': itime = ST_CTIME del sys.argv[1] elif sys.argv[1] == '-a': itime = ST_CTIME del sys.argv[1] else: itime = ST_MTIME secs_per_year = 365.0 * 24.0 * 3600.0 # Scale factor now = time.time() # Current time, for age computations status = 0 # Exit status, set to 1 on errors # Compute max file name length maxlen = 1 for filename in sys.argv[1:]: maxlen = max(maxlen, len(filename)) # Process each argument in turn for filename in sys.argv[1:]: try: st = statfunc(filename) except os.error, msg: sys.stderr.write("can't stat %r: %r\n" % (filename, msg)) status = 1 st = () if st: anytime = st[itime] size = st[ST_SIZE] age = now - anytime byteyears = float(size) * float(age) / secs_per_year print filename.ljust(maxlen), print repr(int(byteyears)).rjust(8) sys.exit(status) if __name__ == '__main__': main() PK!yIowin_add2path.pyonu[ fc@s}dZddlZddlZddlZddlZejZdZdZdZ dZ dZ e dkrye ndS( sAdd Python to the search path on Windows This is a simple script to add Python to the Windows search path. It modifies the current user (HKCU) tree of the registry. Copyright (c) 2008 by Christian Heimes Licensed to PSF under a Contributor Agreement. iNt EnvironmenttPATHu%PATH%c Csgtjjtjjtj}tjj|d}tjd}tt drt j j |d}tjj|d}nd}t jtt}yt j|td}Wntk rt}nX|g}xK|||fD]:}|r||krtjj|r|j|qqWtjj|}t j|tdt j|||fSWdQXdS(NtScriptstAPPDATAt USER_SITEs %APPDATA%i(tostpathtdirnametnormpathtsyst executabletjointenvironthasattrtsiteRtreplacetNonet_winregt CreateKeytHKCUtENVt QueryValueExRt WindowsErrortDEFAULTtisdirtappendtpathsept SetValueExt REG_EXPAND_SZ( t pythonpathtscriptstappdatatuserpatht userscriptstkeytenvpathtpathsR((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pytmodifys&!    $cCs`t\}}t|dkr;dGHdj|dGHndGHd|GHdGHtj|GHdS(NisPath(s) added:s sNo path was addeds PATH is now: %s s Expanded:(R%tlenR RtExpandEnvironmentStrings(R$R#((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pytmain-s t__main__( t__doc__R RRRtHKEY_CURRENT_USERRRRRR%R(t__name__(((s2/usr/lib64/python2.7/Tools/scripts/win_add2path.pyts       PK!S; findnocoding.pycnu[ fc@sdZdZddlZddlZddlZddlZyddlZWn:ek rdddYZeZejdIJnXej dZ ej dZ d Z d Z d Zd ejd Zy#ejejdd\ZZWn=ejk r5ZejeIJejeIJejdnXejZeZxAeD]9\ZZedkrpejZqLedkrLeZqLqLWesejeIJejdnxFejeeD]2ZerdeGHneeZ e reGHqqWdS(s_List all those Python files that require a coding directive Usage: nocoding.py dir1 [dir2...] sOleg Broytmann, Georg BrandliNtpysourcecBseZdZZZdZRS(c osx|D]}tjj|r0|jdVqtjj|rxZtj|D]F\}}}x4|D],}|jdrhtjj||VqhqhWqRWqqWdS(Ns.py(tostpathtisfiletendswithtisdirtwalktjoin( tselftpathstargstkwargsRtroottdirstfilestfilename((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytwalk_python_filess  N(t__name__t __module__tNonethas_python_exttlooks_like_pythontcan_be_compiledR(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pyRss^The pysource module is not available; no sophisticated Python source file search will be done.s&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCs&tj|}|r"|jdSdS(Nit(tdecl_retmatchtgroup(tlineR((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytget_declaration&s cCs.yt||Wntk r%tSXtSdS(N(tunicodetUnicodeDecodeErrortFalsetTrue(ttexttcodec((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pythas_correct_encoding,s  cCsyt|d}Wntk r'dSX|j}|j}t|sgtj|rut|ru|jtS|j }|jt |||drtSt S(NtrUtascii( topentIOErrorRtreadlineRtblank_reRtcloseRtreadR#R (tfullpathtinfiletline1tline2trest((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytneeds_declaration4s       sjUsage: %s [-cd] paths... -c: recognize Python source files trying to compile them -d: debug outputiitcds-cs-dsTesting for coding: %s((!t__doc__t __author__tsysRtretgetoptRt ImportErrortstderrtcompileRR)RR#R1targvtusagetoptsR terrortmsgtexitRt is_pythonRtdebugtotaRR RR,tresult(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytsH0     #          PK!{{serve.pynuȯ#! /usr/bin/python2.7 ''' Small wsgiref based web server. Takes a path to serve from and an optional port number (defaults to 8000), then tries to serve files. Mime types are guessed from the file names, 404 errors are raised if the file is not found. Used for the make serve target in Doc. ''' import sys import os import mimetypes from wsgiref import simple_server, util def app(environ, respond): fn = os.path.join(path, environ['PATH_INFO'][1:]) if '.' not in fn.split(os.path.sep)[-1]: fn = os.path.join(fn, 'index.html') type = mimetypes.guess_type(fn)[0] if os.path.exists(fn): respond('200 OK', [('Content-Type', type)]) return util.FileWrapper(open(fn)) else: respond('404 Not Found', [('Content-Type', 'text/plain')]) return ['not found'] if __name__ == '__main__': path = sys.argv[1] port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000 httpd = simple_server.make_server('', port, app) print "Serving %s on port %s, control-C to stop" % (path, port) try: httpd.serve_forever() except KeyboardInterrupt: print "\b\bShutting down." PK!3R== serve.pyonu[ fc@sdZddlZddlZddlZddlmZmZdZedkrej dZ e ej dkre ej dndZ ejd e eZd e e fGHyejWqek rd GHqXndS( s  Small wsgiref based web server. Takes a path to serve from and an optional port number (defaults to 8000), then tries to serve files. Mime types are guessed from the file names, 404 errors are raised if the file is not found. Used for the make serve target in Doc. iN(t simple_servertutilcCstjjt|dd}d|jtjjdkrTtjj|d}ntj|d}tjj|r|dd|fgtj t |S|d d gd gSdS( Nt PATH_INFOit.is index.htmlis200 OKs Content-Types 404 Not Founds text/plains not found(s Content-Types text/plain( tostpathtjointsplittsept mimetypest guess_typetexistsRt FileWrappertopen(tenvirontrespondtfnttype((s+/usr/lib64/python2.7/Tools/scripts/serve.pytapp st__main__iii@ts(Serving %s on port %s, control-C to stopsShutting down.(t__doc__tsysRR twsgirefRRRt__name__targvRtlentinttportt make_serverthttpdt serve_forevertKeyboardInterrupt(((s+/usr/lib64/python2.7/Tools/scripts/serve.pyts      . PK!ܽ\kcleanfuture.pycnu[ fc@sdZddlZddlZddlZddlZdadadadZdZ dZ dd dYZ e d kre ndS( scleanfuture [-d][-r][-v] path ... -d Dry run. Analyze, but don't make any changes to, files. -r Recurse. Search for all .py files in subdirectories too. -v Verbose. Print informative msgs. Search Python (.py) files for future statements, and remove the features from such statements that are already mandatory in the version of Python you're using. Pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. Overwrites files in place, renaming the originals with a .bak extension. If cleanfuture finds nothing to change, the file is left alone. If cleanfuture does change a file, the changed file is a fixed-point (i.e., running cleanfuture on the resulting .py file won't change it again, at least not until you try it again with a later Python release). Limitations: You can do these things, but this tool won't help you then: + A future statement cannot be mixed with any other statement on the same physical line (separated by semicolon). + A future statement cannot contain an "as" clause. Example: Assuming you're using Python 2.2, if a file containing from __future__ import nested_scopes, generators is analyzed by cleanfuture, the line is rewritten to from __future__ import generators because nested_scopes is no longer optional in 2.2 but generators is. iNicGsOtt|}dj|}|ddkr;|d7}ntjj|dS(Nt is (tmaptstrtjointsyststderrtwrite(targststringstmsg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyterrprint2s  cCsddl}y#|jtjdd\}}Wn!|jk rR}t|dSXx_|D]W\}}|dkrtd7aqZ|dkrtd7aqZ|dkrZtd7aqZqZW|stdtdSx|D]}t |qWdS(Niitdrvs-ds-rs-vsUsage:( tgetoptRtargvterrorR tdryruntrecursetverboset__doc__tcheck(R toptsRR totatarg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pytmain9s$ #        cCstjj|rtjj| rtr7dG|GHntj|}xp|D]h}tjj||}trtjj|rtjj| s|jj drMt |qMqMWdStrdG|GdGnyt |}Wn.t k r}t d|t|fdSXt||}|j}|rA|jn|j|rtrmdGHtrmdGHqmnxw|D]o\}} } d||d | d fGHx&t|| d D]} |j| GqW| dkrd GHqtd GH| GqtWts|d } tjj| rtj| ntj|| trCd G|GdG| GHnt |d} |j| | jtr~dG|GHq~qntrdGHndS(Nslisting directorys.pytcheckings...s%r: I/O Error: %sschanged.s+But this is a dry run, so leaving it alone.s%r lines %d-%dis -- deleteds -- change to:s.baktrenamedttotws wrote news unchanged.(tostpathtisdirtislinkRtlistdirRRtlowertendswithRtopentIOErrorR Rt FutureFindertrunt gettheresttcloseRtrangetlinestNonetexiststremovetrenameR(tfiletnamestnametfullnametfR tfftchangedtstetlinetitbaktg((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyRNsd%          R&cBs5eZdZdZdZdZdZRS(cCs1||_||_d|_g|_g|_dS(Ni(R4tfnametateofR+R6(tselfR4R=((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt__init__s     cCsH|jr dS|jj}|dkr4d|_n|jj||S(Nti(R>R4treadlineR+tappend(R?R9((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pytgetlines   cCs tj}tj}tj}tj}tj}tj}|j}tj|j j }|\} } \} } \} }}x=| |||fkr|\} } \} } \} }}q{Wx4| |kr|\} } \} } \} }}qWxx=| |||fkr1|\} } \} } \} }}qW| |koG| dksNPn| d}|\} } \} } \} }}| |ko| dksPn|\} } \} } \} }}| |ko| dksPn|\} } \} } \} }}g}x| |kr|j | |\} } \} } \} }}| |koW| dks^Pn|\} } \} } \} }}qWd}| |kr| }|\} } \} } \} }}n| |k rt d|j| |fgS| d}g}xs|D]k}tt|d}|dkr:|j |q|j}|dksq|tjkrdq|j |qWt|t|krt|dkrd}n@d}|d j|7}|dk r|d |7}n|d 7}|j |||fqqW|S( Ntfromit __future__timportt,s)Skipping file %r; can't parse line %d: %sisfrom __future__ import s, Rs (ttokenizetSTRINGtNLtNEWLINEtCOMMENTtNAMEtOPR6tgenerate_tokensRDtnextRCR,R R=tgetattrRFtgetMandatoryReleaseRt version_infotlenR(R?RJRKRLRMRNROR6tgetttypettokentsrowtscolterowtecolR9t startlinetfeaturestcommenttendlinet okfeaturesR4tobjecttreleased((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR'sz       $((( $$$ $( '        cCs+|jrd|_n|jj|_dS(NRA(R>ttherestR4tread(R?((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR(s  cCs|j}|stg|_|jxN|D]F\}}}|dkr^|j||d5q/|g|j||d+q/W|j|j|jr|j|jndS(Ni(R6tAssertionErrortreverseR,R+t writelinesRdR(R?R4R6R7R8R9((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyRs      (t__name__t __module__R@RDR'R(R(((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyR&s  _ t__main__(( RRFRIRRRRRR RRR&Ri(((s1/usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt's       8 PK!1 mkreal.pycnu[ fc@soddlZddlZddlTejjZdZd ZdZdZdZ e d krke ndS( iN(t*s mkreal errori icCstj|}t|t}tj|}t|d}tj|t|d}x*|jt}|suPn|j |q\W~tj ||dS(Ntrtw( toststattS_IMODEtST_MODEtreadlinktopentunlinktreadtBUFSIZEtwritetchmod(tnametsttmodetlinktotf_intf_outtbuf((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt mkrealfiles cCstj|}t|t}tj|}tj|}tj|tj||tj||t tj |}xK|D]C}|tj tj fkrtj t ||t ||qqWdS(N( RRRRRtlistdirR tmkdirR tjointpardirtcurdirtsymlink(RRRRtfilestfilename((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt mkrealdirs  cCstjt_tjjtjd}|dkr:d}ntjd}|sjdG|GdGHtjdnd}xg|D]_}tjj|s|dG|dGd GHd}qwtjj |rt |qwt |qwWtj|dS( Nis-ctmkrealisusage:spath ...it:s not a symlink( tsyststderrtstdoutRtpathtbasenametargvtexittislinktisdirRR(tprognametargststatusR((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pytmain-s"       t__main__i( R!RRR$RterrorR RRR-t__name__(((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyts        PK!.rff treesync.pycnu[ fc@sdZddlZddlZddlZddlZdZdZdadada dZ dZ dZ dZ d Zd Zd ZddddZddZedkre ndS(sScript to synchronize two source trees. Invoke with two arguments: python treesync.py slave master The assumption is that "master" contains CVS administration while slave doesn't. All files in the slave tree that have a CVS/Entries entry in the master tree are synchronized. This means: If the files differ: if the slave file is newer: normalize the slave file if the files still differ: copy the slave to the master else (the master is newer): copy the master to the slave normalizing the slave means replacing CRLF with LF when the master doesn't use CRLF iNtasktyestnocCs)tjtjdd\}}x|D]\}}|dkrGd}n|dkr\d}n|dkrq|an|dkr|an|d kr|an|d kr|}n|d kr&|}aaaq&q&Wy|\}}Wn0tk rd Gtjd p dGdGdGHdSXt||dS(Nis nym:s:d:f:a:s-yRs-nRs-ss-ms-ds-fs-as usage: pythonis treesync.pys5[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]sslavedir masterdir(tgetopttsystargvt write_slavet write_mastertcreate_directoriest ValueErrortprocess(toptstargstotatdefault_answert create_filestslavetmaster((s./usr/lib64/python2.7/Tools/scripts/treesync.pytmain#s0              cCsYtjj|d}tjj|s9dG|GHdGHdSddGHdG|GHdG|GHtjj|std|d tsdG|GHd G|GHdSd G|GHytj|Wn(tjk r}d G|Gd G|GHdSXdG|GHnd}g}tj |}x|D]}tjj||}tjj||}|dkrJ|}qtjj|rtjj | r|j ||fqqW|r1tjj|d} xt | j D]s} | jd} | ddkr| dr| d}tjj||} tjj||} t| | qqWnx!|D]\} } t| | q8WdS(NtCVSsskipping master subdirectorys-- not under CVSt-i(sslave Rscreate slave directory %s?tanswers-- no corresponding slavescreating slave directoryscan't make slave directoryt:smade slave directorytEntriest/iti(tostpathtjointisdirtokayRtmkdirterrortNonetlistdirtislinktappendtopent readlinestsplittcompareR (RRtcvsdirtmsgtsubdirstnamestnamet masternamet slavenametentriestetwordststm((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR ?sT             % cCsyt|d}Wntk r,d}nXyt|d}Wntk rYd}nX|s|ssdG|GHdSdG|GHt||dtdS|sdG|GHdS|r|rt||rdSnt|}t|}||kr)|j|jdG|GHdG|GHt||dtdSd G||Gd GH|j d t |}|j|j|rd GHt||ddt nd GHt||ddt dS(NtrtrbsNeither master nor slave existssCreating missing slaveRsNot updating missing mastersMaster sis newer than slavesSlave issseconds newer than masteris#***UPDATING MASTER (BINARY COPY)***s***UPDATING MASTER***( R&tIOErrorR"tcopyRt identicaltmtimetcloseRtseekt funnycharsR(RRtsftmftsfttmfttfun((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR)msP                   iicCsCx<|jt}|jt}||kr1dS|sPqqWdS(Nii(treadtBUFSIZE(R?R@tsdtmd((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR:s cCs tj|j}|tjS(N(RtfstattfilenotstattST_MTIME(tftst((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR;scCs@x9|jt}|sPnd|ks4d|krdSqWdS(Ns sii(RDRE(RLtbuf((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR>sR7twbcCsdG|GHdG|GHtd|s%dSt||}t||}x*|jt}|s_Pn|j|qFW|j|jdS(Ntcopyings tosokay to copy? (RR&RDREtwriteR<(tsrctdsttrmodetwmodeRRLtgRN((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR9s   cCs|jj}| s)|ddkrYt|}|jj}|sYt}qYn|d dkrmdS|d dkrdSdGHt|S(NitnyitytnsYes or No please -- try again:(tstriptlowert raw_inputRR(tpromptR((s./usr/lib64/python2.7/Tools/scripts/treesync.pyRs  t__main__i@(t__doc__RRRJRRRRRRRR R)RER:R;R>R9Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/treesync.pyts"0  . .     PK!A_xxci.pycnu[ fc@s8ddlZddlZddlTddlZdZd*ZdZdZdd d d d gZd ddddgZ ddddddddddddddgZ gZ d Z d!Z d"Zd#Zd$Zd%Zd&Zd'Zed(kr4ye eeWq4ek r0d)GHq4XndS(+iN(t*s`iicCstjd}|r|SdGHg}xBtjtjD].}t|s5|jt||fq5q5W|j|sdGHtj dn|j|j x!|D]\}}|j|qW|S(Nis1No arguments, checking almost *, in "ls -t" ordersNothing to do -- exit 1( tsystargvtostlistdirtcurdirtskipfiletappendtgetmtimetsorttexittreverse(targstlisttfiletmtime((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgetargss"      cCs7ytj|}|tSWntjk r2dSXdS(Ni(RtstattST_MTIMEterror(Rtst((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR"s  ttagstTAGStxyzzys nohup.outtcoret.t,t@t#so.t~s.as.os.olds.baks.origs.news.prevs.nots.pycs.fdcs.rgbs.elcs,vcCstt(xtD]}tj|dqWxtD]}tjd|q0Wytdd}Wntk rrdSXt|jjt(dS(NRs.xxcigntr( tbadnamestignoret badprefixesRt badsuffixestopentIOErrortreadtsplit(tptf((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytsetup0s   cCsx$tD]}tj||rdSqWytj|}Wntjk rQdSXt|tsfdS|ttkrzdSy2t |dj t t }|t krdSWnnXdS(NiRi( R tfnmatchRtlstatRtS_ISREGtST_MODEtST_SIZEtMAXSIZER#R%tlent EXECMAGIC(RR'Rtdata((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR<s$  cCs/x(tD] }|t| |krdSqWdS(Nii(R!R0(Rtbad((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt badprefixOs cCs0x)tD]!}|t| |krdSqWdS(Nii(R"R0(RR3((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt badsuffixTs cCstxm|D]e}|dGHt|rt|td|drltjd|}tjd|}qlqqWdS(Nt:s Check in s ? srcs -l sci -l (t differingt showdiffstaskyesnoRtsystem(R Rtsts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgoYs    cCs+d|d|}tj|}|dkS(Nsco -p s 2>/dev/null | cmp -s - i(RR:(RtcmdR;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR7bscCs!d|d}tj|}dS(Nsrcsdiff s 2>&1 | ${PAGER-more}(RR:(RR=R;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR8gscCst|}|dkS(Ntytyes(R>R?(t raw_input(tpromptts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR9ks t__main__s[Intr]i (RRRR*R1R/RRRR!R"R R)RR4R5R<R7R8R9t__name__tKeyboardInterrupt(((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyts4              PK!1VTTwin_add2path.pynu["""Add Python to the search path on Windows This is a simple script to add Python to the Windows search path. It modifies the current user (HKCU) tree of the registry. Copyright (c) 2008 by Christian Heimes Licensed to PSF under a Contributor Agreement. """ import sys import site import os import _winreg HKCU = _winreg.HKEY_CURRENT_USER ENV = "Environment" PATH = "PATH" DEFAULT = u"%PATH%" def modify(): pythonpath = os.path.dirname(os.path.normpath(sys.executable)) scripts = os.path.join(pythonpath, "Scripts") appdata = os.environ["APPDATA"] if hasattr(site, "USER_SITE"): userpath = site.USER_SITE.replace(appdata, "%APPDATA%") userscripts = os.path.join(userpath, "Scripts") else: userscripts = None with _winreg.CreateKey(HKCU, ENV) as key: try: envpath = _winreg.QueryValueEx(key, PATH)[0] except WindowsError: envpath = DEFAULT paths = [envpath] for path in (pythonpath, scripts, userscripts): if path and path not in envpath and os.path.isdir(path): paths.append(path) envpath = os.pathsep.join(paths) _winreg.SetValueEx(key, PATH, 0, _winreg.REG_EXPAND_SZ, envpath) return paths, envpath def main(): paths, envpath = modify() if len(paths) > 1: print "Path(s) added:" print '\n'.join(paths[1:]) else: print "No path was added" print "\nPATH is now:\n%s\n" % envpath print "Expanded:" print _winreg.ExpandEnvironmentStrings(envpath) if __name__ == '__main__': main() PK!GT redemo.pynuȯ#! /usr/bin/python2.7 """Basic regular expression demonstration facility (Perl style syntax).""" from Tkinter import * import re class ReDemo: def __init__(self, master): self.master = master self.promptdisplay = Label(self.master, anchor=W, text="Enter a Perl-style regular expression:") self.promptdisplay.pack(side=TOP, fill=X) self.regexdisplay = Entry(self.master) self.regexdisplay.pack(fill=X) self.regexdisplay.focus_set() self.addoptions() self.statusdisplay = Label(self.master, text="", anchor=W) self.statusdisplay.pack(side=TOP, fill=X) self.labeldisplay = Label(self.master, anchor=W, text="Enter a string to search:") self.labeldisplay.pack(fill=X) self.labeldisplay.pack(fill=X) self.showframe = Frame(master) self.showframe.pack(fill=X, anchor=W) self.showvar = StringVar(master) self.showvar.set("first") self.showfirstradio = Radiobutton(self.showframe, text="Highlight first match", variable=self.showvar, value="first", command=self.recompile) self.showfirstradio.pack(side=LEFT) self.showallradio = Radiobutton(self.showframe, text="Highlight all matches", variable=self.showvar, value="all", command=self.recompile) self.showallradio.pack(side=LEFT) self.stringdisplay = Text(self.master, width=60, height=4) self.stringdisplay.pack(fill=BOTH, expand=1) self.stringdisplay.tag_configure("hit", background="yellow") self.grouplabel = Label(self.master, text="Groups:", anchor=W) self.grouplabel.pack(fill=X) self.grouplist = Listbox(self.master) self.grouplist.pack(expand=1, fill=BOTH) self.regexdisplay.bind('', self.recompile) self.stringdisplay.bind('', self.reevaluate) self.compiled = None self.recompile() btags = self.regexdisplay.bindtags() self.regexdisplay.bindtags(btags[1:] + btags[:1]) btags = self.stringdisplay.bindtags() self.stringdisplay.bindtags(btags[1:] + btags[:1]) def addoptions(self): self.frames = [] self.boxes = [] self.vars = [] for name in ('IGNORECASE', 'LOCALE', 'MULTILINE', 'DOTALL', 'VERBOSE'): if len(self.boxes) % 3 == 0: frame = Frame(self.master) frame.pack(fill=X) self.frames.append(frame) val = getattr(re, name) var = IntVar() box = Checkbutton(frame, variable=var, text=name, offvalue=0, onvalue=val, command=self.recompile) box.pack(side=LEFT) self.boxes.append(box) self.vars.append(var) def getflags(self): flags = 0 for var in self.vars: flags = flags | var.get() flags = flags return flags def recompile(self, event=None): try: self.compiled = re.compile(self.regexdisplay.get(), self.getflags()) bg = self.promptdisplay['background'] self.statusdisplay.config(text="", background=bg) except re.error, msg: self.compiled = None self.statusdisplay.config( text="re.error: %s" % str(msg), background="red") self.reevaluate() def reevaluate(self, event=None): try: self.stringdisplay.tag_remove("hit", "1.0", END) except TclError: pass try: self.stringdisplay.tag_remove("hit0", "1.0", END) except TclError: pass self.grouplist.delete(0, END) if not self.compiled: return self.stringdisplay.tag_configure("hit", background="yellow") self.stringdisplay.tag_configure("hit0", background="orange") text = self.stringdisplay.get("1.0", END) last = 0 nmatches = 0 while last <= len(text): m = self.compiled.search(text, last) if m is None: break first, last = m.span() if last == first: last = first+1 tag = "hit0" else: tag = "hit" pfirst = "1.0 + %d chars" % first plast = "1.0 + %d chars" % last self.stringdisplay.tag_add(tag, pfirst, plast) if nmatches == 0: self.stringdisplay.yview_pickplace(pfirst) groups = list(m.groups()) groups.insert(0, m.group()) for i in range(len(groups)): g = "%2d: %r" % (i, groups[i]) self.grouplist.insert(END, g) nmatches = nmatches + 1 if self.showvar.get() == "first": break if nmatches == 0: self.statusdisplay.config(text="(no match)", background="yellow") else: self.statusdisplay.config(text="") # Main function, run when invoked as a stand-alone Python program. def main(): root = Tk() demo = ReDemo(root) root.protocol('WM_DELETE_WINDOW', root.quit) root.mainloop() if __name__ == '__main__': main() PK!C; fixheader.pycnu[ fc@s8ddlZdZdZedkr4endS(iNcCs,tjd}x|D]}t|qWdS(Ni(tsystargvtprocess(targstfilename((s//usr/lib64/python2.7/Tools/scripts/fixheader.pytmains  cCsyt|d}Wn4tk rI}tjjd|t|fdSX|j}|j|d dkrtjjd|dSyt|d}Wn4tk r}tjjd|t|fdSXtjjd|d }xI|D]A}t|d kr*|j r*||j }q|d }qW|t_ d G|GHd G|GHdGHdGHdGHH|j|HdGHdGHdGHdGd|GdGHdS(Ntrs%s: can't open: %s is/*s!%s does not begin with C comment tws%s: can't write: %s sProcessing %s ... tPy_it_s#ifndefs#defines#ifdef __cpluspluss extern "C" {s#endift}s #endif /*t!s*/( topentIOErrorRtstderrtwritetstrtreadtclosetordtisalnumtuppertstdout(Rtftmsgtdatatmagictc((s//usr/lib64/python2.7/Tools/scripts/fixheader.pyR sD         t__main__(RRRt__name__(((s//usr/lib64/python2.7/Tools/scripts/fixheader.pyts   $ PK!1"v pathfix.pyonu[ fc@sddlZddlZddlZddlTddlZejjZeZej jZ da dZ ejdZdZdZdZdZed kre ndS( iN(t*cCspdtjd}y#tjtjdd\}}Wn;tjk rq}t|dt|tjdnXx)|D]!\}}|dkry|aqyqyWt stddks| rtd t|tjdnd}xv|D]n}tjj |rt |r[d}q[qtjj |rFt|d d}qt |rd}qqWtj|dS( Ns0usage: %s -i /interpreter file-or-directory ... iisi:s is-it/s'-i option or file-or-directory missing s": will not process symbolic links ( tsystargvtgetoptterrorterrtexittnew_interpretertostpathtisdirt recursedowntislinktfix(tusagetoptstargstmsgtotatbadtarg((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytmain"s4#         s^[a-zA-Z0-9_]+\.py$cCstj|dkS(Ni(t ispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytispython?scCs1td|fd}ytj|}Wn+tjk rW}td||fdSX|jg}x|D]}|tjtjfkrqontjj ||}tjj |rqotjj |r|j |qot |rot|rd}qqoqoWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgR tlistdirRRtsorttcurdirtpardirR tjoinR R tappendRRR (tdirnameRtnamesRtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR Bs0      c Cs<yt|d}Wn(tk r=}td||fdSX|j}t|}||kr~t|d|jdStjj |\}}tjj |d|}yt|d}Wn2tk r}|jtd||fdSXt|d|j |d} x*|j | } | s4Pn|j | qW|j|jy+tj |} tj|| td @Wn*tjk r}td ||fnXytj||d Wn*tjk r}td||fnXytj||Wn+tjk r7}td||fdSXdS(Ntrs%s: cannot open: %r is : no change t@tws%s: cannot create: %r s : updating iiis%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) ii (topentIOErrorRtreadlinetfixlinetreptcloseR R tsplitR!twritetreadtstattchmodtST_MODERtrename( tfilenametfRtlinetfixedtheadttailttempnametgtBUFSIZEtbuftstatbuf((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyRXsX        cCs+|jds|Sd|kr#|SdtS(Ns#!tpythons#! %s (t startswithR(R:((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR.s  t__main__(RtreR R4RtstderrR2RRtstdoutR/tNoneRRtcompileRRR RR.t__name__(((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyts           5  PK!= pdeps.pycnu[ fc@sddlZddlZddlZdZejdZejdZdZdZdZ dZ d Z e d kryej eWqek rej d qXndS( iNcCstjd}|sdGHdSi}x|D]}t||q)WdGHt|dGHt|}t|dGHt|}t|dGHt|}t|dS( Nis usage: pdeps file.py file.py ...is --- Uses ---s--- Used By ---s--- Closure of Uses ---s--- Closure of Used By ---i(tsystargvtprocesst printresultstinversetclosure(targsttabletargtinvtreachtinvreach((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pytmains&         s^[ ]*from[ ]+([^ ]+)[ ]+s^[ ]*import[ ]+([^#]+)c Csht|d}tjj|}|ddkr>|d }ng||<}x|j}|sePnx8|ddkr|j}|sPn|d |}qhWtj|dkrtjd \\}}\} } n:tj|dkrOtjd \\}}\} } nqO|| | !j d} x6| D].} | j } | |kr.|j | q.q.WqOWdS( Ntris.pyis\iit,( topentostpathtbasenametreadlinetm_importtmatchtregstm_fromtsplittstriptappend( tfilenameRtfptmodtlisttlinetnextlinetatbta1tb1twordstword((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyRBs0   ""   cCs|j}i}x|D]}||||s          PK!)`% fixheader.pynuȯ#! /usr/bin/python2.7 # Add some standard cpp magic to a header file import sys def main(): args = sys.argv[1:] for filename in args: process(filename) def process(filename): try: f = open(filename, 'r') except IOError, msg: sys.stderr.write('%s: can\'t open: %s\n' % (filename, str(msg))) return data = f.read() f.close() if data[:2] <> '/*': sys.stderr.write('%s does not begin with C comment\n' % filename) return try: f = open(filename, 'w') except IOError, msg: sys.stderr.write('%s: can\'t write: %s\n' % (filename, str(msg))) return sys.stderr.write('Processing %s ...\n' % filename) magic = 'Py_' for c in filename: if ord(c)<=0x80 and c.isalnum(): magic = magic + c.upper() else: magic = magic + '_' sys.stdout = f print '#ifndef', magic print '#define', magic print '#ifdef __cplusplus' print 'extern "C" {' print '#endif' print f.write(data) print print '#ifdef __cplusplus' print '}' print '#endif' print '#endif /*', '!'+magic, '*/' if __name__ == '__main__': main() PK!A bfindlinksto.pycnu[ fc@s\ddlZddlZddlZddlZdZdZedkrXendS(iNcCsyJtjtjdd\}}t|dkrItjddnWn9tjk r}tjt_|GHdGHtjdnX|d|d}}t j |}x$|D]}t j j |t|qWdS(Nitisnot enough argumentss(usage: findlinksto pattern directory ...i(tgetopttsystargvtlent GetoptErrortNonetstderrtstdouttexittretcompiletostpathtwalktvisit(toptstargstmsgtpattdirstprogtdirname((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pytmain s  cCstjj|rg|(dStjj|r;dG|GHnxr|D]j}tjj||}y8tj|}|j|dk r|GdG|GHnWqBtjk rqBXqBWdS(Ns descend intos->( R R tislinktismounttjointreadlinktsearchRterror(RRtnamestnametlinkto((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyRs  t__main__(R RR RRRt__name__(((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyts       PK!ީ$YY rgrep.pyonu[ fc@sYdZddlZddlZddlZdZddZedkrUendS(s.Reverse grep. Usage: rgrep [-i] pattern file iNcCsAd}d}tjtjdd\}}x0|D](\}}|dkr2|tjB}q2q2Wt|dkr}tdnt|dkrtd n|\}}ytj||}Wn*tjk r} td t | nXyt |} Wn6t k r3} td t |t | fdnX| j dd| j} d} x| dkr<t| |} | | } | j | | j| }|jd }~| dkr|d s|d =qn|d | |d <| dkr|d} |d=nd} |jx%|D]}|j|r|GHqqWqYWdS(Ni@iiitis-iisnot enough argumentss"exactly one file argument requiredserror in regular expression: %sscan't open %s: %ss ii(tgetopttsystargvtret IGNORECASEtlentusagetcompileterrortstrtopentIOErrortreprtseekttelltNonetmintreadtsplittreversetsearch(tbufsizetreflagstoptstargstotatpatterntfilenametprogtmsgtftpostleftovertsizetbuffertlinestline((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pytmain sR    '           icCs'tjt_|GHtGHtj|dS(N(Rtstderrtstdoutt__doc__texit(Rtcode((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyR9s t__main__(R*RRRR'Rt__name__(((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyts    -  PK!YVanalyze_dxp.pyonu[ fc@sdZddlZddlZddlZddlZddlZeeds`ednejZ ej a dZ dZ dZdZd Zd Zdd ZdS( s Some helper functions to analyze the output of sys.getdxp() (which is only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE). These will tell you which opcodes have been executed most frequently in the current process, and, if Python was also built with -DDXPAIRS, will tell you which instruction _pairs_ were executed most frequently, which may help in choosing new instructions. If Python was built without -DDYNAMIC_EXECUTION_PROFILE, importing this module will raise a RuntimeError. If you're running a script you want to profile, a simple way to get the common pairs is: $ PYTHONPATH=$PYTHONPATH:/Tools/scripts ./python -i -O the_script.py --args ... > from analyze_dxp import * > s = render_common_pairs() > open('/tmp/some_file', 'w').write(s) iNtgetdxpsKCan't import analyze_dxp: Python built without -DDYNAMIC_EXECUTION_PROFILE.cCs#t|dko"t|dtS(s[Returns True if the Python that produced the argument profile was built with -DDXPAIRS.i(tlent isinstancetlist(tprofile((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt has_pairs(scCs'ttjtjaWdQXdS(s<Forgets any execution profile that has been gathered so far.N(t _profile_locktsysRt_cumulative_profile(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt reset_profile/s c Csttj}t|r|xtttD]C}x:ttt|D]"}t||c|||7cs7dkrtnfd}dj|S(sRenders the most common opcode pairs to a string in order of descending frequency. The result is a series of lines of the form: # of occurrences: ('1st opname', '2nd opname') c3s3x,tD]\}}}d||fVq WdS(Ns%s: %s (R$(t_topsR(R(s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytseqstN(tNoneRtjoin(RR'((Rs1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytrender_common_pairsus  (t__doc__RRRRt threadingthasattrt RuntimeErrortRLockRRRRR RRR R$R)R+(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyts              PK!T^lll.pynuȯ#! /usr/bin/python2.7 # Find symbolic links and show where they point to. # Arguments are directories to search; default is current directory. # No recursion. # (This is a totally different program from "findsymlinks.py"!) import sys, os def lll(dirname): for name in os.listdir(dirname): if name not in (os.curdir, os.pardir): full = os.path.join(dirname, name) if os.path.islink(full): print name, '->', os.readlink(full) def main(args): if not args: args = [os.curdir] first = 1 for arg in args: if len(args) > 1: if not first: print first = 0 print arg + ':' lll(arg) if __name__ == '__main__': main(sys.argv[1:]) PK!qsuff.pyonu[ fc@s8ddlZdZdZedkr4endS(iNcCstjd}i}xG|D]?}t|}|j|sHg||s   PK!͗[ pickle2db.pycnu[ fc@sBdZddlZyddlZWnek r;dZnXyddlZWnek redZnXyddlZWnek rdZnXyddlZWnek rdZnXddlZyddl Z Wnek rddl Z nXej dZ dZ dZedkr>ejeej dndS(s, Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile Read the given picklefile as a series of key/value pairs and write to a new database. If the database already exists, any contents are deleted. The optional flags indicate the type of the output database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for read access. If no pickle file is named, the pickle input is read from standard input. Note that recno databases can only contain integer keys, so you can't dump a hash or btree database using db2pickle.py and reconstitute it to a recno database with %(prog)s unless your keys are integers. iNicCstjjttdS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pytusage4sc Csy1tj|dddddddg\}}Wntjk rOtdSXt|d kstt|d krtdSt|dkrtj}|d }nNyt|d d }Wn*tk rtjj d |d dSX|d}d}x|D]\}}|d"krOy t j }Wqt k rKtjj ddSXq|d#kry t j}Wqt k rtjj ddSXq|d$kry t j}Wqt k rtjj ddSXq|d%kry tj}Wqt k rtjj ddSXq|d&krSy tj}Wqt k rOtjj ddSXq|d'kry tj}Wqt k rtjj ddSXqqW|dkrt dkrtjj dtjj ddSt j }ny||d}Wn9t jk r.tjj d |tjj d!dSXx|jD] }||=q<Wx<ytj|\} } Wntk r}PnX| || s6              [ PK!h^^which.pynuȯ#! /usr/bin/python2.7 # Variant of "which". # On stderr, near and total misses are reported. # '-l' argument adds ls -l of each file found. import sys if sys.path[0] in (".", ""): del sys.path[0] import sys, os from stat import * def msg(str): sys.stderr.write(str + '\n') def main(): pathlist = os.environ['PATH'].split(os.pathsep) sts = 0 longlist = '' if sys.argv[1:] and sys.argv[1][:2] == '-l': longlist = sys.argv[1] del sys.argv[1] for prog in sys.argv[1:]: ident = () for dir in pathlist: filename = os.path.join(dir, prog) try: st = os.stat(filename) except os.error: continue if not S_ISREG(st[ST_MODE]): msg(filename + ': not a disk file') else: mode = S_IMODE(st[ST_MODE]) if mode & 0111: if not ident: print filename ident = st[:3] else: if st[:3] == ident: s = 'same as: ' else: s = 'also: ' msg(s + filename) else: msg(filename + ': not executable') if longlist: sts = os.system('ls ' + longlist + ' ' + filename) if sts: msg('"ls -l" exit status: ' + repr(sts)) if not ident: msg(prog + ': not found') sts = 1 sys.exit(sts) if __name__ == '__main__': main() PK! Treindent-rst.pycnu[ fc@sJddlZddlZejdZedkrFejendS(iNcCstj|ddS(Ni(t patchchecktnormalize_docs_whitespace(targv((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pytmain st__main__(tsysRRRt__name__texit(((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pyts   PK! R R diff.pyonu[ fc@sedZddlZddlZddlZddlZddlZdZedkraendS(sS Command line interface to difflib.py providing diffs in four formats: * ndiff: lists every line and highlights interline changes. * context: highlights clusters of changes in a before/after format. * unified: highlights clusters of changes in an inline format. * html: generates side by side comparison with change highlights. iNc Csed}tj|}|jddddtdd|jddddtdd |jd dddtdd |jd dddtdd |jdddddddd|j\}}t|dkr|jtjdnt|dkr|j dn|j }|\}}t j t j|j}t j t j|j}t|d} | j} WdQXt|d} | j} WdQX|jrtj| | ||||d|} n{|jrtj| | } n]|jr-tjj| | ||d|jd|} n$tj| | ||||d|} tjj| dS(Ns&usage: %prog [options] fromfile tofiles-ctactiont store_truetdefaultthelps'Produce a context format diff (default)s-usProduce a unified format diffs-msAProduce HTML side by side diff (can use -c and -l in conjunction)s-nsProduce a ndiff format diffs-ls--linesttypetintis'Set number of context lines (default 3)iiis*need to specify both a fromfile and tofiletUtntcontexttnumlines(toptparset OptionParsert add_optiontFalset parse_argstlent print_helptsystexitterrortlinesttimetctimetoststattst_mtimetopent readlinestutdifflibt unified_diffRtndifftmtHtmlDifft make_filetct context_difftstdoutt writelines( tusagetparsertoptionstargsRtfromfilettofiletfromdatettodatetft fromlinesttolinestdiff((s*/usr/lib64/python2.7/Tools/scripts/diff.pytmain s:"    '  0$t__main__(t__doc__RRRRR R3t__name__(((s*/usr/lib64/python2.7/Tools/scripts/diff.pyt s< & PK!ī texi2html.pynuȯ#! /usr/bin/python2.7 # Convert GNU texinfo files into HTML, one file per node. # Based on Texinfo 2.14. # Usage: texi2html [-d] [-d] [-c] inputfile outputdirectory # The input file must be a complete texinfo file, e.g. emacs.texi. # This creates many files (one per info node) in the output directory, # overwriting existing files of the same name. All files created have # ".html" as their extension. # XXX To do: # - handle @comment*** correctly # - handle @xref {some words} correctly # - handle @ftable correctly (items aren't indexed?) # - handle @itemx properly # - handle @exdent properly # - add links directly to the proper line from indices # - check against the definitive list of @-cmds; we still miss (among others): # - @defindex (hard) # - @c(omment) in the middle of a line (rarely used) # - @this* (not really needed, only used in headers anyway) # - @today{} (ever used outside title page?) # More consistent handling of chapters/sections/etc. # Lots of documentation # Many more options: # -top designate top node # -links customize which types of links are included # -split split at chapters or sections instead of nodes # -name Allow different types of filename handling. Non unix systems # will have problems with long node names # ... # Support the most recent texinfo version and take a good look at HTML 3.0 # More debugging output (customizable) and more flexible error handling # How about icons ? # rpyron 2002-05-07 # Robert Pyron # 1. BUGFIX: In function makefile(), strip blanks from the nodename. # This is necessary to match the behavior of parser.makeref() and # parser.do_node(). # 2. BUGFIX fixed KeyError in end_ifset (well, I may have just made # it go away, rather than fix it) # 3. BUGFIX allow @menu and menu items inside @ifset or @ifclear # 4. Support added for: # @uref URL reference # @image image file reference (see note below) # @multitable output an HTML table # @vtable # 5. Partial support for accents, to match MAKEINFO output # 6. I added a new command-line option, '-H basename', to specify # HTML Help output. This will cause three files to be created # in the current directory: # `basename`.hhp HTML Help Workshop project file # `basename`.hhc Contents file for the project # `basename`.hhk Index file for the project # When fed into HTML Help Workshop, the resulting file will be # named `basename`.chm. # 7. A new class, HTMLHelp, to accomplish item 6. # 8. Various calls to HTMLHelp functions. # A NOTE ON IMAGES: Just as 'outputdirectory' must exist before # running this program, all referenced images must already exist # in outputdirectory. import os import sys import string import re MAGIC = '\\input texinfo' cmprog = re.compile('^@([a-z]+)([ \t]|$)') # Command (line-oriented) blprog = re.compile('^[ \t]*$') # Blank line kwprog = re.compile('@[a-z]+') # Keyword (embedded, usually # with {} args) spprog = re.compile('[\n@{}&<>]') # Special characters in # running text # # menu item (Yuck!) miprog = re.compile('^\* ([^:]*):(:|[ \t]*([^\t,\n.]+)([^ \t\n]*))[ \t\n]*') # 0 1 1 2 3 34 42 0 # ----- ---------- --------- # -|----------------------------- # ----------------------------------------------------- class HTMLNode: """Some of the parser's functionality is separated into this class. A Node accumulates its contents, takes care of links to other Nodes and saves itself when it is finished and all links are resolved. """ DOCTYPE = '' type = 0 cont = '' epilogue = '\n' def __init__(self, dir, name, topname, title, next, prev, up): self.dirname = dir self.name = name if topname: self.topname = topname else: self.topname = name self.title = title self.next = next self.prev = prev self.up = up self.lines = [] def write(self, *lines): map(self.lines.append, lines) def flush(self): fp = open(self.dirname + '/' + makefile(self.name), 'w') fp.write(self.prologue) fp.write(self.text) fp.write(self.epilogue) fp.close() def link(self, label, nodename, rel=None, rev=None): if nodename: if nodename.lower() == '(dir)': addr = '../dir.html' title = '' else: addr = makefile(nodename) title = ' TITLE="%s"' % nodename self.write(label, ': ', nodename, ' \n') def finalize(self): length = len(self.lines) self.text = ''.join(self.lines) self.lines = [] self.open_links() self.output_links() self.close_links() links = ''.join(self.lines) self.lines = [] self.prologue = ( self.DOCTYPE + '\n\n' ' \n' ' ' + self.title + '\n' ' \n' ' \n' ' \n' '\n' + links) if length > 20: self.epilogue = '

\n%s\n' % links def open_links(self): self.write('


\n') def close_links(self): self.write('
\n') def output_links(self): if self.cont != self.next: self.link(' Cont', self.cont) self.link(' Next', self.next, rel='Next') self.link(' Prev', self.prev, rel='Previous') self.link(' Up', self.up, rel='Up') if self.name <> self.topname: self.link(' Top', self.topname) class HTML3Node(HTMLNode): DOCTYPE = '' def open_links(self): self.write('\n') class TexinfoParser: COPYRIGHT_SYMBOL = "©" FN_ID_PATTERN = "(%(id)s)" FN_SOURCE_PATTERN = '' \ + FN_ID_PATTERN + '' FN_TARGET_PATTERN = '' \ + FN_ID_PATTERN + '\n%(text)s

\n' FN_HEADER = '\n

\n


\n' \ 'Footnotes\n

' Node = HTMLNode # Initialize an instance def __init__(self): self.unknown = {} # statistics about unknown @-commands self.filenames = {} # Check for identical filenames self.debugging = 0 # larger values produce more output self.print_headers = 0 # always print headers? self.nodefp = None # open file we're writing to self.nodelineno = 0 # Linenumber relative to node self.links = None # Links from current node self.savetext = None # If not None, save text head instead self.savestack = [] # If not None, save text head instead self.htmlhelp = None # html help data self.dirname = 'tmp' # directory where files are created self.includedir = '.' # directory to search @include files self.nodename = '' # name of current node self.topname = '' # name of top node (first node seen) self.title = '' # title of this whole Texinfo tree self.resetindex() # Reset all indices self.contents = [] # Reset table of contents self.numbering = [] # Reset section numbering counters self.nofill = 0 # Normal operation: fill paragraphs self.values={'html': 1} # Names that should be parsed in ifset self.stackinfo={} # Keep track of state in the stack # XXX The following should be reset per node?! self.footnotes = [] # Reset list of footnotes self.itemarg = None # Reset command used by @item self.itemnumber = None # Reset number for @item in @enumerate self.itemindex = None # Reset item index name self.node = None self.nodestack = [] self.cont = 0 self.includedepth = 0 # Set htmlhelp helper class def sethtmlhelp(self, htmlhelp): self.htmlhelp = htmlhelp # Set (output) directory name def setdirname(self, dirname): self.dirname = dirname # Set include directory name def setincludedir(self, includedir): self.includedir = includedir # Parse the contents of an entire file def parse(self, fp): line = fp.readline() lineno = 1 while line and (line[0] == '%' or blprog.match(line)): line = fp.readline() lineno = lineno + 1 if line[:len(MAGIC)] <> MAGIC: raise SyntaxError, 'file does not begin with %r' % (MAGIC,) self.parserest(fp, lineno) # Parse the contents of a file, not expecting a MAGIC header def parserest(self, fp, initial_lineno): lineno = initial_lineno self.done = 0 self.skip = 0 self.stack = [] accu = [] while not self.done: line = fp.readline() self.nodelineno = self.nodelineno + 1 if not line: if accu: if not self.skip: self.process(accu) accu = [] if initial_lineno > 0: print '*** EOF before @bye' break lineno = lineno + 1 mo = cmprog.match(line) if mo: a, b = mo.span(1) cmd = line[a:b] if cmd in ('noindent', 'refill'): accu.append(line) else: if accu: if not self.skip: self.process(accu) accu = [] self.command(line, mo) elif blprog.match(line) and \ 'format' not in self.stack and \ 'example' not in self.stack: if accu: if not self.skip: self.process(accu) if self.nofill: self.write('\n') else: self.write('

\n') accu = [] else: # Append the line including trailing \n! accu.append(line) # if self.skip: print '*** Still skipping at the end' if self.stack: print '*** Stack not empty at the end' print '***', self.stack if self.includedepth == 0: while self.nodestack: self.nodestack[-1].finalize() self.nodestack[-1].flush() del self.nodestack[-1] # Start saving text in a buffer instead of writing it to a file def startsaving(self): if self.savetext <> None: self.savestack.append(self.savetext) # print '*** Recursively saving text, expect trouble' self.savetext = '' # Return the text saved so far and start writing to file again def collectsavings(self): savetext = self.savetext if len(self.savestack) > 0: self.savetext = self.savestack[-1] del self.savestack[-1] else: self.savetext = None return savetext or '' # Write text to file, or save it in a buffer, or ignore it def write(self, *args): try: text = ''.join(args) except: print args raise TypeError if self.savetext <> None: self.savetext = self.savetext + text elif self.nodefp: self.nodefp.write(text) elif self.node: self.node.write(text) # Complete the current node -- write footnotes and close file def endnode(self): if self.savetext <> None: print '*** Still saving text at end of node' dummy = self.collectsavings() if self.footnotes: self.writefootnotes() if self.nodefp: if self.nodelineno > 20: self.write('


\n') [name, next, prev, up] = self.nodelinks[:4] self.link('Next', next) self.link('Prev', prev) self.link('Up', up) if self.nodename <> self.topname: self.link('Top', self.topname) self.write('
\n') self.write('\n') self.nodefp.close() self.nodefp = None elif self.node: if not self.cont and \ (not self.node.type or \ (self.node.next and self.node.prev and self.node.up)): self.node.finalize() self.node.flush() else: self.nodestack.append(self.node) self.node = None self.nodename = '' # Process a list of lines, expanding embedded @-commands # This mostly distinguishes between menus and normal text def process(self, accu): if self.debugging > 1: print '!'*self.debugging, 'process:', self.skip, self.stack, if accu: print accu[0][:30], if accu[0][30:] or accu[1:]: print '...', print if self.inmenu(): # XXX should be done differently for line in accu: mo = miprog.match(line) if not mo: line = line.strip() + '\n' self.expand(line) continue bgn, end = mo.span(0) a, b = mo.span(1) c, d = mo.span(2) e, f = mo.span(3) g, h = mo.span(4) label = line[a:b] nodename = line[c:d] if nodename[0] == ':': nodename = label else: nodename = line[e:f] punct = line[g:h] self.write('
  • ', nodename, '', punct, '\n') self.htmlhelp.menuitem(nodename) self.expand(line[end:]) else: text = ''.join(accu) self.expand(text) # find 'menu' (we might be inside 'ifset' or 'ifclear') def inmenu(self): #if 'menu' in self.stack: # print 'inmenu :', self.skip, self.stack, self.stackinfo stack = self.stack while stack and stack[-1] in ('ifset','ifclear'): try: if self.stackinfo[len(stack)]: return 0 except KeyError: pass stack = stack[:-1] return (stack and stack[-1] == 'menu') # Write a string, expanding embedded @-commands def expand(self, text): stack = [] i = 0 n = len(text) while i < n: start = i mo = spprog.search(text, i) if mo: i = mo.start() else: self.write(text[start:]) break self.write(text[start:i]) c = text[i] i = i+1 if c == '\n': self.write('\n') continue if c == '<': self.write('<') continue if c == '>': self.write('>') continue if c == '&': self.write('&') continue if c == '{': stack.append('') continue if c == '}': if not stack: print '*** Unmatched }' self.write('}') continue cmd = stack[-1] del stack[-1] try: method = getattr(self, 'close_' + cmd) except AttributeError: self.unknown_close(cmd) continue method() continue if c <> '@': # Cannot happen unless spprog is changed raise RuntimeError, 'unexpected funny %r' % c start = i while i < n and text[i] in string.ascii_letters: i = i+1 if i == start: # @ plus non-letter: literal next character i = i+1 c = text[start:i] if c == ':': # `@:' means no extra space after # preceding `.', `?', `!' or `:' pass else: # `@.' means a sentence-ending period; # `@@', `@{', `@}' quote `@', `{', `}' self.write(c) continue cmd = text[start:i] if i < n and text[i] == '{': i = i+1 stack.append(cmd) try: method = getattr(self, 'open_' + cmd) except AttributeError: self.unknown_open(cmd) continue method() continue try: method = getattr(self, 'handle_' + cmd) except AttributeError: self.unknown_handle(cmd) continue method() if stack: print '*** Stack not empty at para:', stack # --- Handle unknown embedded @-commands --- def unknown_open(self, cmd): print '*** No open func for @' + cmd + '{...}' cmd = cmd + '{' self.write('@', cmd) if not self.unknown.has_key(cmd): self.unknown[cmd] = 1 else: self.unknown[cmd] = self.unknown[cmd] + 1 def unknown_close(self, cmd): print '*** No close func for @' + cmd + '{...}' cmd = '}' + cmd self.write('}') if not self.unknown.has_key(cmd): self.unknown[cmd] = 1 else: self.unknown[cmd] = self.unknown[cmd] + 1 def unknown_handle(self, cmd): print '*** No handler for @' + cmd self.write('@', cmd) if not self.unknown.has_key(cmd): self.unknown[cmd] = 1 else: self.unknown[cmd] = self.unknown[cmd] + 1 # XXX The following sections should be ordered as the texinfo docs # --- Embedded @-commands without {} argument list -- def handle_noindent(self): pass def handle_refill(self): pass # --- Include file handling --- def do_include(self, args): file = args file = os.path.join(self.includedir, file) try: fp = open(file, 'r') except IOError, msg: print '*** Can\'t open include file', repr(file) return print '!'*self.debugging, '--> file', repr(file) save_done = self.done save_skip = self.skip save_stack = self.stack self.includedepth = self.includedepth + 1 self.parserest(fp, 0) self.includedepth = self.includedepth - 1 fp.close() self.done = save_done self.skip = save_skip self.stack = save_stack print '!'*self.debugging, '<-- file', repr(file) # --- Special Insertions --- def open_dmn(self): pass def close_dmn(self): pass def open_dots(self): self.write('...') def close_dots(self): pass def open_bullet(self): pass def close_bullet(self): pass def open_TeX(self): self.write('TeX') def close_TeX(self): pass def handle_copyright(self): self.write(self.COPYRIGHT_SYMBOL) def open_copyright(self): self.write(self.COPYRIGHT_SYMBOL) def close_copyright(self): pass def open_minus(self): self.write('-') def close_minus(self): pass # --- Accents --- # rpyron 2002-05-07 # I would like to do at least as well as makeinfo when # it is producing HTML output: # # input output # @"o @"o umlaut accent # @'o 'o acute accent # @,{c} @,{c} cedilla accent # @=o @=o macron/overbar accent # @^o @^o circumflex accent # @`o `o grave accent # @~o @~o tilde accent # @dotaccent{o} @dotaccent{o} overdot accent # @H{o} @H{o} long Hungarian umlaut # @ringaccent{o} @ringaccent{o} ring accent # @tieaccent{oo} @tieaccent{oo} tie-after accent # @u{o} @u{o} breve accent # @ubaraccent{o} @ubaraccent{o} underbar accent # @udotaccent{o} @udotaccent{o} underdot accent # @v{o} @v{o} hacek or check accent # @exclamdown{} ¡ upside-down ! # @questiondown{} ¿ upside-down ? # @aa{},@AA{} å,Å a,A with circle # @ae{},@AE{} æ,Æ ae,AE ligatures # @dotless{i} @dotless{i} dotless i # @dotless{j} @dotless{j} dotless j # @l{},@L{} l/,L/ suppressed-L,l # @o{},@O{} ø,Ø O,o with slash # @oe{},@OE{} oe,OE oe,OE ligatures # @ss{} ß es-zet or sharp S # # The following character codes and approximations have been # copied from makeinfo's HTML output. def open_exclamdown(self): self.write('¡') # upside-down ! def close_exclamdown(self): pass def open_questiondown(self): self.write('¿') # upside-down ? def close_questiondown(self): pass def open_aa(self): self.write('å') # a with circle def close_aa(self): pass def open_AA(self): self.write('Å') # A with circle def close_AA(self): pass def open_ae(self): self.write('æ') # ae ligatures def close_ae(self): pass def open_AE(self): self.write('Æ') # AE ligatures def close_AE(self): pass def open_o(self): self.write('ø') # o with slash def close_o(self): pass def open_O(self): self.write('Ø') # O with slash def close_O(self): pass def open_ss(self): self.write('ß') # es-zet or sharp S def close_ss(self): pass def open_oe(self): self.write('oe') # oe ligatures def close_oe(self): pass def open_OE(self): self.write('OE') # OE ligatures def close_OE(self): pass def open_l(self): self.write('l/') # suppressed-l def close_l(self): pass def open_L(self): self.write('L/') # suppressed-L def close_L(self): pass # --- Special Glyphs for Examples --- def open_result(self): self.write('=>') def close_result(self): pass def open_expansion(self): self.write('==>') def close_expansion(self): pass def open_print(self): self.write('-|') def close_print(self): pass def open_error(self): self.write('error-->') def close_error(self): pass def open_equiv(self): self.write('==') def close_equiv(self): pass def open_point(self): self.write('-!-') def close_point(self): pass # --- Cross References --- def open_pxref(self): self.write('see ') self.startsaving() def close_pxref(self): self.makeref() def open_xref(self): self.write('See ') self.startsaving() def close_xref(self): self.makeref() def open_ref(self): self.startsaving() def close_ref(self): self.makeref() def open_inforef(self): self.write('See info file ') self.startsaving() def close_inforef(self): text = self.collectsavings() args = [s.strip() for s in text.split(',')] while len(args) < 3: args.append('') node = args[0] file = args[2] self.write('`', file, '\', node `', node, '\'') def makeref(self): text = self.collectsavings() args = [s.strip() for s in text.split(',')] while len(args) < 5: args.append('') nodename = label = args[0] if args[2]: label = args[2] file = args[3] title = args[4] href = makefile(nodename) if file: href = '../' + file + '/' + href self.write('', label, '') # rpyron 2002-05-07 uref support def open_uref(self): self.startsaving() def close_uref(self): text = self.collectsavings() args = [s.strip() for s in text.split(',')] while len(args) < 2: args.append('') href = args[0] label = args[1] if not label: label = href self.write('', label, '') # rpyron 2002-05-07 image support # GNU makeinfo producing HTML output tries `filename.png'; if # that does not exist, it tries `filename.jpg'. If that does # not exist either, it complains. GNU makeinfo does not handle # GIF files; however, I include GIF support here because # MySQL documentation uses GIF files. def open_image(self): self.startsaving() def close_image(self): self.makeimage() def makeimage(self): text = self.collectsavings() args = [s.strip() for s in text.split(',')] while len(args) < 5: args.append('') filename = args[0] width = args[1] height = args[2] alt = args[3] ext = args[4] # The HTML output will have a reference to the image # that is relative to the HTML output directory, # which is what 'filename' gives us. However, we need # to find it relative to our own current directory, # so we construct 'imagename'. imagelocation = self.dirname + '/' + filename if os.path.exists(imagelocation+'.png'): filename += '.png' elif os.path.exists(imagelocation+'.jpg'): filename += '.jpg' elif os.path.exists(imagelocation+'.gif'): # MySQL uses GIF files filename += '.gif' else: print "*** Cannot find image " + imagelocation #TODO: what is 'ext'? self.write('' ) self.htmlhelp.addimage(imagelocation) # --- Marking Words and Phrases --- # --- Other @xxx{...} commands --- def open_(self): pass # Used by {text enclosed in braces} def close_(self): pass open_asis = open_ close_asis = close_ def open_cite(self): self.write('') def close_cite(self): self.write('') def open_code(self): self.write('') def close_code(self): self.write('') def open_t(self): self.write('') def close_t(self): self.write('') def open_dfn(self): self.write('') def close_dfn(self): self.write('') def open_emph(self): self.write('') def close_emph(self): self.write('') def open_i(self): self.write('') def close_i(self): self.write('') def open_footnote(self): # if self.savetext <> None: # print '*** Recursive footnote -- expect weirdness' id = len(self.footnotes) + 1 self.write(self.FN_SOURCE_PATTERN % {'id': repr(id)}) self.startsaving() def close_footnote(self): id = len(self.footnotes) + 1 self.footnotes.append((id, self.collectsavings())) def writefootnotes(self): self.write(self.FN_HEADER) for id, text in self.footnotes: self.write(self.FN_TARGET_PATTERN % {'id': repr(id), 'text': text}) self.footnotes = [] def open_file(self): self.write('') def close_file(self): self.write('') def open_kbd(self): self.write('') def close_kbd(self): self.write('') def open_key(self): self.write('') def close_key(self): self.write('') def open_r(self): self.write('') def close_r(self): self.write('') def open_samp(self): self.write('`') def close_samp(self): self.write('\'') def open_sc(self): self.write('') def close_sc(self): self.write('') def open_strong(self): self.write('') def close_strong(self): self.write('') def open_b(self): self.write('') def close_b(self): self.write('') def open_var(self): self.write('') def close_var(self): self.write('') def open_w(self): self.write('') def close_w(self): self.write('') def open_url(self): self.startsaving() def close_url(self): text = self.collectsavings() self.write('', text, '') def open_email(self): self.startsaving() def close_email(self): text = self.collectsavings() self.write('', text, '') open_titlefont = open_ close_titlefont = close_ def open_small(self): pass def close_small(self): pass def command(self, line, mo): a, b = mo.span(1) cmd = line[a:b] args = line[b:].strip() if self.debugging > 1: print '!'*self.debugging, 'command:', self.skip, self.stack, \ '@' + cmd, args try: func = getattr(self, 'do_' + cmd) except AttributeError: try: func = getattr(self, 'bgn_' + cmd) except AttributeError: # don't complain if we are skipping anyway if not self.skip: self.unknown_cmd(cmd, args) return self.stack.append(cmd) func(args) return if not self.skip or cmd == 'end': func(args) def unknown_cmd(self, cmd, args): print '*** unknown', '@' + cmd, args if not self.unknown.has_key(cmd): self.unknown[cmd] = 1 else: self.unknown[cmd] = self.unknown[cmd] + 1 def do_end(self, args): words = args.split() if not words: print '*** @end w/o args' else: cmd = words[0] if not self.stack or self.stack[-1] <> cmd: print '*** @end', cmd, 'unexpected' else: del self.stack[-1] try: func = getattr(self, 'end_' + cmd) except AttributeError: self.unknown_end(cmd) return func() def unknown_end(self, cmd): cmd = 'end ' + cmd print '*** unknown', '@' + cmd if not self.unknown.has_key(cmd): self.unknown[cmd] = 1 else: self.unknown[cmd] = self.unknown[cmd] + 1 # --- Comments --- def do_comment(self, args): pass do_c = do_comment # --- Conditional processing --- def bgn_ifinfo(self, args): pass def end_ifinfo(self): pass def bgn_iftex(self, args): self.skip = self.skip + 1 def end_iftex(self): self.skip = self.skip - 1 def bgn_ignore(self, args): self.skip = self.skip + 1 def end_ignore(self): self.skip = self.skip - 1 def bgn_tex(self, args): self.skip = self.skip + 1 def end_tex(self): self.skip = self.skip - 1 def do_set(self, args): fields = args.split(' ') key = fields[0] if len(fields) == 1: value = 1 else: value = ' '.join(fields[1:]) self.values[key] = value def do_clear(self, args): self.values[args] = None def bgn_ifset(self, args): if args not in self.values.keys() \ or self.values[args] is None: self.skip = self.skip + 1 self.stackinfo[len(self.stack)] = 1 else: self.stackinfo[len(self.stack)] = 0 def end_ifset(self): try: if self.stackinfo[len(self.stack) + 1]: self.skip = self.skip - 1 del self.stackinfo[len(self.stack) + 1] except KeyError: print '*** end_ifset: KeyError :', len(self.stack) + 1 def bgn_ifclear(self, args): if args in self.values.keys() \ and self.values[args] is not None: self.skip = self.skip + 1 self.stackinfo[len(self.stack)] = 1 else: self.stackinfo[len(self.stack)] = 0 def end_ifclear(self): try: if self.stackinfo[len(self.stack) + 1]: self.skip = self.skip - 1 del self.stackinfo[len(self.stack) + 1] except KeyError: print '*** end_ifclear: KeyError :', len(self.stack) + 1 def open_value(self): self.startsaving() def close_value(self): key = self.collectsavings() if key in self.values.keys(): self.write(self.values[key]) else: print '*** Undefined value: ', key # --- Beginning a file --- do_finalout = do_comment do_setchapternewpage = do_comment do_setfilename = do_comment def do_settitle(self, args): self.startsaving() self.expand(args) self.title = self.collectsavings() def do_parskip(self, args): pass # --- Ending a file --- def do_bye(self, args): self.endnode() self.done = 1 # --- Title page --- def bgn_titlepage(self, args): self.skip = self.skip + 1 def end_titlepage(self): self.skip = self.skip - 1 def do_shorttitlepage(self, args): pass def do_center(self, args): # Actually not used outside title page... self.write('

    ') self.expand(args) self.write('

    \n') do_title = do_center do_subtitle = do_center do_author = do_center do_vskip = do_comment do_vfill = do_comment do_smallbook = do_comment do_paragraphindent = do_comment do_setchapternewpage = do_comment do_headings = do_comment do_footnotestyle = do_comment do_evenheading = do_comment do_evenfooting = do_comment do_oddheading = do_comment do_oddfooting = do_comment do_everyheading = do_comment do_everyfooting = do_comment # --- Nodes --- def do_node(self, args): self.endnode() self.nodelineno = 0 parts = [s.strip() for s in args.split(',')] while len(parts) < 4: parts.append('') self.nodelinks = parts [name, next, prev, up] = parts[:4] file = self.dirname + '/' + makefile(name) if self.filenames.has_key(file): print '*** Filename already in use: ', file else: if self.debugging: print '!'*self.debugging, '--- writing', file self.filenames[file] = 1 # self.nodefp = open(file, 'w') self.nodename = name if self.cont and self.nodestack: self.nodestack[-1].cont = self.nodename if not self.topname: self.topname = name title = name if self.title: title = title + ' -- ' + self.title self.node = self.Node(self.dirname, self.nodename, self.topname, title, next, prev, up) self.htmlhelp.addnode(self.nodename,next,prev,up,file) def link(self, label, nodename): if nodename: if nodename.lower() == '(dir)': addr = '../dir.html' else: addr = makefile(nodename) self.write(label, ': ', nodename, ' \n') # --- Sectioning commands --- def popstack(self, type): if (self.node): self.node.type = type while self.nodestack: if self.nodestack[-1].type > type: self.nodestack[-1].finalize() self.nodestack[-1].flush() del self.nodestack[-1] elif self.nodestack[-1].type == type: if not self.nodestack[-1].next: self.nodestack[-1].next = self.node.name if not self.node.prev: self.node.prev = self.nodestack[-1].name self.nodestack[-1].finalize() self.nodestack[-1].flush() del self.nodestack[-1] else: if type > 1 and not self.node.up: self.node.up = self.nodestack[-1].name break def do_chapter(self, args): self.heading('H1', args, 0) self.popstack(1) def do_unnumbered(self, args): self.heading('H1', args, -1) self.popstack(1) def do_appendix(self, args): self.heading('H1', args, -1) self.popstack(1) def do_top(self, args): self.heading('H1', args, -1) def do_chapheading(self, args): self.heading('H1', args, -1) def do_majorheading(self, args): self.heading('H1', args, -1) def do_section(self, args): self.heading('H1', args, 1) self.popstack(2) def do_unnumberedsec(self, args): self.heading('H1', args, -1) self.popstack(2) def do_appendixsec(self, args): self.heading('H1', args, -1) self.popstack(2) do_appendixsection = do_appendixsec def do_heading(self, args): self.heading('H1', args, -1) def do_subsection(self, args): self.heading('H2', args, 2) self.popstack(3) def do_unnumberedsubsec(self, args): self.heading('H2', args, -1) self.popstack(3) def do_appendixsubsec(self, args): self.heading('H2', args, -1) self.popstack(3) def do_subheading(self, args): self.heading('H2', args, -1) def do_subsubsection(self, args): self.heading('H3', args, 3) self.popstack(4) def do_unnumberedsubsubsec(self, args): self.heading('H3', args, -1) self.popstack(4) def do_appendixsubsubsec(self, args): self.heading('H3', args, -1) self.popstack(4) def do_subsubheading(self, args): self.heading('H3', args, -1) def heading(self, type, args, level): if level >= 0: while len(self.numbering) <= level: self.numbering.append(0) del self.numbering[level+1:] self.numbering[level] = self.numbering[level] + 1 x = '' for i in self.numbering: x = x + repr(i) + '.' args = x + ' ' + args self.contents.append((level, args, self.nodename)) self.write('<', type, '>') self.expand(args) self.write('\n') if self.debugging or self.print_headers: print '---', args def do_contents(self, args): # pass self.listcontents('Table of Contents', 999) def do_shortcontents(self, args): pass # self.listcontents('Short Contents', 0) do_summarycontents = do_shortcontents def listcontents(self, title, maxlevel): self.write('

    ', title, '

    \n
      \n') prevlevels = [0] for level, title, node in self.contents: if level > maxlevel: continue if level > prevlevels[-1]: # can only advance one level at a time self.write(' '*prevlevels[-1], '
        \n') prevlevels.append(level) elif level < prevlevels[-1]: # might drop back multiple levels while level < prevlevels[-1]: del prevlevels[-1] self.write(' '*prevlevels[-1], '
      \n') self.write(' '*level, '
    • ') self.expand(title) self.write('\n') self.write('
    \n' * len(prevlevels)) # --- Page lay-out --- # These commands are only meaningful in printed text def do_page(self, args): pass def do_need(self, args): pass def bgn_group(self, args): pass def end_group(self): pass # --- Line lay-out --- def do_sp(self, args): if self.nofill: self.write('\n') else: self.write('

    \n') def do_hline(self, args): self.write('


    ') # --- Function and variable definitions --- def bgn_deffn(self, args): self.write('
    ') self.do_deffnx(args) def end_deffn(self): self.write('
    \n') def do_deffnx(self, args): self.write('
    ') words = splitwords(args, 2) [category, name], rest = words[:2], words[2:] self.expand('@b{%s}' % name) for word in rest: self.expand(' ' + makevar(word)) #self.expand(' -- ' + category) self.write('\n
    ') self.index('fn', name) def bgn_defun(self, args): self.bgn_deffn('Function ' + args) end_defun = end_deffn def do_defunx(self, args): self.do_deffnx('Function ' + args) def bgn_defmac(self, args): self.bgn_deffn('Macro ' + args) end_defmac = end_deffn def do_defmacx(self, args): self.do_deffnx('Macro ' + args) def bgn_defspec(self, args): self.bgn_deffn('{Special Form} ' + args) end_defspec = end_deffn def do_defspecx(self, args): self.do_deffnx('{Special Form} ' + args) def bgn_defvr(self, args): self.write('
    ') self.do_defvrx(args) end_defvr = end_deffn def do_defvrx(self, args): self.write('
    ') words = splitwords(args, 2) [category, name], rest = words[:2], words[2:] self.expand('@code{%s}' % name) # If there are too many arguments, show them for word in rest: self.expand(' ' + word) #self.expand(' -- ' + category) self.write('\n
    ') self.index('vr', name) def bgn_defvar(self, args): self.bgn_defvr('Variable ' + args) end_defvar = end_defvr def do_defvarx(self, args): self.do_defvrx('Variable ' + args) def bgn_defopt(self, args): self.bgn_defvr('{User Option} ' + args) end_defopt = end_defvr def do_defoptx(self, args): self.do_defvrx('{User Option} ' + args) # --- Ditto for typed languages --- def bgn_deftypefn(self, args): self.write('
    ') self.do_deftypefnx(args) end_deftypefn = end_deffn def do_deftypefnx(self, args): self.write('
    ') words = splitwords(args, 3) [category, datatype, name], rest = words[:3], words[3:] self.expand('@code{%s} @b{%s}' % (datatype, name)) for word in rest: self.expand(' ' + makevar(word)) #self.expand(' -- ' + category) self.write('\n
    ') self.index('fn', name) def bgn_deftypefun(self, args): self.bgn_deftypefn('Function ' + args) end_deftypefun = end_deftypefn def do_deftypefunx(self, args): self.do_deftypefnx('Function ' + args) def bgn_deftypevr(self, args): self.write('
    ') self.do_deftypevrx(args) end_deftypevr = end_deftypefn def do_deftypevrx(self, args): self.write('
    ') words = splitwords(args, 3) [category, datatype, name], rest = words[:3], words[3:] self.expand('@code{%s} @b{%s}' % (datatype, name)) # If there are too many arguments, show them for word in rest: self.expand(' ' + word) #self.expand(' -- ' + category) self.write('\n
    ') self.index('fn', name) def bgn_deftypevar(self, args): self.bgn_deftypevr('Variable ' + args) end_deftypevar = end_deftypevr def do_deftypevarx(self, args): self.do_deftypevrx('Variable ' + args) # --- Ditto for object-oriented languages --- def bgn_defcv(self, args): self.write('
    ') self.do_defcvx(args) end_defcv = end_deftypevr def do_defcvx(self, args): self.write('
    ') words = splitwords(args, 3) [category, classname, name], rest = words[:3], words[3:] self.expand('@b{%s}' % name) # If there are too many arguments, show them for word in rest: self.expand(' ' + word) #self.expand(' -- %s of @code{%s}' % (category, classname)) self.write('\n
    ') self.index('vr', '%s @r{on %s}' % (name, classname)) def bgn_defivar(self, args): self.bgn_defcv('{Instance Variable} ' + args) end_defivar = end_defcv def do_defivarx(self, args): self.do_defcvx('{Instance Variable} ' + args) def bgn_defop(self, args): self.write('
    ') self.do_defopx(args) end_defop = end_defcv def do_defopx(self, args): self.write('
    ') words = splitwords(args, 3) [category, classname, name], rest = words[:3], words[3:] self.expand('@b{%s}' % name) for word in rest: self.expand(' ' + makevar(word)) #self.expand(' -- %s of @code{%s}' % (category, classname)) self.write('\n
    ') self.index('fn', '%s @r{on %s}' % (name, classname)) def bgn_defmethod(self, args): self.bgn_defop('Method ' + args) end_defmethod = end_defop def do_defmethodx(self, args): self.do_defopx('Method ' + args) # --- Ditto for data types --- def bgn_deftp(self, args): self.write('
    ') self.do_deftpx(args) end_deftp = end_defcv def do_deftpx(self, args): self.write('
    ') words = splitwords(args, 2) [category, name], rest = words[:2], words[2:] self.expand('@b{%s}' % name) for word in rest: self.expand(' ' + word) #self.expand(' -- ' + category) self.write('\n
    ') self.index('tp', name) # --- Making Lists and Tables def bgn_enumerate(self, args): if not args: self.write('
      \n') self.stackinfo[len(self.stack)] = '
    \n' else: self.itemnumber = args self.write('
      \n') self.stackinfo[len(self.stack)] = '
    \n' def end_enumerate(self): self.itemnumber = None self.write(self.stackinfo[len(self.stack) + 1]) del self.stackinfo[len(self.stack) + 1] def bgn_itemize(self, args): self.itemarg = args self.write('
      \n') def end_itemize(self): self.itemarg = None self.write('
    \n') def bgn_table(self, args): self.itemarg = args self.write('
    \n') def end_table(self): self.itemarg = None self.write('
    \n') def bgn_ftable(self, args): self.itemindex = 'fn' self.bgn_table(args) def end_ftable(self): self.itemindex = None self.end_table() def bgn_vtable(self, args): self.itemindex = 'vr' self.bgn_table(args) def end_vtable(self): self.itemindex = None self.end_table() def do_item(self, args): if self.itemindex: self.index(self.itemindex, args) if self.itemarg: if self.itemarg[0] == '@' and self.itemarg[1] and \ self.itemarg[1] in string.ascii_letters: args = self.itemarg + '{' + args + '}' else: # some other character, e.g. '-' args = self.itemarg + ' ' + args if self.itemnumber <> None: args = self.itemnumber + '. ' + args self.itemnumber = increment(self.itemnumber) if self.stack and self.stack[-1] == 'table': self.write('
    ') self.expand(args) self.write('\n
    ') elif self.stack and self.stack[-1] == 'multitable': self.write('') self.expand(args) self.write('\n\n') else: self.write('
  • ') self.expand(args) self.write(' ') do_itemx = do_item # XXX Should suppress leading blank line # rpyron 2002-05-07 multitable support def bgn_multitable(self, args): self.itemarg = None # should be handled by columnfractions self.write('\n') def end_multitable(self): self.itemarg = None self.write('
    \n
    \n') def handle_columnfractions(self): # It would be better to handle this, but for now it's in the way... self.itemarg = None def handle_tab(self): self.write('\n ') # --- Enumerations, displays, quotations --- # XXX Most of these should increase the indentation somehow def bgn_quotation(self, args): self.write('
    ') def end_quotation(self): self.write('
    \n') def bgn_example(self, args): self.nofill = self.nofill + 1 self.write('
    ')
        def end_example(self):
            self.write('
    \n') self.nofill = self.nofill - 1 bgn_lisp = bgn_example # Synonym when contents are executable lisp code end_lisp = end_example bgn_smallexample = bgn_example # XXX Should use smaller font end_smallexample = end_example bgn_smalllisp = bgn_lisp # Ditto end_smalllisp = end_lisp bgn_display = bgn_example end_display = end_example bgn_format = bgn_display end_format = end_display def do_exdent(self, args): self.expand(args + '\n') # XXX Should really mess with indentation def bgn_flushleft(self, args): self.nofill = self.nofill + 1 self.write('
    \n')
        def end_flushleft(self):
            self.write('
    \n') self.nofill = self.nofill - 1 def bgn_flushright(self, args): self.nofill = self.nofill + 1 self.write('
    \n') def end_flushright(self): self.write('
    \n') self.nofill = self.nofill - 1 def bgn_menu(self, args): self.write('\n') self.write(' Menu

    \n') self.htmlhelp.beginmenu() def end_menu(self): self.write('

    \n') self.htmlhelp.endmenu() def bgn_cartouche(self, args): pass def end_cartouche(self): pass # --- Indices --- def resetindex(self): self.noncodeindices = ['cp'] self.indextitle = {} self.indextitle['cp'] = 'Concept' self.indextitle['fn'] = 'Function' self.indextitle['ky'] = 'Keyword' self.indextitle['pg'] = 'Program' self.indextitle['tp'] = 'Type' self.indextitle['vr'] = 'Variable' # self.whichindex = {} for name in self.indextitle.keys(): self.whichindex[name] = [] def user_index(self, name, args): if self.whichindex.has_key(name): self.index(name, args) else: print '*** No index named', repr(name) def do_cindex(self, args): self.index('cp', args) def do_findex(self, args): self.index('fn', args) def do_kindex(self, args): self.index('ky', args) def do_pindex(self, args): self.index('pg', args) def do_tindex(self, args): self.index('tp', args) def do_vindex(self, args): self.index('vr', args) def index(self, name, args): self.whichindex[name].append((args, self.nodename)) self.htmlhelp.index(args, self.nodename) def do_synindex(self, args): words = args.split() if len(words) <> 2: print '*** bad @synindex', args return [old, new] = words if not self.whichindex.has_key(old) or \ not self.whichindex.has_key(new): print '*** bad key(s) in @synindex', args return if old <> new and \ self.whichindex[old] is not self.whichindex[new]: inew = self.whichindex[new] inew[len(inew):] = self.whichindex[old] self.whichindex[old] = inew do_syncodeindex = do_synindex # XXX Should use code font def do_printindex(self, args): words = args.split() for name in words: if self.whichindex.has_key(name): self.prindex(name) else: print '*** No index named', repr(name) def prindex(self, name): iscodeindex = (name not in self.noncodeindices) index = self.whichindex[name] if not index: return if self.debugging: print '!'*self.debugging, '--- Generating', \ self.indextitle[name], 'index' # The node already provides a title index1 = [] junkprog = re.compile('^(@[a-z]+)?{') for key, node in index: sortkey = key.lower() # Remove leading `@cmd{' from sort key # -- don't bother about the matching `}' oldsortkey = sortkey while 1: mo = junkprog.match(sortkey) if not mo: break i = mo.end() sortkey = sortkey[i:] index1.append((sortkey, key, node)) del index[:] index1.sort() self.write('
    \n') prevkey = prevnode = None for sortkey, key, node in index1: if (key, node) == (prevkey, prevnode): continue if self.debugging > 1: print '!'*self.debugging, key, ':', node self.write('
    ') if iscodeindex: key = '@code{' + key + '}' if key != prevkey: self.expand(key) self.write('\n
    %s\n' % (makefile(node), node)) prevkey, prevnode = key, node self.write('
    \n') # --- Final error reports --- def report(self): if self.unknown: print '--- Unrecognized commands ---' cmds = self.unknown.keys() cmds.sort() for cmd in cmds: print cmd.ljust(20), self.unknown[cmd] class TexinfoParserHTML3(TexinfoParser): COPYRIGHT_SYMBOL = "©" FN_ID_PATTERN = "[%(id)s]" FN_SOURCE_PATTERN = '' + FN_ID_PATTERN + '' FN_TARGET_PATTERN = '\n' \ '

    ' + FN_ID_PATTERN \ + '\n%(text)s

    \n' FN_HEADER = '
    \n
    \n' \ ' Footnotes\n

    \n' Node = HTML3Node def bgn_quotation(self, args): self.write('') def end_quotation(self): self.write('\n') def bgn_example(self, args): # this use of would not be legal in HTML 2.0, # but is in more recent DTDs. self.nofill = self.nofill + 1 self.write('

    ')
        def end_example(self):
            self.write("
    \n") self.nofill = self.nofill - 1 def bgn_flushleft(self, args): self.nofill = self.nofill + 1 self.write('
    \n')
    
        def bgn_flushright(self, args):
            self.nofill = self.nofill + 1
            self.write('
    \n') def end_flushright(self): self.write('
    \n') self.nofill = self.nofill - 1 def bgn_menu(self, args): self.write('\n') # rpyron 2002-05-07 class HTMLHelp: """ This class encapsulates support for HTML Help. Node names, file names, menu items, index items, and image file names are accumulated until a call to finalize(). At that time, three output files are created in the current directory: `helpbase`.hhp is a HTML Help Workshop project file. It contains various information, some of which I do not understand; I just copied the default project info from a fresh installation. `helpbase`.hhc is the Contents file for the project. `helpbase`.hhk is the Index file for the project. When these files are used as input to HTML Help Workshop, the resulting file will be named: `helpbase`.chm If none of the defaults in `helpbase`.hhp are changed, the .CHM file will have Contents, Index, Search, and Favorites tabs. """ codeprog = re.compile('@code{(.*?)}') def __init__(self,helpbase,dirname): self.helpbase = helpbase self.dirname = dirname self.projectfile = None self.contentfile = None self.indexfile = None self.nodelist = [] self.nodenames = {} # nodename : index self.nodeindex = {} self.filenames = {} # filename : filename self.indexlist = [] # (args,nodename) == (key,location) self.current = '' self.menudict = {} self.dumped = {} def addnode(self,name,next,prev,up,filename): node = (name,next,prev,up,filename) # add this file to dict # retrieve list with self.filenames.values() self.filenames[filename] = filename # add this node to nodelist self.nodeindex[name] = len(self.nodelist) self.nodelist.append(node) # set 'current' for menu items self.current = name self.menudict[self.current] = [] def menuitem(self,nodename): menu = self.menudict[self.current] menu.append(nodename) def addimage(self,imagename): self.filenames[imagename] = imagename def index(self, args, nodename): self.indexlist.append((args,nodename)) def beginmenu(self): pass def endmenu(self): pass def finalize(self): if not self.helpbase: return # generate interesting filenames resultfile = self.helpbase + '.chm' projectfile = self.helpbase + '.hhp' contentfile = self.helpbase + '.hhc' indexfile = self.helpbase + '.hhk' # generate a reasonable title title = self.helpbase # get the default topic file (topname,topnext,topprev,topup,topfile) = self.nodelist[0] defaulttopic = topfile # PROJECT FILE try: fp = open(projectfile,'w') print>>fp, '[OPTIONS]' print>>fp, 'Auto Index=Yes' print>>fp, 'Binary TOC=No' print>>fp, 'Binary Index=Yes' print>>fp, 'Compatibility=1.1' print>>fp, 'Compiled file=' + resultfile + '' print>>fp, 'Contents file=' + contentfile + '' print>>fp, 'Default topic=' + defaulttopic + '' print>>fp, 'Error log file=ErrorLog.log' print>>fp, 'Index file=' + indexfile + '' print>>fp, 'Title=' + title + '' print>>fp, 'Display compile progress=Yes' print>>fp, 'Full-text search=Yes' print>>fp, 'Default window=main' print>>fp, '' print>>fp, '[WINDOWS]' print>>fp, ('main=,"' + contentfile + '","' + indexfile + '","","",,,,,0x23520,222,0x1046,[10,10,780,560],' '0xB0000,,,,,,0') print>>fp, '' print>>fp, '[FILES]' print>>fp, '' self.dumpfiles(fp) fp.close() except IOError, msg: print projectfile, ':', msg sys.exit(1) # CONTENT FILE try: fp = open(contentfile,'w') print>>fp, '' print>>fp, '' print>>fp, '' print>>fp, '' print>>fp, ('') print>>fp, '' print>>fp, '' print>>fp, '' print>>fp, ' ' print>>fp, ' ' print>>fp, ' ' print>>fp, ' ' print>>fp, ' ' self.dumpnodes(fp) print>>fp, '' print>>fp, '' fp.close() except IOError, msg: print contentfile, ':', msg sys.exit(1) # INDEX FILE try: fp = open(indexfile ,'w') print>>fp, '' print>>fp, '' print>>fp, '' print>>fp, '' print>>fp, ('') print>>fp, '' print>>fp, '' print>>fp, '' print>>fp, '' print>>fp, '' self.dumpindex(fp) print>>fp, '' print>>fp, '' fp.close() except IOError, msg: print indexfile , ':', msg sys.exit(1) def dumpfiles(self, outfile=sys.stdout): filelist = self.filenames.values() filelist.sort() for filename in filelist: print>>outfile, filename def dumpnodes(self, outfile=sys.stdout): self.dumped = {} if self.nodelist: nodename, dummy, dummy, dummy, dummy = self.nodelist[0] self.topnode = nodename print>>outfile, '
      ' for node in self.nodelist: self.dumpnode(node,0,outfile) print>>outfile, '
    ' def dumpnode(self, node, indent=0, outfile=sys.stdout): if node: # Retrieve info for this node (nodename,next,prev,up,filename) = node self.current = nodename # Have we been dumped already? if self.dumped.has_key(nodename): return self.dumped[nodename] = 1 # Print info for this node print>>outfile, ' '*indent, print>>outfile, '
  • ', print>>outfile, '', print>>outfile, '', print>>outfile, '' # Does this node have menu items? try: menu = self.menudict[nodename] self.dumpmenu(menu,indent+2,outfile) except KeyError: pass def dumpmenu(self, menu, indent=0, outfile=sys.stdout): if menu: currentnode = self.current if currentnode != self.topnode: # XXX this is a hack print>>outfile, ' '*indent + '
      ' indent += 2 for item in menu: menunode = self.getnode(item) self.dumpnode(menunode,indent,outfile) if currentnode != self.topnode: # XXX this is a hack print>>outfile, ' '*indent + '
    ' indent -= 2 def getnode(self, nodename): try: index = self.nodeindex[nodename] return self.nodelist[index] except KeyError: return None except IndexError: return None # (args,nodename) == (key,location) def dumpindex(self, outfile=sys.stdout): print>>outfile, '
      ' for (key,location) in self.indexlist: key = self.codeexpand(key) location = makefile(location) location = self.dirname + '/' + location print>>outfile, '
    • ', print>>outfile, '', print>>outfile, '', print>>outfile, '' print>>outfile, '
    ' def codeexpand(self, line): co = self.codeprog.match(line) if not co: return line bgn, end = co.span(0) a, b = co.span(1) line = line[:bgn] + line[a:b] + line[end:] return line # Put @var{} around alphabetic substrings def makevar(str): return '@var{'+str+'}' # Split a string in "words" according to findwordend def splitwords(str, minlength): words = [] i = 0 n = len(str) while i < n: while i < n and str[i] in ' \t\n': i = i+1 if i >= n: break start = i i = findwordend(str, i, n) words.append(str[start:i]) while len(words) < minlength: words.append('') return words # Find the end of a "word", matching braces and interpreting @@ @{ @} fwprog = re.compile('[@{} ]') def findwordend(str, i, n): level = 0 while i < n: mo = fwprog.search(str, i) if not mo: break i = mo.start() c = str[i]; i = i+1 if c == '@': i = i+1 # Next character is not special elif c == '{': level = level+1 elif c == '}': level = level-1 elif c == ' ' and level <= 0: return i-1 return n # Convert a node name into a file name def makefile(nodename): nodename = nodename.strip() return fixfunnychars(nodename) + '.html' # Characters that are perfectly safe in filenames and hyperlinks goodchars = string.ascii_letters + string.digits + '!@-=+.' # Replace characters that aren't perfectly safe by dashes # Underscores are bad since Cern HTTPD treats them as delimiters for # encoding times, so you get mismatches if you compress your files: # a.html.gz will map to a_b.html.gz def fixfunnychars(addr): i = 0 while i < len(addr): c = addr[i] if c not in goodchars: c = '-' addr = addr[:i] + c + addr[i+1:] i = i + len(c) return addr # Increment a string used as an enumeration def increment(s): if not s: return '1' for sequence in string.digits, string.lowercase, string.uppercase: lastc = s[-1] if lastc in sequence: i = sequence.index(lastc) + 1 if i >= len(sequence): if len(s) == 1: s = sequence[0]*2 if s == '00': s = '10' else: s = increment(s[:-1]) + sequence[0] else: s = s[:-1] + sequence[i] return s return s # Don't increment def test(): import sys debugging = 0 print_headers = 0 cont = 0 html3 = 0 htmlhelp = '' while sys.argv[1] == ['-d']: debugging = debugging + 1 del sys.argv[1] if sys.argv[1] == '-p': print_headers = 1 del sys.argv[1] if sys.argv[1] == '-c': cont = 1 del sys.argv[1] if sys.argv[1] == '-3': html3 = 1 del sys.argv[1] if sys.argv[1] == '-H': helpbase = sys.argv[2] del sys.argv[1:3] if len(sys.argv) <> 3: print 'usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]', \ 'inputfile outputdirectory' sys.exit(2) if html3: parser = TexinfoParserHTML3() else: parser = TexinfoParser() parser.cont = cont parser.debugging = debugging parser.print_headers = print_headers file = sys.argv[1] dirname = sys.argv[2] parser.setdirname(dirname) parser.setincludedir(os.path.dirname(file)) htmlhelp = HTMLHelp(helpbase, dirname) parser.sethtmlhelp(htmlhelp) try: fp = open(file, 'r') except IOError, msg: print file, ':', msg sys.exit(1) parser.parse(fp) fp.close() parser.report() htmlhelp.finalize() if __name__ == "__main__": test() PK! nm2def.pynuȯ#! /usr/bin/python2.7 """nm2def.py Helpers to extract symbols from Unix libs and auto-generate Windows definition files from them. Depends on nm(1). Tested on Linux and Solaris only (-p option to nm is for Solaris only). By Marc-Andre Lemburg, Aug 1998. Additional notes: the output of nm is supposed to look like this: acceler.o: 000001fd T PyGrammar_AddAccelerators U PyGrammar_FindDFA 00000237 T PyGrammar_RemoveAccelerators U _IO_stderr_ U exit U fprintf U free U malloc U printf grammar1.o: 00000000 T PyGrammar_FindDFA 00000034 T PyGrammar_LabelRepr U _PyParser_TokenNames U abort U printf U sprintf ... Even if this isn't the default output of your nm, there is generally an option to produce this format (since it is the original v7 Unix format). """ import os, sys PYTHONLIB = 'libpython'+sys.version[:3]+'.a' PC_PYTHONLIB = 'Python'+sys.version[0]+sys.version[2]+'.dll' NM = 'nm -p -g %s' # For Linux, use "nm -g %s" def symbols(lib=PYTHONLIB,types=('T','C','D')): lines = os.popen(NM % lib).readlines() lines = [s.strip() for s in lines] symbols = {} for line in lines: if len(line) == 0 or ':' in line: continue items = line.split() if len(items) != 3: continue address, type, name = items if type not in types: continue symbols[name] = address,type return symbols def export_list(symbols): data = [] code = [] for name,(addr,type) in symbols.items(): if type in ('C','D'): data.append('\t'+name) else: code.append('\t'+name) data.sort() data.append('') code.sort() return ' DATA\n'.join(data)+'\n'+'\n'.join(code) # Definition file template DEF_TEMPLATE = """\ EXPORTS %s """ # Special symbols that have to be included even though they don't # pass the filter SPECIALS = ( ) def filter_Python(symbols,specials=SPECIALS): for name in symbols.keys(): if name[:2] == 'Py' or name[:3] == '_Py': pass elif name not in specials: del symbols[name] def main(): s = symbols(PYTHONLIB) filter_Python(s) exports = export_list(s) f = sys.stdout # open('PC/python_nt.def','w') f.write(DEF_TEMPLATE % (exports)) f.close() if __name__ == '__main__': main() PK!:OrG%% reindent.pycnu[ fc@sdZdZddlZddlZddlZddlZddlZdadada e a ddZ dZdZdZd Zd d Zd dd YZdZedkrendS(sAreindent [-d][-r][-v] [ path ... ] -d (--dryrun) Dry run. Analyze, but don't make any changes to, files. -r (--recurse) Recurse. Search for all .py files in subdirectories too. -n (--nobackup) No backup. Does not make a ".bak" file before reindenting. -v (--verbose) Verbose. Print informative msgs; else no output. -h (--help) Help. Print this usage information and exit. Change Python (.py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files. Also ensure the last line ends with a newline. If no paths are given on the command line, reindent operates as a filter, reading a single source file from standard input and writing the transformed source to standard output. In this case, the -d, -r and -v flags are ignored. You can pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. If output is not to standard output, reindent overwrites files in place, renaming the originals with a .bak extension. If it finds nothing to change, the file is left alone. If reindent does change a file, the changed file is a fixed-point for future runs (i.e., running reindent on the resulting .py file won't change it again). The hard part of reindenting is figuring out what to do with comment lines. So long as the input files get a clean bill of health from tabnanny.py, reindent should do a good job. The backup file is a copy of the one that is being reindented. The ".bak" file is generated with shutil.copy(), but some corner cases regarding user/group and permissions could leave the backup file more readable than you'd prefer. You can always use the --nobackup option to prevent this. t1iNicCs-|dk rtj|IJntjtIJdS(N(tNonetsyststderrt__doc__(tmsg((s./usr/lib64/python2.7/Tools/scripts/reindent.pytusage6s cGsKd}x.|D]&}tjj|t|d}q WtjjddS(Ntt s (RRtwritetstr(targstseptarg((s./usr/lib64/python2.7/Tools/scripts/reindent.pyterrprint;s   cCsEddl}y5|jtjdddddddg\}}Wn!|jk rd}t|dSXx|D]\}}|dkrtd7aql|dkrtd7aql|dkrtaql|dkrt d7a ql|dkrltdSqlW|s&t tj }|j |j tjdSx|D]}t|q-WdS(Niitdrnvhtdryruntrecursetnobackuptverbosethelps-ds--dryruns-rs --recurses-ns --nobackups-vs --verboses-hs--help(s-ds--dryrun(s-rs --recurse(s-ns --nobackup(s-vs --verbose(s-hs--help(tgetoptRtargvterrorRRRtFalset makebackupRt ReindentertstdintrunR tstdouttcheck(RtoptsR RtotatrR ((s./usr/lib64/python2.7/Tools/scripts/reindent.pytmainBs4 "            c Cs6tjj|rtjj| rtr7dG|GHntj|}x|D]}tjj||}trtjj|rtjj| rtjj|dj d s|j j drMt |qMqMWdStrdG|GdGnyt |d}Wn.tk r5}td|t|fdSXt|}|j|j}t|trvtd |dS|jr trd GHtrd GHqnts|d }trtj||trd G|GdG|GHqnt |d}|j||jtrdG|GHqntStr.dGHntSdS(Nslisting directoryit.s.pytcheckings...trbs%s: I/O Error: %ss0%s: mixed newlines detected; cannot process fileschanged.s+But this is a dry run, so leaving it alone.s.baks backed upttotwbs wrote news unchanged.(tostpathtisdirtislinkRtlistdirtjoinRtsplitt startswithtlowertendswithRtopentIOErrorRR Rtclosetnewlinest isinstancettupleRRRtshutiltcopyfileR tTrueR( tfiletnamestnametfullnametfRR"tnewlinetbak((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_sZ%           cCsWd|D}|jdtt|}|s9dSt|dkrS|dS|S(NcSsXh|]N}|ddkr"dn/|ddkr8dn|ddkrNdndqS(is is s R((t.0tline((s./usr/lib64/python2.7/Tools/scripts/reindent.pys s Rs ii(tdiscardR8tsortedtlen(tlinesR6((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_detect_newliness  s cCsEt|}x.|dkr<||d|kr<|d8}qW|| S(sReturn line stripped of trailing spaces, tabs, newlines. Note that line.rstrip() instead also strips sundry control characters, but at least one known Emacs user expects to keep junk like that, not mentioning Barry by name or anything . ii(RG(RDtJUNKti((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_rstrips #RcBsSeZdZdZdZdZejejej ej ej dZ RS(cCsd|_d|_|j|_t|j|_t|jtrX|jd|_n |j|_g|jD]}t |j |j^qn|_ |j j ddd|_g|_dS(Nii(t find_stmttlevelt readlinestrawRIR6R7R8RARLt expandtabsRHtinsertRtindextstats(tselfR@RD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt__init__s   / cCstj|j|j|j}x'|rH|d|jkrH|jq"W|j}|jt|dfi}g}|_ |dd}|j |d|!xft t|dD]N}||\}}||dd}t ||} |d} | dkr.| r%|j | d} | dkrxkt|dt|dD]I} || \} } | dkrG| t || kr| d} nPqGqGWn| dkr xgt|dddD]L} || \} } | dkr| t || dt || } PqqWn| dkr+| } q+q.d} n| dks@t| || <| | }|dksl| dkr|j |||!qx|||!D]p}|dkr||jkr|j|q|jd||qtt || }|j||qWqW|j|j kS(NiiiiR(ttokenizetgetlinet tokeneaterRHRAtpopRTtappendRGtaftertextendtranget getlspacetgettxrangetAssertionErrortminRP(RURHRTt have2wantR\RKtthisstmtt thisleveltnextstmtthavetwanttjtjlinetjleveltdiffRDtremove((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRs`      $            cCs|j|jdS(N(t writelinesR\(RUR@((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR scCsD|jt|jkr!d}n|j|j}|jd7_|S(NRi(RSRGRH(RURD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRXs  c Cs|\} } ||kr$d|_n||krKd|_|jd7_n||krrd|_|jd8_nw|| kr|jr|jj| dfqnF|| krn7|jrd|_|r|jj| |jfqndS(Niii(RMRNRTR[( RUttypettokent.3tendRDtINDENTtDEDENTtNEWLINEtCOMMENTtNLtslinetscol((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRYs$            ( t__name__t __module__RVRR RXRWRtRuRvRwRxRY(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRs  E  cCsDdt|}}x*||kr?||dkr?|d7}qW|S(NiRi(RG(RDRKtn((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_Fst__main__((Rt __version__RWR)R9RtioRRRR;RRRRR#RRIRLRR_R{(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt(s&       4    PK!Q<` db2pickle.pyonu[ fc@sBdZddlZyddlZWnek r;dZnXyddlZWnek redZnXyddlZWnek rdZnXyddlZWnek rdZnXddlZyddl Z Wnek rddl Z nXej dZ dZ dZedkr>ejeej dndS(s5 Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ] Convert the database file given on the command line to a pickle representation. The optional flags indicate the type of the database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for write access (deleting any existing data). If no pickle file is named, the pickle output is written to standard output. iNicCstjjttdS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytusage/sc Csy1tj|dddddddg\}}Wntjk rOtdSXt|d kstt|d krtdSt|dkr|d }tj}nN|d }yt|dd }Wn*tk rtjj d |ddSXd}x|D]\}}|d"krOy t j }Wqt k rKtjj ddSXq|d#kry t j}Wqt k rtjj ddSXq|d$kry t j}Wqt k rtjj ddSXq|d%kry tj}Wqt k rtjj ddSXq|d&krSy tj}Wqt k rOtjj ddSXq|d'kry tj}Wqt k rtjj ddSXqqW|dkrt dkrtjj dtjj ddSt j }ny||d}Wn9t jk r.tjj d |tjj d!dSXx7|jD])}tj|||f|ddkq<W|j|jd S((NthbrdagthashtbtreetrecnotdbmtgdbmtanydbmiiitwbsUnable to open %s s-hs--hashsbsddb module unavailable. s-bs--btrees-rs--recnos-as--anydbmsanydbm module unavailable. s-gs--gdbmsgdbm module unavailable. s-ds--dbmsdbm module unavailable. sbsddb module unavailable - smust specify dbtype. trsUnable to open %s. s&Check for format or version mismatch. (s-hs--hash(s-bs--btree(s-rs--recno(s-as--anydbm(s-gs--gdbm(s-ds--dbm(tgetoptterrorRtlenRtstdouttopentIOErrorRRtNonetbsddbthashopentAttributeErrortbtopentrnopenR R R tkeystpickletdumptclose( targstoptstdbfiletpfiletdbopentopttargtdbtk((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytmain2s  $                          '  t__main__i(RRRt ImportErrorRR R R RtcPickleRtargvtprogRR(t__name__texit(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pyts6              T PK! ZQ Q md5sum.pynuȯ#! /usr/bin/python2.7 """Python utility to print MD5 checksums of argument files. """ bufsize = 8096 fnfilter = None rmode = 'rb' usage = """ usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...] -b : read files in binary mode (default) -t : read files in text mode (you almost certainly don't want this!) -l : print last pathname component only -s bufsize: read buffer size (default %d) file ... : files to sum; '-' or no files means stdin """ % bufsize import sys import os import getopt import md5 def sum(*files): sts = 0 if files and isinstance(files[-1], file): out, files = files[-1], files[:-1] else: out = sys.stdout if len(files) == 1 and not isinstance(files[0], str): files = files[0] for f in files: if isinstance(f, str): if f == '-': sts = printsumfp(sys.stdin, '', out) or sts else: sts = printsum(f, out) or sts else: sts = sum(f, out) or sts return sts def printsum(filename, out=sys.stdout): try: fp = open(filename, rmode) except IOError, msg: sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) return 1 if fnfilter: filename = fnfilter(filename) sts = printsumfp(fp, filename, out) fp.close() return sts def printsumfp(fp, filename, out=sys.stdout): m = md5.new() try: while 1: data = fp.read(bufsize) if not data: break m.update(data) except IOError, msg: sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) return 1 out.write('%s %s\n' % (m.hexdigest(), filename)) return 0 def main(args = sys.argv[1:], out=sys.stdout): global fnfilter, rmode, bufsize try: opts, args = getopt.getopt(args, 'blts:') except getopt.error, msg: sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage)) return 2 for o, a in opts: if o == '-l': fnfilter = os.path.basename elif o == '-b': rmode = 'rb' elif o == '-t': rmode = 'r' elif o == '-s': bufsize = int(a) if not args: args = ['-'] return sum(args, out) if __name__ == '__main__' or __name__ == sys.argv[0]: sys.exit(main(sys.argv[1:], sys.stdout)) PK!!溙,, reindent.pynuȯ#! /usr/bin/python2.7 # Released to the public domain, by Tim Peters, 03 October 2000. """reindent [-d][-r][-v] [ path ... ] -d (--dryrun) Dry run. Analyze, but don't make any changes to, files. -r (--recurse) Recurse. Search for all .py files in subdirectories too. -n (--nobackup) No backup. Does not make a ".bak" file before reindenting. -v (--verbose) Verbose. Print informative msgs; else no output. -h (--help) Help. Print this usage information and exit. Change Python (.py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files. Also ensure the last line ends with a newline. If no paths are given on the command line, reindent operates as a filter, reading a single source file from standard input and writing the transformed source to standard output. In this case, the -d, -r and -v flags are ignored. You can pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. If output is not to standard output, reindent overwrites files in place, renaming the originals with a .bak extension. If it finds nothing to change, the file is left alone. If reindent does change a file, the changed file is a fixed-point for future runs (i.e., running reindent on the resulting .py file won't change it again). The hard part of reindenting is figuring out what to do with comment lines. So long as the input files get a clean bill of health from tabnanny.py, reindent should do a good job. The backup file is a copy of the one that is being reindented. The ".bak" file is generated with shutil.copy(), but some corner cases regarding user/group and permissions could leave the backup file more readable than you'd prefer. You can always use the --nobackup option to prevent this. """ __version__ = "1" import tokenize import os, shutil import sys import io verbose = 0 recurse = 0 dryrun = 0 makebackup = True def usage(msg=None): if msg is not None: print >> sys.stderr, msg print >> sys.stderr, __doc__ def errprint(*args): sep = "" for arg in args: sys.stderr.write(sep + str(arg)) sep = " " sys.stderr.write("\n") def main(): import getopt global verbose, recurse, dryrun, makebackup try: opts, args = getopt.getopt(sys.argv[1:], "drnvh", ["dryrun", "recurse", "nobackup", "verbose", "help"]) except getopt.error, msg: usage(msg) return for o, a in opts: if o in ('-d', '--dryrun'): dryrun += 1 elif o in ('-r', '--recurse'): recurse += 1 elif o in ('-n', '--nobackup'): makebackup = False elif o in ('-v', '--verbose'): verbose += 1 elif o in ('-h', '--help'): usage() return if not args: r = Reindenter(sys.stdin) r.run() r.write(sys.stdout) return for arg in args: check(arg) def check(file): if os.path.isdir(file) and not os.path.islink(file): if verbose: print "listing directory", file names = os.listdir(file) for name in names: fullname = os.path.join(file, name) if ((recurse and os.path.isdir(fullname) and not os.path.islink(fullname) and not os.path.split(fullname)[1].startswith(".")) or name.lower().endswith(".py")): check(fullname) return if verbose: print "checking", file, "...", try: f = open(file, "rb") except IOError, msg: errprint("%s: I/O Error: %s" % (file, str(msg))) return r = Reindenter(f) f.close() newline = r.newlines if isinstance(newline, tuple): errprint("%s: mixed newlines detected; cannot process file" % file) return if r.run(): if verbose: print "changed." if dryrun: print "But this is a dry run, so leaving it alone." if not dryrun: bak = file + ".bak" if makebackup: shutil.copyfile(file, bak) if verbose: print "backed up", file, "to", bak f = open(file, "wb") r.write(f) f.close() if verbose: print "wrote new", file return True else: if verbose: print "unchanged." return False def _detect_newlines(lines): newlines = {'\r\n' if line[-2:] == '\r\n' else '\n' if line[-1:] == '\n' else '\r' if line[-1:] == '\r' else '' for line in lines} newlines.discard('') newlines = tuple(sorted(newlines)) if not newlines: return '\n' if len(newlines) == 1: return newlines[0] return newlines def _rstrip(line, JUNK='\r\n \t'): """Return line stripped of trailing spaces, tabs, newlines. Note that line.rstrip() instead also strips sundry control characters, but at least one known Emacs user expects to keep junk like that, not mentioning Barry by name or anything . """ i = len(line) while i > 0 and line[i-1] in JUNK: i -= 1 return line[:i] class Reindenter: def __init__(self, f): self.find_stmt = 1 # next token begins a fresh stmt? self.level = 0 # current indent level # Raw file lines. self.raw = f.readlines() # Save the newlines found in the file so they can be used to # create output without mutating the newlines. self.newlines = _detect_newlines(self.raw) if isinstance(self.newlines, tuple): self.newline = self.newlines[0] else: self.newline = self.newlines # File lines, rstripped & tab-expanded. Dummy at start is so # that we can use tokenize's 1-based line numbering easily. # Note that a line is all-blank iff it's newline. self.lines = [_rstrip(line).expandtabs() + self.newline for line in self.raw] self.lines.insert(0, None) self.index = 1 # index into self.lines of next line # List of (lineno, indentlevel) pairs, one for each stmt and # comment line. indentlevel is -1 for comment lines, as a # signal that tokenize doesn't know what to do about them; # indeed, they're our headache! self.stats = [] def run(self): tokenize.tokenize(self.getline, self.tokeneater) # Remove trailing empty lines. lines = self.lines while lines and lines[-1] == self.newline: lines.pop() # Sentinel. stats = self.stats stats.append((len(lines), 0)) # Map count of leading spaces to # we want. have2want = {} # Program after transformation. after = self.after = [] # Copy over initial empty lines -- there's nothing to do until # we see a line with *something* on it. i = stats[0][0] after.extend(lines[1:i]) for i in range(len(stats)-1): thisstmt, thislevel = stats[i] nextstmt = stats[i+1][0] have = getlspace(lines[thisstmt]) want = thislevel * 4 if want < 0: # A comment line. if have: # An indented comment line. If we saw the same # indentation before, reuse what it most recently # mapped to. want = have2want.get(have, -1) if want < 0: # Then it probably belongs to the next real stmt. for j in xrange(i+1, len(stats)-1): jline, jlevel = stats[j] if jlevel >= 0: if have == getlspace(lines[jline]): want = jlevel * 4 break if want < 0: # Maybe it's a hanging # comment like this one, # in which case we should shift it like its base # line got shifted. for j in xrange(i-1, -1, -1): jline, jlevel = stats[j] if jlevel >= 0: want = have + getlspace(after[jline-1]) - \ getlspace(lines[jline]) break if want < 0: # Still no luck -- leave it alone. want = have else: want = 0 assert want >= 0 have2want[have] = want diff = want - have if diff == 0 or have == 0: after.extend(lines[thisstmt:nextstmt]) else: for line in lines[thisstmt:nextstmt]: if diff > 0: if line == self.newline: after.append(line) else: after.append(" " * diff + line) else: remove = min(getlspace(line), -diff) after.append(line[remove:]) return self.raw != self.after def write(self, f): f.writelines(self.after) # Line-getter for tokenize. def getline(self): if self.index >= len(self.lines): line = "" else: line = self.lines[self.index] self.index += 1 return line # Line-eater for tokenize. def tokeneater(self, type, token, (sline, scol), end, line, INDENT=tokenize.INDENT, DEDENT=tokenize.DEDENT, NEWLINE=tokenize.NEWLINE, COMMENT=tokenize.COMMENT, NL=tokenize.NL): if type == NEWLINE: # A program statement, or ENDMARKER, will eventually follow, # after some (possibly empty) run of tokens of the form # (NL | COMMENT)* (INDENT | DEDENT+)? self.find_stmt = 1 elif type == INDENT: self.find_stmt = 1 self.level += 1 elif type == DEDENT: self.find_stmt = 1 self.level -= 1 elif type == COMMENT: if self.find_stmt: self.stats.append((sline, -1)) # but we're still looking for a new stmt, so leave # find_stmt alone elif type == NL: pass elif self.find_stmt: # This is the first "real token" following a NEWLINE, so it # must be the first token of the next program statement, or an # ENDMARKER. self.find_stmt = 0 if line: # not endmarker self.stats.append((sline, self.level)) # Count number of leading blanks. def getlspace(line): i, n = 0, len(line) while i < n and line[i] == " ": i += 1 return i if __name__ == '__main__': main() PK!8e e md5sum.pycnu[ fc@sdZdadadadtZddlZddlZddlZddl Z dZ ej dZ ej dZ ejd ej d Zed kseejd krejeejd ej ndS( s9Python utility to print MD5 checksums of argument files. itrbs? usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...] -b : read files in binary mode (default) -t : read files in text mode (you almost certainly don't want this!) -l : print last pathname component only -s bufsize: read buffer size (default %d) file ... : files to sum; '-' or no files means stdin iNcGsd}|r7t|dtr7|d|d }}n tj}t|dkrst|dt rs|d}nxt|D]l}t|tr|dkrttjd|p|}qt||p|}qzt ||p|}qzW|S(Niiit-s( t isinstancetfiletsyststdouttlentstrt printsumfptstdintprintsumtsum(tfilestststouttf((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR s &   cCsyyt|t}Wn.tk rC}tjjd||fdSXtrYt|}nt|||}|j|S(Ns%s: Can't open: %s i( topentrmodetIOErrorRtstderrtwritetfnfilterRtclose(tfilenameRtfptmsgR ((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR +s cCstj}y1x*|jt}|s+Pn|j|qWWn.tk rm}tjjd||fdSX|jd|j |fdS(Ns%s: I/O error: %s is%s %s i( tmd5tnewtreadtbufsizetupdateRRRRt hexdigest(RRRtmtdataR((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR7s icCsytj|d\}}Wn;tjk rY}tjjdtjd|tfdSXxt|D]l\}}|dkrtjj a qa|dkrda qa|dkrd a qa|d krat |a qaqaW|sd g}nt||S( Nsblts:s %s: %s %siis-ls-bRs-ttrs-sR(tgetoptterrorRRRtargvtusagetostpathtbasenameRRtintRR (targsRtoptsRtota((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pytmainEs"$       t__main__i(t__doc__RtNoneRRR&RR'R#RR RR RR%R/t__name__texit(((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyts       PK!l:E google.pycnu[ fc@s;ddlZddlZdZedkr7endS(iNcCstjd}|s'dtjdGHdSg}xg|D]_}d|kr[|jdd}nd|krtd|}n|jdd}|j|q4Wdj|}d|}tj|dS( NisUsage: %s querystringit+s%2Bt s"%s"s!http://www.google.com/search?q=%s(tsystargvtreplacetappendtjoint webbrowsertopen(targstlisttargtsturl((s,/usr/lib64/python2.7/Tools/scripts/google.pytmains      t__main__(RRRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/google.pyts  PK!A_xxci.pyonu[ fc@s8ddlZddlZddlTddlZdZd*ZdZdZdd d d d gZd ddddgZ ddddddddddddddgZ gZ d Z d!Z d"Zd#Zd$Zd%Zd&Zd'Zed(kr4ye eeWq4ek r0d)GHq4XndS(+iN(t*s`iicCstjd}|r|SdGHg}xBtjtjD].}t|s5|jt||fq5q5W|j|sdGHtj dn|j|j x!|D]\}}|j|qW|S(Nis1No arguments, checking almost *, in "ls -t" ordersNothing to do -- exit 1( tsystargvtostlistdirtcurdirtskipfiletappendtgetmtimetsorttexittreverse(targstlisttfiletmtime((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgetargss"      cCs7ytj|}|tSWntjk r2dSXdS(Ni(RtstattST_MTIMEterror(Rtst((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR"s  ttagstTAGStxyzzys nohup.outtcoret.t,t@t#so.t~s.as.os.olds.baks.origs.news.prevs.nots.pycs.fdcs.rgbs.elcs,vcCstt(xtD]}tj|dqWxtD]}tjd|q0Wytdd}Wntk rrdSXt|jjt(dS(NRs.xxcigntr( tbadnamestignoret badprefixesRt badsuffixestopentIOErrortreadtsplit(tptf((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytsetup0s   cCsx$tD]}tj||rdSqWytj|}Wntjk rQdSXt|tsfdS|ttkrzdSy2t |dj t t }|t krdSWnnXdS(NiRi( R tfnmatchRtlstatRtS_ISREGtST_MODEtST_SIZEtMAXSIZER#R%tlent EXECMAGIC(RR'Rtdata((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR<s$  cCs/x(tD] }|t| |krdSqWdS(Nii(R!R0(Rtbad((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt badprefixOs cCs0x)tD]!}|t| |krdSqWdS(Nii(R"R0(RR3((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyt badsuffixTs cCstxm|D]e}|dGHt|rt|td|drltjd|}tjd|}qlqqWdS(Nt:s Check in s ? srcs -l sci -l (t differingt showdiffstaskyesnoRtsystem(R Rtsts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pytgoYs    cCs+d|d|}tj|}|dkS(Nsco -p s 2>/dev/null | cmp -s - i(RR:(RtcmdR;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR7bscCs!d|d}tj|}dS(Nsrcsdiff s 2>&1 | ${PAGER-more}(RR:(RR=R;((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR8gscCst|}|dkS(Ntytyes(R>R?(t raw_input(tpromptts((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyR9ks t__main__s[Intr]i (RRRR*R1R/RRRR!R"R R)RR4R5R<R7R8R9t__name__tKeyboardInterrupt(((s*/usr/lib64/python2.7/Tools/scripts/xxci.pyts4              PK!A bfindlinksto.pyonu[ fc@s\ddlZddlZddlZddlZdZdZedkrXendS(iNcCsyJtjtjdd\}}t|dkrItjddnWn9tjk r}tjt_|GHdGHtjdnX|d|d}}t j |}x$|D]}t j j |t|qWdS(Nitisnot enough argumentss(usage: findlinksto pattern directory ...i(tgetopttsystargvtlent GetoptErrortNonetstderrtstdouttexittretcompiletostpathtwalktvisit(toptstargstmsgtpattdirstprogtdirname((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pytmain s  cCstjj|rg|(dStjj|r;dG|GHnxr|D]j}tjj||}y8tj|}|j|dk r|GdG|GHnWqBtjk rqBXqBWdS(Ns descend intos->( R R tislinktismounttjointreadlinktsearchRterror(RRtnamestnametlinkto((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyRs  t__main__(R RR RRRt__name__(((s1/usr/lib64/python2.7/Tools/scripts/findlinksto.pyts       PK!QZ texcheck.pyonu[ fc@sdZddlZddlZddlZddlmZmZmZddlZdZ dZ gdZ ddZ edkreje ndS( s TeXcheck.py -- rough syntax checking on Python style LaTeX documents. Written by Raymond D. Hettinger Copyright (c) 2003 Python Software Foundation. All rights reserved. Designed to catch common markup errors including: * Unbalanced or mismatched parenthesis, brackets, and braces. * Unbalanced or mismatched \begin and \end blocks. * Misspelled or invalid LaTeX commands. * Use of forward slashes instead of backslashes for commands. * Table line size mismatches. Sample command line usage: python texcheck.py -k chapterheading -m lib/librandomtex *.tex Options: -m Munge parenthesis and brackets. [0,n) would normally mismatch. -k keyword: Keyword is a valid LaTeX command. Do not include the backslash. -d: Delimiter check only (useful for non-LaTeX files). -h: Help -s lineno: Start at lineno (useful for skipping complex sections). -v: Verbose. Trace the matching of //begin and //end blocks. iN(tiziptcounttislices \section \module \declaremodule \modulesynopsis \moduleauthor \sectionauthor \versionadded \code \class \method \begin \optional \var \ref \end \subsection \lineiii \hline \label \indexii \textrm \ldots \keyword \stindex \index \item \note \withsubitem \ttindex \footnote \citetitle \samp \opindex \noindent \exception \strong \dfn \ctype \obindex \character \indexiii \function \bifuncindex \refmodule \refbimodindex \subsubsection \nodename \member \chapter \emph \ASCII \UNIX \regexp \program \production \token \productioncont \term \grammartoken \lineii \seemodule \file \EOF \documentclass \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp \tableofcontents \kbd \programopt \envvar \refstmodindex \cfunction \constant \NULL \moreargs \cfuncline \cdata \textasciicircum \n \ABC \setindexsubitem \versionchanged \deprecated \seetext \newcommand \POSIX \pep \warning \rfc \verbatiminput \methodline \textgreater \seetitle \lineiv \funclineni \ulink \manpage \funcline \dataline \unspecified \textbackslash \mimetype \mailheader \seepep \textunderscore \longprogramopt \infinity \plusminus \shortversion \version \refmodindex \seerfc \makeindex \makemodindex \renewcommand \indexname \appendix \protect \indexiv \mbox \textasciitilde \platform \seeurl \leftmargin \labelwidth \localmoduletable \LaTeX \copyright \memberline \backslash \pi \centerline \caption \vspace \textwidth \menuselection \textless \makevar \csimplemacro \menuselection \bfcode \sub \release \email \kwindex \refexmodindex \filenq \e \menuselection \exindex \linev \newsgroup \verbatim \setshortversion \author \authoraddress \paragraph \subparagraph \cmemberline \textbar \C \seelink cCsry|j\}}Wn!tk r9d||fGHdSX||j||gkrYdSd||||fGHdS(sCVerify that closing delimiter matches most recent opening delimitersU Delimiter mismatch. On line %d, encountered closing '%s' without corresponding openNsJ Opener '%s' on line %d was not closed before encountering '%s' on line %d(tpopt IndexErrortget(tc_linenotc_symboltopenerstpairmapto_linenoto_symbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyt matchclose?s c#CsPtjd}tjd}ttj}x|D]}|jd|q7Wd|kruidd6dd6}nid d6d d6}td}tjd } tjd } tjd } tjd} g} g}tjd}tjd}tjd}d}d}t|jdd}d}xtt |t ||dd/D]\}}|j }x| j |D]\}}}d|kr|GdG|G|G|Gn|dkrd|kr| j||fnr||kr| j||fnP|dkr2d|kr2t||| |n"||krTt||| |nd|krdG| GHqqWxv| j |D]e\}}|dkr|j|n|dkry|jWqtk rd|fGHqXqqWd|krqZnxW|j |D]F}d |ks d!|kr/q nd||kr d"||fGHq q Wx)| j |D]}d#|||fGHqeW|jd$}|d%kr|jd|}|jd|}|j||d|!nx5|j |D]$}||krd&||fGHqqW|j|}|r@|jd}|}n|j|}|r|jd|krd'|jd|||fGHn|j|rd}nd(|ksd)|krd*|fGHnx&| j |D]} d+| |fGHqWqZW|}!x#| D]\}}"d,|"|fGHqWx|D]}d-|fGHq*Wd.|!fGHdS(0sCheck the LaTeX formatting in a sequence of lines. Opts is a mapping of options to option values if any: -m munge parenthesis and brackets -d delimiters only checking -v verbose trace of delimiter matching -s lineno: linenumber to start scan (default is 1). Morecmds is a sequence of LaTeX commands (without backslashes) that are to be considered valid in the scan. s \\[A-Za-z]+s \/([A-Za-z]+)s\s-ms[(t]s([t)t[t(s&\\(begin|end){([_a-zA-Z]+)}|([()\[\]])s({)|(})s(\b[A-za-z]+\b) \b\1\bs<\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\ss\\begin{(?:long)?table([iv]+)}s\\line([iv]+){s\\end{(?:long)?table([iv]+)}tis-st1is-vt|tbegins-dtends --> t{t}s Warning, unmatched } on line %s.t822s.htmls4Warning, forward slash used on line %d with cmd: /%ss2Warning, \%s should be written as \%s{} on line %ds \newcommandis(Warning, unknown tex cmd on line %d: \%ss>Warning, \line%s on line %d does not match \table%s on line %dse.g.si.e.s2Style warning, avoid use of i.e or e.g. on line %ds&Doubled word warning. "%s" on line %ds(Unmatched open delimiter '%s' on line %dsUnmatched { on line %dsDone checking %d lines.N(tretcompiletsettcmdstrtsplittaddtintRRRRtNonetrstriptfindalltappendR RRtfindtsearchtgroup(#tsourcetoptstmorecmdsttexcmdt falsetexcmdt validcmdstcmdR t openpunctt delimiterstbracest doubledwordst spacingmarkupRt bracestackt tablestartt tablelinettableendt tablelevelttablestartlinet startlinetlinenotlinetbegendtnametpuncttopentclosetnctstartRtmtdwtlastlinetsymbol((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytcheckitJs    2            !   c Cs|dkrtjd}ntj|d\}}t|}d|ksX|gkratGHdSt|dkr|dGHdSxOt|D]A\}}d|ksd|krtj||||d+qqWg|D]\}}|dkr|^q}g} x}|D]u} d d GHd G| GHyt | } Wnt k rOd |dGHd SXz| j t | ||Wd| j XqWt| S(Nisk:mdhs:vs-his#Please specify a file to be checkedt*t?s-kt=itCheckingsCannot open file %s.i(R tsystargvtgetopttdictt__doc__tlent enumeratetglobR?tIOErrorR#RGR@tmax( targstoptitemstarglistR(titfilespectktvR)terrtfilenametf((s./usr/lib64/python2.7/Tools/scripts/texcheck.pytmains6  !+     t__main__(RPRRLRNt itertoolsRRRRSRR RGR R`t__name__texit(((s./usr/lib64/python2.7/Tools/scripts/texcheck.pyts     z $ PK!Ɨ treesync.pynuȯ#! /usr/bin/python2.7 """Script to synchronize two source trees. Invoke with two arguments: python treesync.py slave master The assumption is that "master" contains CVS administration while slave doesn't. All files in the slave tree that have a CVS/Entries entry in the master tree are synchronized. This means: If the files differ: if the slave file is newer: normalize the slave file if the files still differ: copy the slave to the master else (the master is newer): copy the master to the slave normalizing the slave means replacing CRLF with LF when the master doesn't use CRLF """ import os, sys, stat, getopt # Interactivity options default_answer = "ask" create_files = "yes" create_directories = "no" write_slave = "ask" write_master = "ask" def main(): global always_no, always_yes global create_directories, write_master, write_slave opts, args = getopt.getopt(sys.argv[1:], "nym:s:d:f:a:") for o, a in opts: if o == '-y': default_answer = "yes" if o == '-n': default_answer = "no" if o == '-s': write_slave = a if o == '-m': write_master = a if o == '-d': create_directories = a if o == '-f': create_files = a if o == '-a': create_files = create_directories = write_slave = write_master = a try: [slave, master] = args except ValueError: print "usage: python", sys.argv[0] or "treesync.py", print "[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]", print "slavedir masterdir" return process(slave, master) def process(slave, master): cvsdir = os.path.join(master, "CVS") if not os.path.isdir(cvsdir): print "skipping master subdirectory", master print "-- not under CVS" return print "-"*40 print "slave ", slave print "master", master if not os.path.isdir(slave): if not okay("create slave directory %s?" % slave, answer=create_directories): print "skipping master subdirectory", master print "-- no corresponding slave", slave return print "creating slave directory", slave try: os.mkdir(slave) except os.error, msg: print "can't make slave directory", slave, ":", msg return else: print "made slave directory", slave cvsdir = None subdirs = [] names = os.listdir(master) for name in names: mastername = os.path.join(master, name) slavename = os.path.join(slave, name) if name == "CVS": cvsdir = mastername else: if os.path.isdir(mastername) and not os.path.islink(mastername): subdirs.append((slavename, mastername)) if cvsdir: entries = os.path.join(cvsdir, "Entries") for e in open(entries).readlines(): words = e.split('/') if words[0] == '' and words[1:]: name = words[1] s = os.path.join(slave, name) m = os.path.join(master, name) compare(s, m) for (s, m) in subdirs: process(s, m) def compare(slave, master): try: sf = open(slave, 'r') except IOError: sf = None try: mf = open(master, 'rb') except IOError: mf = None if not sf: if not mf: print "Neither master nor slave exists", master return print "Creating missing slave", slave copy(master, slave, answer=create_files) return if not mf: print "Not updating missing master", master return if sf and mf: if identical(sf, mf): return sft = mtime(sf) mft = mtime(mf) if mft > sft: # Master is newer -- copy master to slave sf.close() mf.close() print "Master ", master print "is newer than slave", slave copy(master, slave, answer=write_slave) return # Slave is newer -- copy slave to master print "Slave is", sft-mft, "seconds newer than master" # But first check what to do about CRLF mf.seek(0) fun = funnychars(mf) mf.close() sf.close() if fun: print "***UPDATING MASTER (BINARY COPY)***" copy(slave, master, "rb", answer=write_master) else: print "***UPDATING MASTER***" copy(slave, master, "r", answer=write_master) BUFSIZE = 16*1024 def identical(sf, mf): while 1: sd = sf.read(BUFSIZE) md = mf.read(BUFSIZE) if sd != md: return 0 if not sd: break return 1 def mtime(f): st = os.fstat(f.fileno()) return st[stat.ST_MTIME] def funnychars(f): while 1: buf = f.read(BUFSIZE) if not buf: break if '\r' in buf or '\0' in buf: return 1 return 0 def copy(src, dst, rmode="rb", wmode="wb", answer='ask'): print "copying", src print " to", dst if not okay("okay to copy? ", answer): return f = open(src, rmode) g = open(dst, wmode) while 1: buf = f.read(BUFSIZE) if not buf: break g.write(buf) f.close() g.close() def okay(prompt, answer='ask'): answer = answer.strip().lower() if not answer or answer[0] not in 'ny': answer = raw_input(prompt) answer = answer.strip().lower() if not answer: answer = default_answer if answer[:1] == 'y': return 1 if answer[:1] == 'n': return 0 print "Yes or No please -- try again:" return okay(prompt) if __name__ == '__main__': main() PK!h>11checkappend.pynuȯ#! /usr/bin/python2.7 # Released to the public domain, by Tim Peters, 28 February 2000. """checkappend.py -- search for multi-argument .append() calls. Usage: specify one or more file or directory paths: checkappend [-v] file_or_dir [file_or_dir] ... Each file_or_dir is checked for multi-argument .append() calls. When a directory, all .py files in the directory, and recursively in its subdirectories, are checked. Use -v for status msgs. Use -vv for more status msgs. In the absence of -v, the only output is pairs of the form filename(linenumber): line containing the suspicious append Note that this finds multi-argument append calls regardless of whether they're attached to list objects. If a module defines a class with an append method that takes more than one argument, calls to that method will be listed. Note that this will not find multi-argument list.append calls made via a bound method object. For example, this is not caught: somelist = [] push = somelist.append push(1, 2, 3) """ __version__ = 1, 0, 0 import os import sys import getopt import tokenize verbose = 0 def errprint(*args): msg = ' '.join(args) sys.stderr.write(msg) sys.stderr.write("\n") def main(): args = sys.argv[1:] global verbose try: opts, args = getopt.getopt(sys.argv[1:], "v") except getopt.error, msg: errprint(str(msg) + "\n\n" + __doc__) return for opt, optarg in opts: if opt == '-v': verbose = verbose + 1 if not args: errprint(__doc__) return for arg in args: check(arg) def check(file): if os.path.isdir(file) and not os.path.islink(file): if verbose: print "%r: listing directory" % (file,) names = os.listdir(file) for name in names: fullname = os.path.join(file, name) if ((os.path.isdir(fullname) and not os.path.islink(fullname)) or os.path.normcase(name[-3:]) == ".py"): check(fullname) return try: f = open(file) except IOError, msg: errprint("%r: I/O Error: %s" % (file, msg)) return if verbose > 1: print "checking %r ..." % (file,) ok = AppendChecker(file, f).run() if verbose and ok: print "%r: Clean bill of health." % (file,) [FIND_DOT, FIND_APPEND, FIND_LPAREN, FIND_COMMA, FIND_STMT] = range(5) class AppendChecker: def __init__(self, fname, file): self.fname = fname self.file = file self.state = FIND_DOT self.nerrors = 0 def run(self): try: tokenize.tokenize(self.file.readline, self.tokeneater) except tokenize.TokenError, msg: errprint("%r: Token Error: %s" % (self.fname, msg)) self.nerrors = self.nerrors + 1 return self.nerrors == 0 def tokeneater(self, type, token, start, end, line, NEWLINE=tokenize.NEWLINE, JUNK=(tokenize.COMMENT, tokenize.NL), OP=tokenize.OP, NAME=tokenize.NAME): state = self.state if type in JUNK: pass elif state is FIND_DOT: if type is OP and token == ".": state = FIND_APPEND elif state is FIND_APPEND: if type is NAME and token == "append": self.line = line self.lineno = start[0] state = FIND_LPAREN else: state = FIND_DOT elif state is FIND_LPAREN: if type is OP and token == "(": self.level = 1 state = FIND_COMMA else: state = FIND_DOT elif state is FIND_COMMA: if type is OP: if token in ("(", "{", "["): self.level = self.level + 1 elif token in (")", "}", "]"): self.level = self.level - 1 if self.level == 0: state = FIND_DOT elif token == "," and self.level == 1: self.nerrors = self.nerrors + 1 print "%s(%d):\n%s" % (self.fname, self.lineno, self.line) # don't gripe about this stmt again state = FIND_STMT elif state is FIND_STMT: if type is NEWLINE: state = FIND_DOT else: raise SystemError("unknown internal state '%r'" % (state,)) self.state = state if __name__ == '__main__': main() PK!dvparseentities.pynuȯ#! /usr/bin/python2.7 """ Utility for parsing HTML entity definitions available from: http://www.w3.org/ as e.g. http://www.w3.org/TR/REC-html40/HTMLlat1.ent Input is read from stdin, output is written to stdout in form of a Python snippet defining a dictionary "entitydefs" mapping literal entity name to character or numeric entity. Marc-Andre Lemburg, mal@lemburg.com, 1999. Use as you like. NO WARRANTIES. """ import re,sys import TextTools entityRE = re.compile('') def parse(text,pos=0,endpos=None): pos = 0 if endpos is None: endpos = len(text) d = {} while 1: m = entityRE.search(text,pos,endpos) if not m: break name,charcode,comment = m.groups() d[name] = charcode,comment pos = m.end() return d def writefile(f,defs): f.write("entitydefs = {\n") items = defs.items() items.sort() for name,(charcode,comment) in items: if charcode[:2] == '&#': code = int(charcode[2:-1]) if code < 256: charcode = "'\%o'" % code else: charcode = repr(charcode) else: charcode = repr(charcode) comment = TextTools.collapse(comment) f.write(" '%s':\t%s, \t# %s\n" % (name,charcode,comment)) f.write('\n}\n') if __name__ == '__main__': if len(sys.argv) > 1: infile = open(sys.argv[1]) else: infile = sys.stdin if len(sys.argv) > 2: outfile = open(sys.argv[2],'w') else: outfile = sys.stdout text = infile.read() defs = parse(text) writefile(outfile,defs) PK! Treindent-rst.pyonu[ fc@sJddlZddlZejdZedkrFejendS(iNcCstj|ddS(Ni(t patchchecktnormalize_docs_whitespace(targv((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pytmain st__main__(tsysRRRt__name__texit(((s2/usr/lib64/python2.7/Tools/scripts/reindent-rst.pyts   PK!H9 checkpip.pycnu[ fc@sYdZddlZddlZddlZddlZdZedkrUendS(sa Checks that the version of the projects bundled in ensurepip are the latest versions available. iNcCst}x~tjD]s\}}tjtjdj|jj d}|dd}||krt }dj|||GHqqW|rt j dndS(Ns$https://pypi.python.org/pypi/{}/jsontutf8tinfotversions<The latest version of {} on PyPI is {}, but ensurepip has {}i( tFalset ensurepipt _PROJECTStjsontloadsturllib2turlopentformattreadtdecodetTruetsystexit(t outofdatetprojectRtdatatupstream_version((s./usr/lib64/python2.7/Tools/scripts/checkpip.pytmain s   t__main__(t__doc__RRRRRt__name__(((s./usr/lib64/python2.7/Tools/scripts/checkpip.pyts      PK!S; findnocoding.pyonu[ fc@sdZdZddlZddlZddlZddlZyddlZWn:ek rdddYZeZejdIJnXej dZ ej dZ d Z d Z d Zd ejd Zy#ejejdd\ZZWn=ejk r5ZejeIJejeIJejdnXejZeZxAeD]9\ZZedkrpejZqLedkrLeZqLqLWesejeIJejdnxFejeeD]2ZerdeGHneeZ e reGHqqWdS(s_List all those Python files that require a coding directive Usage: nocoding.py dir1 [dir2...] sOleg Broytmann, Georg BrandliNtpysourcecBseZdZZZdZRS(c osx|D]}tjj|r0|jdVqtjj|rxZtj|D]F\}}}x4|D],}|jdrhtjj||VqhqhWqRWqqWdS(Ns.py(tostpathtisfiletendswithtisdirtwalktjoin( tselftpathstargstkwargsRtroottdirstfilestfilename((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytwalk_python_filess  N(t__name__t __module__tNonethas_python_exttlooks_like_pythontcan_be_compiledR(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pyRss^The pysource module is not available; no sophisticated Python source file search will be done.s&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCs&tj|}|r"|jdSdS(Nit(tdecl_retmatchtgroup(tlineR((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytget_declaration&s cCs.yt||Wntk r%tSXtSdS(N(tunicodetUnicodeDecodeErrortFalsetTrue(ttexttcodec((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pythas_correct_encoding,s  cCsyt|d}Wntk r'dSX|j}|j}t|sgtj|rut|ru|jtS|j }|jt |||drtSt S(NtrUtascii( topentIOErrorRtreadlineRtblank_reRtcloseRtreadR#R (tfullpathtinfiletline1tline2trest((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytneeds_declaration4s       sjUsage: %s [-cd] paths... -c: recognize Python source files trying to compile them -d: debug outputiitcds-cs-dsTesting for coding: %s((!t__doc__t __author__tsysRtretgetoptRt ImportErrortstderrtcompileRR)RR#R1targvtusagetoptsR terrortmsgtexitRt is_pythonRtdebugtotaRR RR,tresult(((s2/usr/lib64/python2.7/Tools/scripts/findnocoding.pytsH0     #          PK!w/=L fixnotice.pyonu[ fc@szdZdaddlZddlZddlZdadadaddZdZ dZ e d krve ndS( s(Ostensibly) fix copyright notices in files. Actually, this script will simply replace a block of text in a file from one string to another. It will only do this once though, i.e. not globally throughout the file. It writes a backup file and then does an os.rename() dance for atomicity. Usage: fixnotices.py [options] [filenames] Options: -h / --help Print this message and exit --oldnotice=file Use the notice in the file as the old (to be replaced) string, instead of the hard coded value in the script. --newnotice=file Use the notice in the file as the new (replacement) string, instead of the hard coded value in the script. --dry-run Don't actually make the changes, but print out the list of files that would change. When used with -v, a status will be printed for every file. -v / --verbose Print a message for every file looked at, indicating whether the file is changed or not. s/*********************************************************** Copyright (c) 2000, BeOpen.com. Copyright (c) 1995-2000, Corporation for National Research Initiatives. Copyright (c) 1990-1995, Stichting Mathematisch Centrum. All rights reserved. See the file "Misc/COPYRIGHT" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. ******************************************************************/ iNticCs+ttGH|r|GHntj|dS(N(t__doc__tglobalstsystexit(tcodetmsg((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytusage4s cCs6y5tjtjdddddddg\}}Wn#tjk rZ}td|nXx|D]\}}|dkrtd qb|dkrdaqb|d krdaqb|dkrt|}|ja |j qb|dkrbt|}|ja |j qbqbWx|D]}t |qWdS(Nithvthelps oldnotice=s newnotice=sdry-runtverboses-hs--helpis-vs --verboses --dry-runs --oldnotices --newnotice(s-hs--help(s-vs --verbose( tgetoptRtargvterrorRtVERBOSEtDRYRUNtopentreadt OLD_NOTICEtcloset NEW_NOTICEtprocess(toptstargsRtopttargtfp((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytmain;s.               cCst|}|j}|j|jt}|dkrStrOdG|GHndSts_trkdG|GHntrudS|| t||tt}|d}|d}t|d}|j ||jt j ||t j ||dS(Nis no change:s change:s.news.baktw( RRRtfindRRRRtlentwritetostrename(tfiletftdatatitnewtbackup((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyRXs(            t__main__( RRR RR RRRRRRt__name__(((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyts        PK!%d objgraph.pynuȯ#! /usr/bin/python2.7 # objgraph # # Read "nm -o" input (on IRIX: "nm -Bo") of a set of libraries or modules # and print various interesting listings, such as: # # - which names are used but not defined in the set (and used where), # - which names are defined in the set (and where), # - which modules use which other modules, # - which modules are used by which other modules. # # Usage: objgraph [-cdu] [file] ... # -c: print callers per objectfile # -d: print callees per objectfile # -u: print usage of undefined symbols # If none of -cdu is specified, all are assumed. # Use "nm -o" to generate the input (on IRIX: "nm -Bo"), # e.g.: nm -o /lib/libc.a | objgraph import sys import os import getopt import re # Types of symbols. # definitions = 'TRGDSBAEC' externals = 'UV' ignore = 'Nntrgdsbavuc' # Regular expression to parse "nm -o" output. # matcher = re.compile('(.*):\t?........ (.) (.*)$') # Store "item" in "dict" under "key". # The dictionary maps keys to lists of items. # If there is no list for the key yet, it is created. # def store(dict, key, item): if dict.has_key(key): dict[key].append(item) else: dict[key] = [item] # Return a flattened version of a list of strings: the concatenation # of its elements with intervening spaces. # def flat(list): s = '' for item in list: s = s + ' ' + item return s[1:] # Global variables mapping defined/undefined names to files and back. # file2undef = {} def2file = {} file2def = {} undef2file = {} # Read one input file and merge the data into the tables. # Argument is an open file. # def readinput(fp): while 1: s = fp.readline() if not s: break # If you get any output from this line, # it is probably caused by an unexpected input line: if matcher.search(s) < 0: s; continue # Shouldn't happen (ra, rb), (r1a, r1b), (r2a, r2b), (r3a, r3b) = matcher.regs[:4] fn, name, type = s[r1a:r1b], s[r3a:r3b], s[r2a:r2b] if type in definitions: store(def2file, name, fn) store(file2def, fn, name) elif type in externals: store(file2undef, fn, name) store(undef2file, name, fn) elif not type in ignore: print fn + ':' + name + ': unknown type ' + type # Print all names that were undefined in some module and where they are # defined. # def printcallee(): flist = file2undef.keys() flist.sort() for filename in flist: print filename + ':' elist = file2undef[filename] elist.sort() for ext in elist: if len(ext) >= 8: tabs = '\t' else: tabs = '\t\t' if not def2file.has_key(ext): print '\t' + ext + tabs + ' *undefined' else: print '\t' + ext + tabs + flat(def2file[ext]) # Print for each module the names of the other modules that use it. # def printcaller(): files = file2def.keys() files.sort() for filename in files: callers = [] for label in file2def[filename]: if undef2file.has_key(label): callers = callers + undef2file[label] if callers: callers.sort() print filename + ':' lastfn = '' for fn in callers: if fn <> lastfn: print '\t' + fn lastfn = fn else: print filename + ': unused' # Print undefined names and where they are used. # def printundef(): undefs = {} for filename in file2undef.keys(): for ext in file2undef[filename]: if not def2file.has_key(ext): store(undefs, ext, filename) elist = undefs.keys() elist.sort() for ext in elist: print ext + ':' flist = undefs[ext] flist.sort() for filename in flist: print '\t' + filename # Print warning messages about names defined in more than one file. # def warndups(): savestdout = sys.stdout sys.stdout = sys.stderr names = def2file.keys() names.sort() for name in names: if len(def2file[name]) > 1: print 'warning:', name, 'multiply defined:', print flat(def2file[name]) sys.stdout = savestdout # Main program # def main(): try: optlist, args = getopt.getopt(sys.argv[1:], 'cdu') except getopt.error: sys.stdout = sys.stderr print 'Usage:', os.path.basename(sys.argv[0]), print '[-cdu] [file] ...' print '-c: print callers per objectfile' print '-d: print callees per objectfile' print '-u: print usage of undefined symbols' print 'If none of -cdu is specified, all are assumed.' print 'Use "nm -o" to generate the input (on IRIX: "nm -Bo"),' print 'e.g.: nm -o /lib/libc.a | objgraph' return 1 optu = optc = optd = 0 for opt, void in optlist: if opt == '-u': optu = 1 elif opt == '-c': optc = 1 elif opt == '-d': optd = 1 if optu == optc == optd == 0: optu = optc = optd = 1 if not args: args = ['-'] for filename in args: if filename == '-': readinput(sys.stdin) else: readinput(open(filename, 'r')) # warndups() # more = (optu + optc + optd > 1) if optd: if more: print '---------------All callees------------------' printcallee() if optu: if more: print '---------------Undefined callees------------' printundef() if optc: if more: print '---------------All Callers------------------' printcaller() return 0 # Call the main program. # Use its return value as exit status. # Catch interrupts to avoid stack trace. # if __name__ == '__main__': try: sys.exit(main()) except KeyboardInterrupt: sys.exit(1) PK!͗[ pickle2db.pyonu[ fc@sBdZddlZyddlZWnek r;dZnXyddlZWnek redZnXyddlZWnek rdZnXyddlZWnek rdZnXddlZyddl Z Wnek rddl Z nXej dZ dZ dZedkr>ejeej dndS(s, Synopsis: %(prog)s [-h|-b|-g|-r|-a|-d] [ picklefile ] dbfile Read the given picklefile as a series of key/value pairs and write to a new database. If the database already exists, any contents are deleted. The optional flags indicate the type of the output database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for read access. If no pickle file is named, the pickle input is read from standard input. Note that recno databases can only contain integer keys, so you can't dump a hash or btree database using db2pickle.py and reconstitute it to a recno database with %(prog)s unless your keys are integers. iNicCstjjttdS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/pickle2db.pytusage4sc Csy1tj|dddddddg\}}Wntjk rOtdSXt|d kstt|d krtdSt|dkrtj}|d }nNyt|d d }Wn*tk rtjj d |d dSX|d}d}x|D]\}}|d"krOy t j }Wqt k rKtjj ddSXq|d#kry t j}Wqt k rtjj ddSXq|d$kry t j}Wqt k rtjj ddSXq|d%kry tj}Wqt k rtjj ddSXq|d&krSy tj}Wqt k rOtjj ddSXq|d'kry tj}Wqt k rtjj ddSXqqW|dkrt dkrtjj dtjj ddSt j }ny||d}Wn9t jk r.tjj d |tjj d!dSXx|jD] }||=q<Wx<ytj|\} } Wntk r}PnX| || s6              [ PK! lll.pycnu[ fc@sNddlZddlZdZdZedkrJeejdndS(iNcCsyxrtj|D]a}|tjtjfkrtjj||}tjj|rq|GdGtj|GHqqqqWdS(Ns->(tostlistdirtcurdirtpardirtpathtjointislinktreadlink(tdirnametnametfull((s)/usr/lib64/python2.7/Tools/scripts/lll.pytlll s cCsh|stjg}nd}xF|D]>}t|dkrV|sDHnd}|dGHnt|q"WdS(Niit:(RRtlenR (targstfirsttarg((s)/usr/lib64/python2.7/Tools/scripts/lll.pytmains  t__main__i(tsysRR Rt__name__targv(((s)/usr/lib64/python2.7/Tools/scripts/lll.pyts  PK!hxmmanalyze_dxp.pynuȯ#! /usr/bin/python2.7 """ Some helper functions to analyze the output of sys.getdxp() (which is only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE). These will tell you which opcodes have been executed most frequently in the current process, and, if Python was also built with -DDXPAIRS, will tell you which instruction _pairs_ were executed most frequently, which may help in choosing new instructions. If Python was built without -DDYNAMIC_EXECUTION_PROFILE, importing this module will raise a RuntimeError. If you're running a script you want to profile, a simple way to get the common pairs is: $ PYTHONPATH=$PYTHONPATH:/Tools/scripts \ ./python -i -O the_script.py --args ... > from analyze_dxp import * > s = render_common_pairs() > open('/tmp/some_file', 'w').write(s) """ import copy import opcode import operator import sys import threading if not hasattr(sys, "getdxp"): raise RuntimeError("Can't import analyze_dxp: Python built without" " -DDYNAMIC_EXECUTION_PROFILE.") _profile_lock = threading.RLock() _cumulative_profile = sys.getdxp() # If Python was built with -DDXPAIRS, sys.getdxp() returns a list of # lists of ints. Otherwise it returns just a list of ints. def has_pairs(profile): """Returns True if the Python that produced the argument profile was built with -DDXPAIRS.""" return len(profile) > 0 and isinstance(profile[0], list) def reset_profile(): """Forgets any execution profile that has been gathered so far.""" with _profile_lock: sys.getdxp() # Resets the internal profile global _cumulative_profile _cumulative_profile = sys.getdxp() # 0s out our copy. def merge_profile(): """Reads sys.getdxp() and merges it into this module's cached copy. We need this because sys.getdxp() 0s itself every time it's called.""" with _profile_lock: new_profile = sys.getdxp() if has_pairs(new_profile): for first_inst in range(len(_cumulative_profile)): for second_inst in range(len(_cumulative_profile[first_inst])): _cumulative_profile[first_inst][second_inst] += ( new_profile[first_inst][second_inst]) else: for inst in range(len(_cumulative_profile)): _cumulative_profile[inst] += new_profile[inst] def snapshot_profile(): """Returns the cumulative execution profile until this call.""" with _profile_lock: merge_profile() return copy.deepcopy(_cumulative_profile) def common_instructions(profile): """Returns the most common opcodes in order of descending frequency. The result is a list of tuples of the form (opcode, opname, # of occurrences) """ if has_pairs(profile) and profile: inst_list = profile[-1] else: inst_list = profile result = [(op, opcode.opname[op], count) for op, count in enumerate(inst_list) if count > 0] result.sort(key=operator.itemgetter(2), reverse=True) return result def common_pairs(profile): """Returns the most common opcode pairs in order of descending frequency. The result is a list of tuples of the form ((1st opcode, 2nd opcode), (1st opname, 2nd opname), # of occurrences of the pair) """ if not has_pairs(profile): return [] result = [((op1, op2), (opcode.opname[op1], opcode.opname[op2]), count) # Drop the row of single-op profiles with [:-1] for op1, op1profile in enumerate(profile[:-1]) for op2, count in enumerate(op1profile) if count > 0] result.sort(key=operator.itemgetter(2), reverse=True) return result def render_common_pairs(profile=None): """Renders the most common opcode pairs to a string in order of descending frequency. The result is a series of lines of the form: # of occurrences: ('1st opname', '2nd opname') """ if profile is None: profile = snapshot_profile() def seq(): for _, ops, count in common_pairs(profile): yield "%s: %s\n" % (count, ops) return ''.join(seq()) PK!!=e ndiff.pycnu[ fc@sdZdZddlZddlZdZdZdZd Zd Ze d krej dZ d e krddl Z ddl Z e jd d Ze jdee jeZejjdjqee ndS(sndiff [-q] file1 file2 or ndiff (-r1 | -r2) < ndiff_output > file1_or_file2 Print a human-friendly file difference report to stdout. Both inter- and intra-line differences are noted. In the second form, recreate file1 (-r1) or file2 (-r2) on stdout, from an ndiff report on stdin. In the first form, if -q ("quiet") is not specified, the first two lines of output are -: file1 +: file2 Each remaining line begins with a two-letter code: "- " line unique to file1 "+ " line unique to file2 " " line common to both files "? " line not present in either input file Lines beginning with "? " attempt to guide the eye to intraline differences, and were not present in either input file. These lines can be confusing if the source files contain tab characters. The first file can be recovered by retaining only lines that begin with " " or "- ", and deleting those 2-character prefixes; use ndiff with -r1. The second file can be recovered similarly, but by retaining only " " and "+ " lines; use ndiff with -r2; or, on Unix, the second file can be recovered by piping the output through sed -n '/^[+ ] /s/^..//p' iiiiNcCs(tjj}||d|tdS(Ns i(tsyststderrtwritet__doc__(tmsgtout((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfail5s  cCsDyt|dSWn,tk r?}td|dt|SXdS(NtUscouldn't open s: (topentIOErrorRtstr(tfnametdetail((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfopen=scCs{t|}t|}| s&| r*dS|j}|j|j}|jxtj||D] }|GqiWdS(Nii(R t readlinestclosetdifflibtndiff(tf1nametf2nametf1tf2tatbtline((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfcompareDs    c CsKddl}y|j|d\}}Wn#|jk rM}tt|SXd}d}}xJ|D]B\}}|dkrd}d}qe|dkred}|} qeqeW|r|rtdS|r|rtdS| dkrt| dStd St|d krtd S|\} } |r>dG| GHdG| GHnt| | S(Nisqr:iis-qs-rscan't specify both -q and -rsno args allowed with -r optiont1t2s-r value must be 1 or 2isneed 2 filename argss-:s+:(RR(tgetoptterrorRR trestoretlenR( targsRtoptsR tnoisytqseentrseentopttvalt whichfileRR((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytmainTs<                cCs/tjtjj|}tjj|dS(N(RRRtstdinRtstdoutt writelines(twhichtrestored((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyRwst__main__s-profiles ndiff.pros main(args)ttime(iii(Rt __version__RRRR RR(Rt__name__targvR tprofiletpstatstremovetstatftruntStatststatst strip_dirst sort_statst print_stats(((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyt/s"    #     PK!// untabify.pycnu[ fc@sYdZddlZddlZddlZdZedZedkrUendS(sJReplace tabs with spaces in argument files. Print names of changed files.iNcCsd}y8tjtjdd\}}|s=tjdnWn0tjk rp}|GHdGtjdGdGHdSXx/|D]'\}}|dkrxt|}qxqxWx|D]}t||qWdS( Niist:s#At least one file argument requiredsusage:is[-t tabwidth] file ...s-t(tgetopttsystargvterrortinttprocess(ttabsizetoptstargstmsgtoptnametoptvaluetfilename((s./usr/lib64/python2.7/Tools/scripts/untabify.pytmain s  cCsy&t|}|j}|jWn#tk rK}d||fGHdSX|j|}||krkdS|d}ytj|Wntjk rnXytj||Wntjk rnXt|d}|j |WdQX|r|GHndS(Ns%r: I/O error: %st~tw( topentreadtclosetIOErrort expandtabstostunlinkRtrenametwrite(R RtverbosetfttextR tnewtexttbackup((s./usr/lib64/python2.7/Tools/scripts/untabify.pyRs.    t__main__(t__doc__RRRR tTrueRt__name__(((s./usr/lib64/python2.7/Tools/scripts/untabify.pyts      PK!3R== serve.pycnu[ fc@sdZddlZddlZddlZddlmZmZdZedkrej dZ e ej dkre ej dndZ ejd e eZd e e fGHyejWqek rd GHqXndS( s  Small wsgiref based web server. Takes a path to serve from and an optional port number (defaults to 8000), then tries to serve files. Mime types are guessed from the file names, 404 errors are raised if the file is not found. Used for the make serve target in Doc. iN(t simple_servertutilcCstjjt|dd}d|jtjjdkrTtjj|d}ntj|d}tjj|r|dd|fgtj t |S|d d gd gSdS( Nt PATH_INFOit.is index.htmlis200 OKs Content-Types 404 Not Founds text/plains not found(s Content-Types text/plain( tostpathtjointsplittsept mimetypest guess_typetexistsRt FileWrappertopen(tenvirontrespondtfnttype((s+/usr/lib64/python2.7/Tools/scripts/serve.pytapp st__main__iii@ts(Serving %s on port %s, control-C to stopsShutting down.(t__doc__tsysRR twsgirefRRRt__name__targvRtlentinttportt make_serverthttpdt serve_forevertKeyboardInterrupt(((s+/usr/lib64/python2.7/Tools/scripts/serve.pyts      . PK!)ML{E{E texi2html.pycnu[ fc@sbddlZddlZddlZddlZdZejdZejdZejdZejdZ ejdZ dfd YZ d e fd YZ d fd YZ de fdYZdfdYZdZdZejdZdZdZejejdZdZdZdZedkr^endS(iNs\input texinfos^@([a-z]+)([ ]|$)s^[ ]*$s@[a-z]+s [ @{}&<>]s.^\* ([^:]*):(:|[ ]*([^ , .]+)([^ ]*))[ ]*tHTMLNodecBsteZdZdZdZdZdZdZdZdZ d d dZ d Z d Z d Zd ZRS(sSome of the parser's functionality is separated into this class. A Node accumulates its contents, takes care of links to other Nodes and saves itself when it is finished and all links are resolved. s2its cCs^||_||_|r$||_n ||_||_||_||_||_g|_dS(N(tdirnametnamettopnamettitletnexttprevtuptlines(tselftdirRRRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt__init__gs        cGst|jj|dS(N(tmapR tappend(R R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytwritetscCsat|jdt|jd}|j|j|j|j|j|j|jdS(Nt/tw( topenRtmakefileRRtprologuettexttepiloguetclose(R tfp((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytflushws #c Cs|r|jdkr'd}d}nt|}d|}|j|d|d|r_d|pbd|rrd|pud|d |d ndS( Ns(dir)s ../dir.htmlRs TITLE="%s"s : s (tlowerRR(R tlabeltnodenametreltrevtaddrR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytlink~s   cCst|j}dj|j|_g|_|j|j|jdj|j}g|_|jd|jdt |j d|j dt |j d|j dt |j d|j d||_ |dkrd ||_ndS( NRsF s ��� is

    %s (tlenR tjoinRt open_linkst output_linkst close_linkstDOCTYPERRRRRRR(R tlengthtlinks((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytfinalizes     i  cCs|jddS(Ns


    (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR%scCs|jddS(Ns
    (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'scCs|j|jkr(|jd|jn|jd|jdd|jd|jdd|jd|jdd|j|jkr|jd |jndS( Ns Conts NextRtNexts PrevtPreviouss UptUps Top(tcontRR"RRRR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&sN(t__name__t __module__t__doc__R(ttypeR/RR RRtNoneR"R+R%R'R&(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZs     t HTML3NodecBs eZdZdZdZRS(s;cCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR's(R0R1R(R%R'(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR5s t TexinfoParsercBs eZdZdZdedZdedZdZeZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d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st numberingtnofilltvaluest stackinfot footnotestitemargt itemnumbert itemindextnodet nodestackR/t includedepth(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s:                           cCs ||_dS(N(RB(R RB((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt sethtmlhelpscCs ||_dS(N(R(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt setdirnamescCs ||_dS(N(RC(R RC((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt setincludedirscCs|j}d}x?|rS|ddks:tj|rS|j}|d}qW|tt tkr}tdtfn|j||dS(Niit%sfile does not begin with %r(treadlinetblprogtmatchR#tMAGICt SyntaxErrort parserest(R Rtlinetlineno((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytparses ( c Cs<|}d|_d|_g|_g}x|js|j}|jd|_|s|r}|jst|j|ng}n|dkrdGHnPn|d}tj|}|r-|jd\}}|||!} | dkr|j |q|r|js|j|ng}n|j ||q*t j|rd|jkrd|jkr|r|js|j||j r|j dn |j d g}qqq*|j |q*W|jrd GHn|jrd GHd G|jGHn|jdkr8x<|jr4|jd j|jd j|jd =qWndS(Niis*** EOF before @byetnoindenttrefilltformattexamples s

    s*** Still skipping at the ends*** Stack not empty at the ends***i(R^R_(tdonetskiptstackRUR?tprocesstcmprogRWtspanRtcommandRVRGRRPROR+R( R Rtinitial_linenoR\taccuR[tmotatbtcmd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZsb                    cCs2|jdkr%|jj|jnd|_dS(NR(R@R4RAR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt startsaving@scCsN|j}t|jdkr;|jd|_|jd=n d|_|pMdS(NiiR(R@R#RAR4(R R@((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytcollectsavingsGs    cGsydj|}Wn|GHtnX|jdkrJ|j||_n8|jrf|jj|n|jr|jj|ndS(NR(R$t TypeErrorR@R4R>RRN(R targsR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRQs   cCs|jdkr#dGH|j}n|jr9|jn|jr|jdkr|jd|jd \}}}}|j d||j d||j d||j |j kr|j d|j n|jdn|jd |jj d|_n|j r|j rf|j j sI|j jrf|j jrf|j jrf|j j|j jn|jj|j d|_ nd |_ dS( Ns$*** Still saving text at end of nodeis


    iR,tPrevR.tTops R(R@R4RpRJtwritefootnotesR>R?Rt nodelinksR"RRRRNR/R3RRRR+RROR(R tdummyRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytendnode_s6          $  c Cs|jdkrdd|jGdG|jG|jG|rA|dd Gn|ddsY|dr`dGnHn|jrxa|D]:}tj|}|s|jd}|j|qwn|jd\}}|jd\}}|jd\}} |jd \} } |jd \} } |||!}||| !}|dd krQ|}n || | !}|| | !}|j d t |d |d|d|j j ||j||qwWndj |}|j|dS(Nit!sprocess:iis...s iiit:s
  • sR(R<RcRdtinmenutmiprogRWtstriptexpandRgRRRBtmenuitemR$(R RjR[RktbgntendRlRmtctdtetftgthRRtpunctR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyResB           cCss|j}xS|r^|ddkr^y|jt|r<dSWntk rPnX|d }q W|or|ddkS(Nitifsettifclearitmenu(RR(RdRIR#tKeyError(R Rd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR{s  c Cs'g}d}t|}x||kr|}tj||}|rT|j}n|j||P|j|||!||}|d}|dkr|jdqn|dkr|jdqn|dkr|jdqn|dkr |jd qn|d kr)|jd qn|d kr|sSd GH|jd qn|d}|d=yt|d|} Wn!tk r|j|qnX| qn|dkrt d|n|}x-||kr||t j kr|d}qW||krC|d}|||!}|dkr0q|j|qn|||!}||kr||d kr|d}|j|yt|d|} Wn!tk r|j |qnX| qnyt|d|} Wn!tk r|j |qnX| qW|r#dG|GHndS(Niis t fileiis<-- file(tostpathR$RCRtIOErrortreprR<RbRcRdRPRZR(R RrtfileRtmsgt save_donet save_skipt save_stack((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_include(s&       cCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dmn?RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_dmn@RcCs|jddS(Ns...(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_dotsBRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_dotsCRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_bulletERcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_bulletFRcCs|jddS(NtTeX(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_TeXHRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_TeXIRcCs|j|jdS(N(RtCOPYRIGHT_SYMBOL(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_copyrightKRcCs|j|jdS(N(RR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_copyrightLRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_copyrightMRcCs|jddS(Nt-(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_minusORcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_minusPRcCs|jddS(Ns¡(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_exclamdownvRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_exclamdownwRcCs|jddS(Ns¿(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_questiondownxRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_questiondownyRcCs|jddS(Nså(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_aazRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aa{RcCs|jddS(NsÅ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AA|RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AA}RcCs|jddS(Nsæ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ae~RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aeRcCs|jddS(NsÆ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AERcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AERcCs|jddS(Nsø(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_oRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_oRcCs|jddS(NsØ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ORcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_ORcCs|jddS(Nsß(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ssRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_ssRcCs|jddS(Ntoe(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_oeRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_oeRcCs|jddS(NtOE(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_OERcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_OERcCs|jddS(Nsl/(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_lRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_lRcCs|jddS(NsL/(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_LRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_LRcCs|jddS(Ns=>(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_resultRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_resultRcCs|jddS(Ns==>(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_expansionRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_expansionRcCs|jddS(Ns-|(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_printRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_printRcCs|jddS(Ns error-->(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_errorRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_errorRcCs|jddS(Ns==(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_equivRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_equivRcCs|jddS(Ns-!-(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_pointRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_pointRcCs|jd|jdS(Nssee (RRo(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_pxrefs cCs|jdS(N(tmakeref(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_pxrefscCs|jd|jdS(NsSee (RRo(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_xrefs cCs|jdS(N(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_xrefscCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_refscCs|jdS(N(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_refscCs|jd|jdS(NsSee info file (RRo(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_inforefs cCs|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}|d}|jd|d|ddS( Nt,iRiit`s ', node `s'(RptsplitR}R#RR(R RtsRrRNR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_inforefs (  c Cs|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}}|dr|d}n|d}|d}t|}|rd|d |}n|jd |d |d dS( NRiRiiiis../Rs s(RpRR}R#RRR( R RRRrRRRRthref((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs (    cCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_urefscCs|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}|d}|s}|}n|jd|d|ddS( NRiRiis s(RpRR}R#RR(R RRRrRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_urefs (   cCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_imagescCs|jdS(N(t makeimage(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_imagesc Cs~|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}|d}|d}|d}|d}|jd |} tjj| d r|d 7}nOtjj| d r|d 7}n,tjj| d r|d 7}n d | GH|j d|d|r2d|dp5d|rId|dpLd|r`d|dpcdd|j j | dS(NRiRiiiiiRs.pngs.jpgs.gifs*** Cannot find image s ( RpRR}R#RRRRtexistsRRBtaddimage( R RRRrtfilenametwidththeighttalttextt imagelocation((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs. (         cCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_citeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_citeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_codeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_codeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_tRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_tRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dfnRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_dfnRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_emphRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_emph RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_i"RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_i#RcCsBt|jd}|j|jit|d6|jdS(Nitid(R#RJRtFN_SOURCE_PATTERNRRo(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_footnote%s!cCs3t|jd}|jj||jfdS(Ni(R#RJRRp(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_footnote,scCs_|j|jx?|jD]4\}}|j|jit|d6|d6qWg|_dS(NRR(Rt FN_HEADERRJtFN_TARGET_PATTERNR(R RR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRu0s   cCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_file7RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_file8RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_kbd:RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_kbd;RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_key=RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_key>RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_r@RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_rARcCs|jddS(Ns`(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_sampCRcCs|jddS(Ns'(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_sampDRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_scFRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_scGRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_strongIRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_strongJRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_bLRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_bMRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_varORcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_varPRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_wRRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_wSRcCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_urlURcCs)|j}|jd|d|ddS(Ns s(RpR(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_urlVs cCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_emailZRcCs)|j}|jd|d|ddS(Nss(RpR(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_email[s cCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_smallbRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_smallcRcCs#|jd\}}|||!}||j}|jdkrnd|jGdG|jG|jGd|G|GHnyt|d|}Wnttk ryt|d|}Wn.tk r|js|j||ndSX|jj|||dSX|j s|dkr||ndS(NiRyscommand:Rtdo_tbgn_R( RgR}R<RcRdRRt unknown_cmdR(R R[RkRlRmRnRrtfunc((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRhes(     cCsOdGd|G|GH|jj|s3d|j|s
  • (RR~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_centers  c Cs|jd|_g|jdD]}|j^q#}x#t|dkr`|jdq>W||_|d \}}}}|jdt|}|j j |rdG|GHn |j rd|j GdG|GHnd |j |<||_ |j r|jr|j |jd _ n|js(||_n|} |jrK| d |j} n|j|j|j |j| ||||_|jj|j ||||dS( NiRiRRs*** Filename already in use: Rys --- writingiis -- (RxR?RR}R#RRvRRR;RR<RR/RORRtNodeRNRBtaddnode( R RrRtpartsRRRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_nodes0  (       c CsV|rR|jdkr!d}n t|}|j|d|d|d|dndS(Ns(dir)s ../dir.htmls : s (RRR(R RRR!((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR".s   cCs7|jr3||j_x|jr/|jdj|krf|jdj|jdj|jd=q|jdj|kr|jdjs|jj|jd_n|jjs|jdj|j_n|jdj|jdj|jd=q|dkr+|jj r+|jdj|j_nPqWndS(Nii( RNR3ROR+RRRRR(R R3((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytpopstack9s$      cCs$|jd|d|jddS(NtH1ii(theadingRZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_chapterNscCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_unnumberedRscCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_appendixUscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_topXscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_chapheadingZscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_majorheading\scCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_section_scCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedseccscCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsecfscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_headingjscCs$|jd|d|jddS(NtH2ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_subsectionmscCs$|jd|d|jddS(NRgii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsecpscCs$|jd|d|jddS(NRgii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsecsscCs|jd|ddS(NRgi(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_subheadingvscCs$|jd|d|jddS(NtH3ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubsectionyscCs$|jd|d|jddS(NRlii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsubsec|scCs$|jd|d|jddS(NRlii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsubsecscCs|jd|ddS(NRli(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubheadingscCs|dkrx)t|j|kr7|jjdqW|j|d3|j|d|j| s---( R#RFRRRERRR~R<R=(R R3RrtleveltxR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR\s  cCs|jdddS(NsTable of Contentsi(t listcontents(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_contentsscCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_shortcontentsscCs!|jd|ddg}x|jD]\}}}||krGq&n||dkr|jd|dd|j|nI||dkrx6||dkr|d=|jd|ddqWn|jd|dt|d |j||jd q&W|jdt|dS( Ns

    s

      iis s
        s
      s
    • s (RRERRR~R#(R Rtmaxlevelt prevlevelsRqRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRss$   cCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_pageRcCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_needRcCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_groupRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_groupRcCs*|jr|jdn |jddS(Ns s

      (RGR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_sps cCs|jddS(Ns


      (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_hlinescCs|jd|j|dS(Ns
      (Rt do_deffnx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deffns cCs|jddS(Ns
      (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_deffnscCs|jdt|d}|d |d\}}}|jd|x%|D]}|jdt|qOW|jd|jd|dS(Ns
      is@b{%s}RBs
      tfn(Rt splitwordsR~tmakevartindex(R RrR7tcategoryRtresttword((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR~s   cCs|jd|dS(Ns Function (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defunRcCs|jd|dS(Ns Function (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defunxRcCs|jd|dS(NsMacro (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defmacRcCs|jd|dS(NsMacro (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defmacxRcCs|jd|dS(Ns{Special Form} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defspecRcCs|jd|dS(Ns{Special Form} (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defspecxRcCs|jd|j|dS(Ns
      (Rt do_defvrx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defvrs cCs|jdt|d}|d |d\}}}|jd|x|D]}|jd|qOW|jd|jd|dS(Ns
      is @code{%s}RBs
      tvr(RRR~R(R RrR7RRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs   cCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defvarRcCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defvarxRcCs|jd|dS(Ns{User Option} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defoptRcCs|jd|dS(Ns{User Option} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defoptxRcCs|jd|j|dS(Ns
      (Rt do_deftypefnx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deftypefns cCs|jdt|d}|d |d\}}}}|jd||fx%|D]}|jdt|qXW|jd|jd|dS(Ns
      is@code{%s} @b{%s}RBs
      R(RRR~RR(R RrR7RtdatatypeRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s   cCs|jd|dS(Ns Function (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypefunRcCs|jd|dS(Ns Function (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypefunxRcCs|jd|j|dS(Ns
      (Rt do_deftypevrx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deftypevrs cCs|jdt|d}|d |d\}}}}|jd||fx|D]}|jd|qXW|jd|jd|dS(Ns
      is@code{%s} @b{%s}RBs
      R(RRR~R(R RrR7RRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s   cCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypevar+scCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypevarx.scCs|jd|j|dS(Ns
      (Rt do_defcvx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defcv3s cCs|jdt|d}|d |d\}}}}|jd|x|D]}|jd|qRW|jd|jdd||fdS(Ns
      is@b{%s}RBs
      Rs %s @r{on %s}(RRR~R(R RrR7Rt classnameRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR9s   cCs|jd|dS(Ns{Instance Variable} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defivarDscCs|jd|dS(Ns{Instance Variable} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defivarxGscCs|jd|j|dS(Ns
      (Rt do_defopx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defopJs cCs|jdt|d}|d |d\}}}}|jd|x%|D]}|jdt|qRW|jd|jdd||fdS(Ns
      is@b{%s}RBs
      Rs %s @r{on %s}(RRR~RR(R RrR7RRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRPs   cCs|jd|dS(NsMethod (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defmethodZscCs|jd|dS(NsMethod (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defmethodx]scCs|jd|j|dS(Ns
      (Rt do_deftpx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deftpbs cCs|jdt|d}|d |d\}}}|jd|x|D]}|jd|qOW|jd|jd|dS(Ns
      is@b{%s}RBs
      ttp(RRR~R(R RrR7RRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRhs   cCs\|s,|jdd|jt|j s s
        s
      (RRIR#RdRL(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_enumeratets    cCsEd|_|j|jt|jd|jt|jd=dS(Ni(R4RLRRIR#Rd(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_enumerate|s !cCs||_|jddS(Ns
        (RKR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_itemizes cCsd|_|jddS(Ns
      (R4RKR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_itemizes cCs||_|jddS(Ns
      (RKR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_tables cCsd|_|jddS(Ns
      (R4RKR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_tables cCsd|_|j|dS(NR(RMR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_ftables cCsd|_|jdS(N(R4RMR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_ftables cCsd|_|j|dS(NR(RMR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_vtables cCsd|_|jdS(N(R4RMR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_vtables cCsv|jr|j|j|n|jr|jddkrv|jdrv|jdtjkrv|jd|d}q|jd|}n|jdkr|jd|}t|j|_n|jr|jdd kr|j d |j ||j d nm|jrK|jdd krK|j d |j ||j dn'|j d|j ||j ddS(NiRiRRRBs. ittables
      s
      t multitabless s
    • s ( RMRRKRRRLR4t incrementRdRR~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_items*         cCsd|_|jddS(Ns (R4RKR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_multitables cCsd|_|jddS(Ns

      (R4RKR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_multitables cCs d|_dS(N(R4RK(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_columnfractionsscCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt handle_tabscCs|jddS(Ns
      (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_quotationRcCs|jddS(Ns
      (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_quotationRcCs!|jd|_|jddS(Nis
      (RGR(R
      Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_examplescCs!|jd|jd|_dS(Ns
      i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_examples cCs|j|ddS(Ns (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_exdentRcCs!|jd|_|jddS(Nis
      (RGR(R
      Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
      bgn_flushleftscCs!|jd|jd|_dS(Ns
      i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_flushlefts cCs!|jd|_|jddS(Nis
      (RGR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_flushrightscCs!|jd|jd|_dS(Ns
      i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_flushrights cCs+|jd|jd|jjdS(Ns s$ Menu

      (RRBt beginmenu(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_menus  cCs|jd|jjdS(Ns

      (RRBtendmenu(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_menus cCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_cartoucheRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_cartoucheRcCsdg|_i|_d|jd iRzs
      s@code{Rs
      %s s
    • (RRR<RtretcompileRRWRRtsortRR4R~R(R Rt iscodeindexRtindex1tjunkprogRDRNtsortkeyt oldsortkeyRkRtprevkeytprevnode((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6sH         cCsX|jrTdGH|jj}|jx*|D]}|jdG|j|GHq.WndS(Ns--- Unrecognized commands ---i(R:RHRtljust(R tcmdsRn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytreport^s    (AR0R1Rt FN_ID_PATTERNRRRRRVR RQRRRSR]RZRoRpRRxReR{R~RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRt open_asist close_asisRRRRRR R R R R RRRRRuRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R-topen_titlefonttclose_titlefontR.R/RhR2R8R6R9tdo_cR:R;R<R=R>R?R@RARFRGRIRJRKRLRMRNt do_finalouttdo_setchapternewpagetdo_setfilenameRORPRQRRRSRTRUtdo_titlet do_subtitlet do_authortdo_vskiptdo_vfillt do_smallbooktdo_paragraphindentt do_headingstdo_footnotestyletdo_evenheadingtdo_evenfootingt do_oddheadingt do_oddfootingtdo_everyheadingtdo_everyfootingRYR"RZR]R^R_R`RaRbRcRdRetdo_appendixsectionRfRhRiRjRkRmRnRoRpR\RtRutdo_summarycontentsRsRxRyRzR{R|R}RRR~Rt end_defunRRt end_defmacRRt end_defspecRRt end_defvrRRt end_defvarRRt end_defoptRRt end_deftypefnRRtend_deftypefunRRt end_deftypevrRRtend_deftypevarRRt end_defcvRRt end_defivarRRt end_defopRRt end_defmethodRRt end_deftpRRRRRRRRRRRRtdo_itemxRRRRRRRRtbgn_lisptend_lisptbgn_smallexampletend_smallexamplet bgn_smalllispt end_smalllispt bgn_displayt end_displayt bgn_formatt end_formatRRRRRRRRRRDRRRRRRRRRtdo_syncodeindexRRR(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6s~ !    8   #  T                &                                                    &                                                                                                                                                                     (tTexinfoParserHTML3cBseZdZdZdedZdedZdZeZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s©s[%(id)s]s3ss;

      s %(text)s

      s[

      Footnotes

      cCs|jddS(Ns(R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRuRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRvRcCs!|jd|_|jddS(Nis

      (RGR(R
      Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRxscCs!|jd|jd|_dS(Ns
      i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR}s cCs!|jd|_|jddS(Nis
      (RGR(R
      Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRscCs!|jd|_|jddS(Nis4
      (RGR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRscCs!|jd|jd|_dS(Ns
      i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs cCs|jd|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs(R0R1RRRRRR5RVRRRRRRRRR(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&gs        tHTMLHelpcBseZdZejdZdZdZdZdZ dZ dZ dZ d Z ejd Zejd Zd ejd Zd ejdZdZejdZdZRS(s This class encapsulates support for HTML Help. Node names, file names, menu items, index items, and image file names are accumulated until a call to finalize(). At that time, three output files are created in the current directory: `helpbase`.hhp is a HTML Help Workshop project file. It contains various information, some of which I do not understand; I just copied the default project info from a fresh installation. `helpbase`.hhc is the Contents file for the project. `helpbase`.hhk is the Index file for the project. When these files are used as input to HTML Help Workshop, the resulting file will be named: `helpbase`.chm If none of the defaults in `helpbase`.hhp are changed, the .CHM file will have Contents, Index, Search, and Favorites tabs. s @code{(.*?)}cCsy||_||_d|_d|_d|_g|_i|_i|_i|_ g|_ d|_ i|_ i|_ dS(NR(thelpbaseRR4t projectfilet contentfilet indexfiletnodelistt nodenamest nodeindexR;t indexlisttcurrenttmenudicttdumped(R R(R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s            cCse|||||f}||j|s0sssGssss' s2 s* s) s sss$s$s ( R(R,Rt dumpfilesRRtsystexitt dumpnodest dumpindex(R t resultfileR)R*R+RRttopnextttopprevttopupttopfilet defaulttopicRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR+s                                                     cCs8|jj}|jx|D]}||IJq WdS(N(R;RHR(R toutfiletfilelistR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR4;s  cCsyi|_|jr:|jd\}}}}}||_n|dIJx$|jD]}|j|d|qNW|dIJdS(Nis
        s
      (R2R,ttopnodetdumpnode(R R?RRwRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR7As    ic Cs|r|\}}}}}||_|jj|r:dSd|j|<|d|I|dI|d|dI|d|dI|dIJy(|j|} |j| |d|Wqtk rqXndS( NiRBs
    • ssssBs<     Z -      9 PK!1"v pathfix.pycnu[ fc@sddlZddlZddlZddlTddlZejjZeZej jZ da dZ ejdZdZdZdZdZed kre ndS( iN(t*cCspdtjd}y#tjtjdd\}}Wn;tjk rq}t|dt|tjdnXx)|D]!\}}|dkry|aqyqyWt stddks| rtd t|tjdnd}xv|D]n}tjj |rt |r[d}q[qtjj |rFt|d d}qt |rd}qqWtj|dS( Ns0usage: %s -i /interpreter file-or-directory ... iisi:s is-it/s'-i option or file-or-directory missing s": will not process symbolic links ( tsystargvtgetoptterrorterrtexittnew_interpretertostpathtisdirt recursedowntislinktfix(tusagetoptstargstmsgtotatbadtarg((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytmain"s4#         s^[a-zA-Z0-9_]+\.py$cCstj|dkS(Ni(t ispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytispython?scCs1td|fd}ytj|}Wn+tjk rW}td||fdSX|jg}x|D]}|tjtjfkrqontjj ||}tjj |rqotjj |r|j |qot |rot|rd}qqoqoWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgR tlistdirRRtsorttcurdirtpardirR tjoinR R tappendRRR (tdirnameRtnamesRtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR Bs0      c Cs<yt|d}Wn(tk r=}td||fdSX|j}t|}||kr~t|d|jdStjj |\}}tjj |d|}yt|d}Wn2tk r}|jtd||fdSXt|d|j |d} x*|j | } | s4Pn|j | qW|j|jy+tj |} tj|| td @Wn*tjk r}td ||fnXytj||d Wn*tjk r}td||fnXytj||Wn+tjk r7}td||fdSXdS(Ntrs%s: cannot open: %r is : no change t@tws%s: cannot create: %r s : updating iiis%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) ii (topentIOErrorRtreadlinetfixlinetreptcloseR R tsplitR!twritetreadtstattchmodtST_MODERtrename( tfilenametfRtlinetfixedtheadttailttempnametgtBUFSIZEtbuftstatbuf((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyRXsX        cCs+|jds|Sd|kr#|SdtS(Ns#!tpythons#! %s (t startswithR(R:((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR.s  t__main__(RtreR R4RtstderrR2RRtstdoutR/tNoneRRtcompileRRR RR.t__name__(((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyts           5  PK! R R diff.pycnu[ fc@sedZddlZddlZddlZddlZddlZdZedkraendS(sS Command line interface to difflib.py providing diffs in four formats: * ndiff: lists every line and highlights interline changes. * context: highlights clusters of changes in a before/after format. * unified: highlights clusters of changes in an inline format. * html: generates side by side comparison with change highlights. iNc Csed}tj|}|jddddtdd|jddddtdd |jd dddtdd |jd dddtdd |jdddddddd|j\}}t|dkr|jtjdnt|dkr|j dn|j }|\}}t j t j|j}t j t j|j}t|d} | j} WdQXt|d} | j} WdQX|jrtj| | ||||d|} n{|jrtj| | } n]|jr-tjj| | ||d|jd|} n$tj| | ||||d|} tjj| dS(Ns&usage: %prog [options] fromfile tofiles-ctactiont store_truetdefaultthelps'Produce a context format diff (default)s-usProduce a unified format diffs-msAProduce HTML side by side diff (can use -c and -l in conjunction)s-nsProduce a ndiff format diffs-ls--linesttypetintis'Set number of context lines (default 3)iiis*need to specify both a fromfile and tofiletUtntcontexttnumlines(toptparset OptionParsert add_optiontFalset parse_argstlent print_helptsystexitterrortlinesttimetctimetoststattst_mtimetopent readlinestutdifflibt unified_diffRtndifftmtHtmlDifft make_filetct context_difftstdoutt writelines( tusagetparsertoptionstargsRtfromfilettofiletfromdatettodatetft fromlinesttolinestdiff((s*/usr/lib64/python2.7/Tools/scripts/diff.pytmain s:"    '  0$t__main__(t__doc__RRRRR R3t__name__(((s*/usr/lib64/python2.7/Tools/scripts/diff.pyt s< & PK!tO db2pickle.pynuȯ#! /usr/bin/python2.7 """ Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ] Convert the database file given on the command line to a pickle representation. The optional flags indicate the type of the database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for write access (deleting any existing data). If no pickle file is named, the pickle output is written to standard output. """ import getopt try: import bsddb except ImportError: bsddb = None try: import dbm except ImportError: dbm = None try: import gdbm except ImportError: gdbm = None try: import anydbm except ImportError: anydbm = None import sys try: import cPickle as pickle except ImportError: import pickle prog = sys.argv[0] def usage(): sys.stderr.write(__doc__ % globals()) def main(args): try: opts, args = getopt.getopt(args, "hbrdag", ["hash", "btree", "recno", "dbm", "gdbm", "anydbm"]) except getopt.error: usage() return 1 if len(args) == 0 or len(args) > 2: usage() return 1 elif len(args) == 1: dbfile = args[0] pfile = sys.stdout else: dbfile = args[0] try: pfile = open(args[1], 'wb') except IOError: sys.stderr.write("Unable to open %s\n" % args[1]) return 1 dbopen = None for opt, arg in opts: if opt in ("-h", "--hash"): try: dbopen = bsddb.hashopen except AttributeError: sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-b", "--btree"): try: dbopen = bsddb.btopen except AttributeError: sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-r", "--recno"): try: dbopen = bsddb.rnopen except AttributeError: sys.stderr.write("bsddb module unavailable.\n") return 1 elif opt in ("-a", "--anydbm"): try: dbopen = anydbm.open except AttributeError: sys.stderr.write("anydbm module unavailable.\n") return 1 elif opt in ("-g", "--gdbm"): try: dbopen = gdbm.open except AttributeError: sys.stderr.write("gdbm module unavailable.\n") return 1 elif opt in ("-d", "--dbm"): try: dbopen = dbm.open except AttributeError: sys.stderr.write("dbm module unavailable.\n") return 1 if dbopen is None: if bsddb is None: sys.stderr.write("bsddb module unavailable - ") sys.stderr.write("must specify dbtype.\n") return 1 else: dbopen = bsddb.hashopen try: db = dbopen(dbfile, 'r') except bsddb.error: sys.stderr.write("Unable to open %s. " % dbfile) sys.stderr.write("Check for format or version mismatch.\n") return 1 for k in db.keys(): pickle.dump((k, db[k]), pfile, 1==1) db.close() pfile.close() return 0 if __name__ == "__main__": sys.exit(main(sys.argv[1:])) PK!n0& fixnotice.pynuȯ#! /usr/bin/python2.7 """(Ostensibly) fix copyright notices in files. Actually, this script will simply replace a block of text in a file from one string to another. It will only do this once though, i.e. not globally throughout the file. It writes a backup file and then does an os.rename() dance for atomicity. Usage: fixnotices.py [options] [filenames] Options: -h / --help Print this message and exit --oldnotice=file Use the notice in the file as the old (to be replaced) string, instead of the hard coded value in the script. --newnotice=file Use the notice in the file as the new (replacement) string, instead of the hard coded value in the script. --dry-run Don't actually make the changes, but print out the list of files that would change. When used with -v, a status will be printed for every file. -v / --verbose Print a message for every file looked at, indicating whether the file is changed or not. """ OLD_NOTICE = """/*********************************************************** Copyright (c) 2000, BeOpen.com. Copyright (c) 1995-2000, Corporation for National Research Initiatives. Copyright (c) 1990-1995, Stichting Mathematisch Centrum. All rights reserved. See the file "Misc/COPYRIGHT" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. ******************************************************************/ """ import os import sys import getopt NEW_NOTICE = "" DRYRUN = 0 VERBOSE = 0 def usage(code, msg=''): print __doc__ % globals() if msg: print msg sys.exit(code) def main(): global DRYRUN, OLD_NOTICE, NEW_NOTICE, VERBOSE try: opts, args = getopt.getopt(sys.argv[1:], 'hv', ['help', 'oldnotice=', 'newnotice=', 'dry-run', 'verbose']) except getopt.error, msg: usage(1, msg) for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-v', '--verbose'): VERBOSE = 1 elif opt == '--dry-run': DRYRUN = 1 elif opt == '--oldnotice': fp = open(arg) OLD_NOTICE = fp.read() fp.close() elif opt == '--newnotice': fp = open(arg) NEW_NOTICE = fp.read() fp.close() for arg in args: process(arg) def process(file): f = open(file) data = f.read() f.close() i = data.find(OLD_NOTICE) if i < 0: if VERBOSE: print 'no change:', file return elif DRYRUN or VERBOSE: print ' change:', file if DRYRUN: # Don't actually change the file return data = data[:i] + NEW_NOTICE + data[i+len(OLD_NOTICE):] new = file + ".new" backup = file + ".bak" f = open(new, "w") f.write(data) f.close() os.rename(file, backup) os.rename(new, file) if __name__ == '__main__': main() PK!cndiff.pynuȯ#! /usr/bin/python2.7 # Module ndiff version 1.7.0 # Released to the public domain 08-Dec-2000, # by Tim Peters (tim.one@home.com). # Provided as-is; use at your own risk; no warranty; no promises; enjoy! # ndiff.py is now simply a front-end to the difflib.ndiff() function. # Originally, it contained the difflib.SequenceMatcher class as well. # This completes the raiding of reusable code from this formerly # self-contained script. """ndiff [-q] file1 file2 or ndiff (-r1 | -r2) < ndiff_output > file1_or_file2 Print a human-friendly file difference report to stdout. Both inter- and intra-line differences are noted. In the second form, recreate file1 (-r1) or file2 (-r2) on stdout, from an ndiff report on stdin. In the first form, if -q ("quiet") is not specified, the first two lines of output are -: file1 +: file2 Each remaining line begins with a two-letter code: "- " line unique to file1 "+ " line unique to file2 " " line common to both files "? " line not present in either input file Lines beginning with "? " attempt to guide the eye to intraline differences, and were not present in either input file. These lines can be confusing if the source files contain tab characters. The first file can be recovered by retaining only lines that begin with " " or "- ", and deleting those 2-character prefixes; use ndiff with -r1. The second file can be recovered similarly, but by retaining only " " and "+ " lines; use ndiff with -r2; or, on Unix, the second file can be recovered by piping the output through sed -n '/^[+ ] /s/^..//p' """ __version__ = 1, 7, 0 import difflib, sys def fail(msg): out = sys.stderr.write out(msg + "\n\n") out(__doc__) return 0 # open a file & return the file object; gripe and return 0 if it # couldn't be opened def fopen(fname): try: return open(fname, 'U') except IOError, detail: return fail("couldn't open " + fname + ": " + str(detail)) # open two files & spray the diff to stdout; return false iff a problem def fcompare(f1name, f2name): f1 = fopen(f1name) f2 = fopen(f2name) if not f1 or not f2: return 0 a = f1.readlines(); f1.close() b = f2.readlines(); f2.close() for line in difflib.ndiff(a, b): print line, return 1 # crack args (sys.argv[1:] is normal) & compare; # return false iff a problem def main(args): import getopt try: opts, args = getopt.getopt(args, "qr:") except getopt.error, detail: return fail(str(detail)) noisy = 1 qseen = rseen = 0 for opt, val in opts: if opt == "-q": qseen = 1 noisy = 0 elif opt == "-r": rseen = 1 whichfile = val if qseen and rseen: return fail("can't specify both -q and -r") if rseen: if args: return fail("no args allowed with -r option") if whichfile in ("1", "2"): restore(whichfile) return 1 return fail("-r value must be 1 or 2") if len(args) != 2: return fail("need 2 filename args") f1name, f2name = args if noisy: print '-:', f1name print '+:', f2name return fcompare(f1name, f2name) # read ndiff output from stdin, and print file1 (which=='1') or # file2 (which=='2') to stdout def restore(which): restored = difflib.restore(sys.stdin.readlines(), which) sys.stdout.writelines(restored) if __name__ == '__main__': args = sys.argv[1:] if "-profile" in args: import profile, pstats args.remove("-profile") statf = "ndiff.pro" profile.run("main(args)", statf) stats = pstats.Stats(statf) stats.strip_dirs().sort_stats('time').print_stats() else: main(args) PK!}}fixps.pynuȯ#! /usr/bin/python2.7 # Fix Python script(s) to reference the interpreter via /usr/bin/env python. # Warning: this overwrites the file without making a backup. import sys import re def main(): for filename in sys.argv[1:]: try: f = open(filename, 'r') except IOError, msg: print filename, ': can\'t open :', msg continue line = f.readline() if not re.match('^#! */usr/local/bin/python', line): print filename, ': not a /usr/local/bin/python script' f.close() continue rest = f.read() f.close() line = re.sub('/usr/local/bin/python', '/usr/bin/env python', line) print filename, ':', repr(line) f = open(filename, "w") f.write(line) f.write(rest) f.close() if __name__ == '__main__': main() PK!H8``pdeps.pynuȯ#! /usr/bin/python2.7 # pdeps # # Find dependencies between a bunch of Python modules. # # Usage: # pdeps file1.py file2.py ... # # Output: # Four tables separated by lines like '--- Closure ---': # 1) Direct dependencies, listing which module imports which other modules # 2) The inverse of (1) # 3) Indirect dependencies, or the closure of the above # 4) The inverse of (3) # # To do: # - command line options to select output type # - option to automatically scan the Python library for referenced modules # - option to limit output to particular modules import sys import re import os # Main program # def main(): args = sys.argv[1:] if not args: print 'usage: pdeps file.py file.py ...' return 2 # table = {} for arg in args: process(arg, table) # print '--- Uses ---' printresults(table) # print '--- Used By ---' inv = inverse(table) printresults(inv) # print '--- Closure of Uses ---' reach = closure(table) printresults(reach) # print '--- Closure of Used By ---' invreach = inverse(reach) printresults(invreach) # return 0 # Compiled regular expressions to search for import statements # m_import = re.compile('^[ \t]*from[ \t]+([^ \t]+)[ \t]+') m_from = re.compile('^[ \t]*import[ \t]+([^#]+)') # Collect data from one file # def process(filename, table): fp = open(filename, 'r') mod = os.path.basename(filename) if mod[-3:] == '.py': mod = mod[:-3] table[mod] = list = [] while 1: line = fp.readline() if not line: break while line[-1:] == '\\': nextline = fp.readline() if not nextline: break line = line[:-1] + nextline if m_import.match(line) >= 0: (a, b), (a1, b1) = m_import.regs[:2] elif m_from.match(line) >= 0: (a, b), (a1, b1) = m_from.regs[:2] else: continue words = line[a1:b1].split(',') # print '#', line, words for word in words: word = word.strip() if word not in list: list.append(word) # Compute closure (this is in fact totally general) # def closure(table): modules = table.keys() # # Initialize reach with a copy of table # reach = {} for mod in modules: reach[mod] = table[mod][:] # # Iterate until no more change # change = 1 while change: change = 0 for mod in modules: for mo in reach[mod]: if mo in modules: for m in reach[mo]: if m not in reach[mod]: reach[mod].append(m) change = 1 # return reach # Invert a table (this is again totally general). # All keys of the original table are made keys of the inverse, # so there may be empty lists in the inverse. # def inverse(table): inv = {} for key in table.keys(): if not inv.has_key(key): inv[key] = [] for item in table[key]: store(inv, item, key) return inv # Store "item" in "dict" under "key". # The dictionary maps keys to lists of items. # If there is no list for the key yet, it is created. # def store(dict, key, item): if dict.has_key(key): dict[key].append(item) else: dict[key] = [item] # Tabulate results neatly # def printresults(table): modules = table.keys() maxlen = 0 for mod in modules: maxlen = max(maxlen, len(mod)) modules.sort() for mod in modules: list = table[mod] list.sort() print mod.ljust(maxlen), ':', if mod in list: print '(*)', for ref in list: print ref, print # Call main and honor exit status if __name__ == '__main__': try: sys.exit(main()) except KeyboardInterrupt: sys.exit(1) PK!7[hhbyext.pynuȯ#! /usr/bin/python2.7 """Show file statistics by extension.""" from __future__ import print_function import os import sys class Stats: def __init__(self): self.stats = {} def statargs(self, args): for arg in args: if os.path.isdir(arg): self.statdir(arg) elif os.path.isfile(arg): self.statfile(arg) else: sys.stderr.write("Can't find %s\n" % arg) self.addstats("", "unknown", 1) def statdir(self, dir): self.addstats("", "dirs", 1) try: names = sorted(os.listdir(dir)) except os.error as err: sys.stderr.write("Can't list %s: %s\n" % (dir, err)) self.addstats("", "unlistable", 1) return for name in names: if name.startswith(".#"): continue # Skip CVS temp files if name.endswith("~"): continue# Skip Emacs backup files full = os.path.join(dir, name) if os.path.islink(full): self.addstats("", "links", 1) elif os.path.isdir(full): self.statdir(full) else: self.statfile(full) def statfile(self, filename): head, ext = os.path.splitext(filename) head, base = os.path.split(filename) if ext == base: ext = "" # E.g. .cvsignore is deemed not to have an extension ext = os.path.normcase(ext) if not ext: ext = "" self.addstats(ext, "files", 1) try: f = open(filename, "rb") except IOError as err: sys.stderr.write("Can't open %s: %s\n" % (filename, err)) self.addstats(ext, "unopenable", 1) return data = f.read() f.close() self.addstats(ext, "bytes", len(data)) if b'\0' in data: self.addstats(ext, "binary", 1) return if not data: self.addstats(ext, "empty", 1) #self.addstats(ext, "chars", len(data)) lines = data.splitlines() self.addstats(ext, "lines", len(lines)) del lines words = data.split() self.addstats(ext, "words", len(words)) def addstats(self, ext, key, n): d = self.stats.setdefault(ext, {}) d[key] = d.get(key, 0) + n def report(self): exts = sorted(self.stats.keys()) # Get the column keys columns = {} for ext in exts: columns.update(self.stats[ext]) cols = sorted(columns.keys()) colwidth = {} colwidth["ext"] = max([len(ext) for ext in exts]) minwidth = 6 self.stats["TOTAL"] = {} for col in cols: total = 0 cw = max(minwidth, len(col)) for ext in exts: value = self.stats[ext].get(col) if value is None: w = 0 else: w = len("%d" % value) total += value cw = max(cw, w) cw = max(cw, len(str(total))) colwidth[col] = cw self.stats["TOTAL"][col] = total exts.append("TOTAL") for ext in exts: self.stats[ext]["ext"] = ext cols.insert(0, "ext") def printheader(): for col in cols: print("%*s" % (colwidth[col], col), end=" ") print() printheader() for ext in exts: for col in cols: value = self.stats[ext].get(col, "") print("%*s" % (colwidth[col], value), end=" ") print() printheader() # Another header at the bottom def main(): args = sys.argv[1:] if not args: args = [os.curdir] s = Stats() s.statargs(args) s.report() if __name__ == "__main__": main() PK!)ML{E{E texi2html.pyonu[ fc@sbddlZddlZddlZddlZdZejdZejdZejdZejdZ ejdZ dfd YZ d e fd YZ d fd YZ de fdYZdfdYZdZdZejdZdZdZejejdZdZdZdZedkr^endS(iNs\input texinfos^@([a-z]+)([ ]|$)s^[ ]*$s@[a-z]+s [ @{}&<>]s.^\* ([^:]*):(:|[ ]*([^ , .]+)([^ ]*))[ ]*tHTMLNodecBsteZdZdZdZdZdZdZdZdZ d d dZ d Z d Z d Zd ZRS(sSome of the parser's functionality is separated into this class. A Node accumulates its contents, takes care of links to other Nodes and saves itself when it is finished and all links are resolved. s2its cCs^||_||_|r$||_n ||_||_||_||_||_g|_dS(N(tdirnametnamettopnamettitletnexttprevtuptlines(tselftdirRRRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt__init__gs        cGst|jj|dS(N(tmapR tappend(R R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytwritetscCsat|jdt|jd}|j|j|j|j|j|j|jdS(Nt/tw( topenRtmakefileRRtprologuettexttepiloguetclose(R tfp((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytflushws #c Cs|r|jdkr'd}d}nt|}d|}|j|d|d|r_d|pbd|rrd|pud|d |d ndS( Ns(dir)s ../dir.htmlRs TITLE="%s"s : s (tlowerRR(R tlabeltnodenametreltrevtaddrR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytlink~s   cCst|j}dj|j|_g|_|j|j|jdj|j}g|_|jd|jdt |j d|j dt |j d|j dt |j d|j d||_ |dkrd ||_ndS( NRsF s ��� is

      %s (tlenR tjoinRt open_linkst output_linkst close_linkstDOCTYPERRRRRRR(R tlengthtlinks((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytfinalizes     i  cCs|jddS(Ns


      (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR%scCs|jddS(Ns
      (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR'scCs|j|jkr(|jd|jn|jd|jdd|jd|jdd|jd|jdd|j|jkr|jd |jndS( Ns Conts NextRtNexts PrevtPreviouss UptUps Top(tcontRR"RRRR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&sN(t__name__t __module__t__doc__R(ttypeR/RR RRtNoneR"R+R%R'R&(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZs     t HTML3NodecBs eZdZdZdZRS(s;cCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR's(R0R1R(R%R'(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR5s t TexinfoParsercBs eZdZdZdedZdedZdZeZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Z<d;Z=d<Z>d=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^e]Z_e^Z`d]Zad^Zbd_Zcd`ZddaZedbZfdcZgddZhdeZidfZjdgZkdhZldiZmdjZndkZodlZpdmZqdnZrdoZsdpZtdqZudrZvdsZwdtZxduZydvZzdwZ{dxZ|dyZ}dzZ~d{Zd|Zd}Zd~ZdZdZdZdZdZe]Ze^ZdZdZdZdZdZdZdZeZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZeZeZeZdZdZdZdZdZdZdZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZeZdZdZdZdZdZdZdZdZdZdZdZdZeZdZdZdZdZdZdZdZdZdZdZdZdZeZdZdZdZdZdZdZdZdZdZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZeZdZdZ eZ dZ dZ dZ dZdZdZdZdZdZdZdZdZeZdZdZdZdZdZdZdZdZeZ eZ!eZ"eZ#e Z$e!Z%eZ&eZ'e&Z(e'Z)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6dZ7dZ8dZ9dZ:dZ;dZ<e<Z=dZ>d Z?d Z@RS( s©s(%(id)s)s5ss5s %(text)s

      sJ


      Footnotes

      cCsi|_i|_d|_d|_d|_d|_d|_d|_g|_ d|_ d|_ d|_ d|_ d|_d|_|jg|_g|_d|_idd6|_i|_g|_d|_d|_d|_d|_g|_d|_d|_dS(Nittmpt.Rithtml(tunknownt filenamest debuggingt print_headersR4tnodefpt nodelinenoR*tsavetextt savestackthtmlhelpRt includedirRRRt resetindextcontentst numberingtnofilltvaluest stackinfot footnotestitemargt itemnumbert itemindextnodet nodestackR/t includedepth(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s:                           cCs ||_dS(N(RB(R RB((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt sethtmlhelpscCs ||_dS(N(R(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt setdirnamescCs ||_dS(N(RC(R RC((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt setincludedirscCs|j}d}x?|rS|ddks:tj|rS|j}|d}qW|tt tkr}tdtfn|j||dS(Niit%sfile does not begin with %r(treadlinetblprogtmatchR#tMAGICt SyntaxErrort parserest(R Rtlinetlineno((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytparses ( c Cs<|}d|_d|_g|_g}x|js|j}|jd|_|s|r}|jst|j|ng}n|dkrdGHnPn|d}tj|}|r-|jd\}}|||!} | dkr|j |q|r|js|j|ng}n|j ||q*t j|rd|jkrd|jkr|r|js|j||j r|j dn |j d g}qqq*|j |q*W|jrd GHn|jrd GHd G|jGHn|jdkr8x<|jr4|jd j|jd j|jd =qWndS(Niis*** EOF before @byetnoindenttrefilltformattexamples s

      s*** Still skipping at the ends*** Stack not empty at the ends***i(R^R_(tdonetskiptstackRUR?tprocesstcmprogRWtspanRtcommandRVRGRRPROR+R( R Rtinitial_linenoR\taccuR[tmotatbtcmd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRZsb                    cCs2|jdkr%|jj|jnd|_dS(NR(R@R4RAR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt startsaving@scCsN|j}t|jdkr;|jd|_|jd=n d|_|pMdS(NiiR(R@R#RAR4(R R@((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytcollectsavingsGs    cGsydj|}Wn|GHtnX|jdkrJ|j||_n8|jrf|jj|n|jr|jj|ndS(NR(R$t TypeErrorR@R4R>RRN(R targsR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRQs   cCs|jdkr#dGH|j}n|jr9|jn|jr|jdkr|jd|jd \}}}}|j d||j d||j d||j |j kr|j d|j n|jdn|jd |jj d|_n|j r|j rf|j j sI|j jrf|j jrf|j jrf|j j|j jn|jj|j d|_ nd |_ dS( Ns$*** Still saving text at end of nodeis


      iR,tPrevR.tTops R(R@R4RpRJtwritefootnotesR>R?Rt nodelinksR"RRRRNR/R3RRRR+RROR(R tdummyRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytendnode_s6          $  c Cs|jdkrdd|jGdG|jG|jG|rA|dd Gn|ddsY|dr`dGnHn|jrxa|D]:}tj|}|s|jd}|j|qwn|jd\}}|jd\}}|jd\}} |jd \} } |jd \} } |||!}||| !}|dd krQ|}n || | !}|| | !}|j d t |d |d|d|j j ||j||qwWndj |}|j|dS(Nit!sprocess:iis...s iiit:s
    • sR(R<RcRdtinmenutmiprogRWtstriptexpandRgRRRBtmenuitemR$(R RjR[RktbgntendRlRmtctdtetftgthRRtpunctR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyResB           cCss|j}xS|r^|ddkr^y|jt|r<dSWntk rPnX|d }q W|or|ddkS(Nitifsettifclearitmenu(RR(RdRIR#tKeyError(R Rd((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR{s  c Cs'g}d}t|}x||kr|}tj||}|rT|j}n|j||P|j|||!||}|d}|dkr|jdqn|dkr|jdqn|dkr|jdqn|dkr |jd qn|d kr)|jd qn|d kr|sSd GH|jd qn|d}|d=yt|d|} Wn!tk r|j|qnX| qn|dkrt d|n|}x-||kr||t j kr|d}qW||krC|d}|||!}|dkr0q|j|qn|||!}||kr||d kr|d}|j|yt|d|} Wn!tk r|j |qnX| qnyt|d|} Wn!tk r|j |qnX| qW|r#dG|GHndS(Niis t fileiis<-- file(tostpathR$RCRtIOErrortreprR<RbRcRdRPRZR(R RrtfileRtmsgt save_donet save_skipt save_stack((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_include(s&       cCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dmn?RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_dmn@RcCs|jddS(Ns...(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_dotsBRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_dotsCRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_bulletERcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_bulletFRcCs|jddS(NtTeX(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_TeXHRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_TeXIRcCs|j|jdS(N(RtCOPYRIGHT_SYMBOL(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_copyrightKRcCs|j|jdS(N(RR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_copyrightLRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_copyrightMRcCs|jddS(Nt-(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_minusORcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_minusPRcCs|jddS(Ns¡(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_exclamdownvRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_exclamdownwRcCs|jddS(Ns¿(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_questiondownxRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_questiondownyRcCs|jddS(Nså(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_aazRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aa{RcCs|jddS(NsÅ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AA|RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AA}RcCs|jddS(Nsæ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ae~RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_aeRcCs|jddS(NsÆ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_AERcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_AERcCs|jddS(Nsø(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_oRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_oRcCs|jddS(NsØ(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ORcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_ORcCs|jddS(Nsß(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_ssRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_ssRcCs|jddS(Ntoe(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_oeRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_oeRcCs|jddS(NtOE(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_OERcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_OERcCs|jddS(Nsl/(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_lRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_lRcCs|jddS(NsL/(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_LRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_LRcCs|jddS(Ns=>(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_resultRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_resultRcCs|jddS(Ns==>(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_expansionRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_expansionRcCs|jddS(Ns-|(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_printRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_printRcCs|jddS(Ns error-->(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_errorRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_errorRcCs|jddS(Ns==(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_equivRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_equivRcCs|jddS(Ns-!-(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_pointRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_pointRcCs|jd|jdS(Nssee (RRo(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_pxrefs cCs|jdS(N(tmakeref(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_pxrefscCs|jd|jdS(NsSee (RRo(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_xrefs cCs|jdS(N(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_xrefscCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_refscCs|jdS(N(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_refscCs|jd|jdS(NsSee info file (RRo(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_inforefs cCs|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}|d}|jd|d|ddS( Nt,iRiit`s ', node `s'(RptsplitR}R#RR(R RtsRrRNR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_inforefs (  c Cs|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}}|dr|d}n|d}|d}t|}|rd|d |}n|jd |d |d dS( NRiRiiiis../Rs s(RpRR}R#RRR( R RRRrRRRRthref((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs (    cCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_urefscCs|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}|d}|s}|}n|jd|d|ddS( NRiRiis s(RpRR}R#RR(R RRRrRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_urefs (   cCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_imagescCs|jdS(N(t makeimage(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_imagesc Cs~|j}g|jdD]}|j^q}x#t|dkrY|jdq7W|d}|d}|d}|d}|d}|jd |} tjj| d r|d 7}nOtjj| d r|d 7}n,tjj| d r|d 7}n d | GH|j d|d|r2d|dp5d|rId|dpLd|r`d|dpcdd|j j | dS(NRiRiiiiiRs.pngs.jpgs.gifs*** Cannot find image s ( RpRR}R#RRRRtexistsRRBtaddimage( R RRRrtfilenametwidththeighttalttextt imagelocation((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs. (         cCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR RcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_citeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_citeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_codeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_codeRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_tRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_tRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_dfnRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_dfnRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_emphRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_emph RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_i"RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_i#RcCsBt|jd}|j|jit|d6|jdS(Nitid(R#RJRtFN_SOURCE_PATTERNRRo(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_footnote%s!cCs3t|jd}|jj||jfdS(Ni(R#RJRRp(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_footnote,scCs_|j|jx?|jD]4\}}|j|jit|d6|d6qWg|_dS(NRR(Rt FN_HEADERRJtFN_TARGET_PATTERNR(R RR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRu0s   cCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_file7RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_file8RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_kbd:RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_kbd;RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_key=RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_key>RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_r@RcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_rARcCs|jddS(Ns`(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_sampCRcCs|jddS(Ns'(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_sampDRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_scFRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_scGRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_strongIRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_strongJRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_bLRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_bMRcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_varORcCs|jddS(Ns(R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_varPRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_wRRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytclose_wSRcCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytopen_urlURcCs)|j}|jd|d|ddS(Ns s(RpR(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_urlVs cCs|jdS(N(Ro(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_emailZRcCs)|j}|jd|d|ddS(Nss(RpR(R R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_email[s cCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt open_smallbRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt close_smallcRcCs#|jd\}}|||!}||j}|jdkrnd|jGdG|jG|jGd|G|GHnyt|d|}Wnttk ryt|d|}Wn.tk r|js|j||ndSX|jj|||dSX|j s|dkr||ndS(NiRyscommand:Rtdo_tbgn_R( RgR}R<RcRdRRt unknown_cmdR(R R[RkRlRmRnRrtfunc((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRhes(     cCsOdGd|G|GH|jj|s3d|j|s (RR~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_centers  c Cs|jd|_g|jdD]}|j^q#}x#t|dkr`|jdq>W||_|d \}}}}|jdt|}|j j |rdG|GHn |j rd|j GdG|GHnd |j |<||_ |j r|jr|j |jd _ n|js(||_n|} |jrK| d |j} n|j|j|j |j| ||||_|jj|j ||||dS( NiRiRRs*** Filename already in use: Rys --- writingiis -- (RxR?RR}R#RRvRRR;RR<RR/RORRtNodeRNRBtaddnode( R RrRtpartsRRRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_nodes0  (       c CsV|rR|jdkr!d}n t|}|j|d|d|d|dndS(Ns(dir)s ../dir.htmls : s (RRR(R RRR!((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR".s   cCs7|jr3||j_x|jr/|jdj|krf|jdj|jdj|jd=q|jdj|kr|jdjs|jj|jd_n|jjs|jdj|j_n|jdj|jdj|jd=q|dkr+|jj r+|jdj|j_nPqWndS(Nii( RNR3ROR+RRRRR(R R3((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytpopstack9s$      cCs$|jd|d|jddS(NtH1ii(theadingRZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_chapterNscCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_unnumberedRscCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_appendixUscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_topXscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_chapheadingZscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_majorheading\scCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_section_scCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedseccscCs$|jd|d|jddS(NR[ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsecfscCs|jd|ddS(NR[i(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_headingjscCs$|jd|d|jddS(NtH2ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_subsectionmscCs$|jd|d|jddS(NRgii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsecpscCs$|jd|d|jddS(NRgii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsecsscCs|jd|ddS(NRgi(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_subheadingvscCs$|jd|d|jddS(NtH3ii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubsectionyscCs$|jd|d|jddS(NRlii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_unnumberedsubsubsec|scCs$|jd|d|jddS(NRlii(R\RZ(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_appendixsubsubsecscCs|jd|ddS(NRli(R\(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_subsubheadingscCs|dkrx)t|j|kr7|jjdqW|j|d3|j|d|j| s---( R#RFRRRERRR~R<R=(R R3RrtleveltxR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR\s  cCs|jdddS(NsTable of Contentsi(t listcontents(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_contentsscCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_shortcontentsscCs!|jd|ddg}x|jD]\}}}||krGq&n||dkr|jd|dd|j|nI||dkrx6||dkr|d=|jd|ddqWn|jd|dt|d |j||jd q&W|jdt|dS( Ns

      s

        iis s
          s
        s
      • s (RRERRR~R#(R Rtmaxlevelt prevlevelsRqRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRss$   cCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_pageRcCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_needRcCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_groupRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_groupRcCs*|jr|jdn |jddS(Ns s

        (RGR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_sps cCs|jddS(Ns


        (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_hlinescCs|jd|j|dS(Ns
        (Rt do_deffnx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deffns cCs|jddS(Ns
        (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_deffnscCs|jdt|d}|d |d\}}}|jd|x%|D]}|jdt|qOW|jd|jd|dS(Ns
        is@b{%s}RBs
        tfn(Rt splitwordsR~tmakevartindex(R RrR7tcategoryRtresttword((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR~s   cCs|jd|dS(Ns Function (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defunRcCs|jd|dS(Ns Function (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defunxRcCs|jd|dS(NsMacro (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defmacRcCs|jd|dS(NsMacro (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defmacxRcCs|jd|dS(Ns{Special Form} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defspecRcCs|jd|dS(Ns{Special Form} (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defspecxRcCs|jd|j|dS(Ns
        (Rt do_defvrx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defvrs cCs|jdt|d}|d |d\}}}|jd|x|D]}|jd|qOW|jd|jd|dS(Ns
        is @code{%s}RBs
        tvr(RRR~R(R RrR7RRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs   cCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defvarRcCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defvarxRcCs|jd|dS(Ns{User Option} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defoptRcCs|jd|dS(Ns{User Option} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defoptxRcCs|jd|j|dS(Ns
        (Rt do_deftypefnx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deftypefns cCs|jdt|d}|d |d\}}}}|jd||fx%|D]}|jdt|qXW|jd|jd|dS(Ns
        is@code{%s} @b{%s}RBs
        R(RRR~RR(R RrR7RtdatatypeRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s   cCs|jd|dS(Ns Function (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypefunRcCs|jd|dS(Ns Function (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypefunxRcCs|jd|j|dS(Ns
        (Rt do_deftypevrx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deftypevrs cCs|jdt|d}|d |d\}}}}|jd||fx|D]}|jd|qXW|jd|jd|dS(Ns
        is@code{%s} @b{%s}RBs
        R(RRR~R(R RrR7RRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s   cCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_deftypevar+scCs|jd|dS(Ns Variable (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_deftypevarx.scCs|jd|j|dS(Ns
        (Rt do_defcvx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defcv3s cCs|jdt|d}|d |d\}}}}|jd|x|D]}|jd|qRW|jd|jdd||fdS(Ns
        is@b{%s}RBs
        Rs %s @r{on %s}(RRR~R(R RrR7Rt classnameRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR9s   cCs|jd|dS(Ns{Instance Variable} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defivarDscCs|jd|dS(Ns{Instance Variable} (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defivarxGscCs|jd|j|dS(Ns
        (Rt do_defopx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defopJs cCs|jdt|d}|d |d\}}}}|jd|x%|D]}|jdt|qRW|jd|jdd||fdS(Ns
        is@b{%s}RBs
        Rs %s @r{on %s}(RRR~RR(R RrR7RRRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRPs   cCs|jd|dS(NsMethod (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_defmethodZscCs|jd|dS(NsMethod (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_defmethodx]scCs|jd|j|dS(Ns
        (Rt do_deftpx(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_deftpbs cCs|jdt|d}|d |d\}}}|jd|x|D]}|jd|qOW|jd|jd|dS(Ns
        is@b{%s}RBs
        ttp(RRR~R(R RrR7RRRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRhs   cCs\|s,|jdd|jt|j s s
          s
        (RRIR#RdRL(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_enumeratets    cCsEd|_|j|jt|jd|jt|jd=dS(Ni(R4RLRRIR#Rd(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_enumerate|s !cCs||_|jddS(Ns
          (RKR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_itemizes cCsd|_|jddS(Ns
        (R4RKR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_itemizes cCs||_|jddS(Ns
        (RKR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_tables cCsd|_|jddS(Ns
        (R4RKR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_tables cCsd|_|j|dS(NR(RMR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_ftables cCsd|_|jdS(N(R4RMR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_ftables cCsd|_|j|dS(NR(RMR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_vtables cCsd|_|jdS(N(R4RMR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_vtables cCsv|jr|j|j|n|jr|jddkrv|jdrv|jdtjkrv|jd|d}q|jd|}n|jdkr|jd|}t|j|_n|jr|jdd kr|j d |j ||j d nm|jrK|jdd krK|j d |j ||j dn'|j d|j ||j ddS(NiRiRRRBs. ittables
        s
        t multitabless s
      • s ( RMRRKRRRLR4t incrementRdRR~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytdo_items*         cCsd|_|jddS(Ns (R4RKR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_multitables cCsd|_|jddS(Ns

        (R4RKR(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_multitables cCs d|_dS(N(R4RK(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pythandle_columnfractionsscCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt handle_tabscCs|jddS(Ns
        (R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_quotationRcCs|jddS(Ns
        (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_quotationRcCs!|jd|_|jddS(Nis
        (RGR(R
        Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_examplescCs!|jd|jd|_dS(Ns
        i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_examples cCs|j|ddS(Ns (R~(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt do_exdentRcCs!|jd|_|jddS(Nis
        (RGR(R
        Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt
        bgn_flushleftscCs!|jd|jd|_dS(Ns
        i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_flushlefts cCs!|jd|_|jddS(Nis
        (RGR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_flushrightscCs!|jd|jd|_dS(Ns
        i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_flushrights cCs+|jd|jd|jjdS(Ns s$ Menu

        (RRBt beginmenu(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytbgn_menus  cCs|jd|jjdS(Ns

        (RRBtendmenu(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytend_menus cCsdS(N((R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt bgn_cartoucheRcCsdS(N((R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyt end_cartoucheRcCsdg|_i|_d|jd iRzs
        s@code{Rs
        %s s
      • (RRR<RtretcompileRRWRRtsortRR4R~R(R Rt iscodeindexRtindex1tjunkprogRDRNtsortkeyt oldsortkeyRkRtprevkeytprevnode((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6sH         cCsX|jrTdGH|jj}|jx*|D]}|jdG|j|GHq.WndS(Ns--- Unrecognized commands ---i(R:RHRtljust(R tcmdsRn((s//usr/lib64/python2.7/Tools/scripts/texi2html.pytreport^s    (AR0R1Rt FN_ID_PATTERNRRRRRVR RQRRRSR]RZRoRpRRxReR{R~RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRt open_asist close_asisRRRRRR R R R R RRRRRuRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R-topen_titlefonttclose_titlefontR.R/RhR2R8R6R9tdo_cR:R;R<R=R>R?R@RARFRGRIRJRKRLRMRNt do_finalouttdo_setchapternewpagetdo_setfilenameRORPRQRRRSRTRUtdo_titlet do_subtitlet do_authortdo_vskiptdo_vfillt do_smallbooktdo_paragraphindentt do_headingstdo_footnotestyletdo_evenheadingtdo_evenfootingt do_oddheadingt do_oddfootingtdo_everyheadingtdo_everyfootingRYR"RZR]R^R_R`RaRbRcRdRetdo_appendixsectionRfRhRiRjRkRmRnRoRpR\RtRutdo_summarycontentsRsRxRyRzR{R|R}RRR~Rt end_defunRRt end_defmacRRt end_defspecRRt end_defvrRRt end_defvarRRt end_defoptRRt end_deftypefnRRtend_deftypefunRRt end_deftypevrRRtend_deftypevarRRt end_defcvRRt end_defivarRRt end_defopRRt end_defmethodRRt end_deftpRRRRRRRRRRRRtdo_itemxRRRRRRRRtbgn_lisptend_lisptbgn_smallexampletend_smallexamplet bgn_smalllispt end_smalllispt bgn_displayt end_displayt bgn_formatt end_formatRRRRRRRRRRDRRRRRRRRRtdo_syncodeindexRRR(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR6s~ !    8   #  T                &                                                    &                                                                                                                                                                     (tTexinfoParserHTML3cBseZdZdZdedZdedZdZeZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s©s[%(id)s]s3ss;

        s %(text)s

        s[

        Footnotes

        cCs|jddS(Ns(R(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRuRcCs|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRvRcCs!|jd|_|jddS(Nis

        (RGR(R
        Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRxscCs!|jd|jd|_dS(Ns
        i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR}s cCs!|jd|_|jddS(Nis
        (RGR(R
        Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRscCs!|jd|_|jddS(Nis4
        (RGR(R Rr((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRscCs!|jd|jd|_dS(Ns
        i(RRG(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs cCs|jd|jddS(Ns (R(R ((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyRs(R0R1RRRRRR5RVRRRRRRRRR(((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR&gs        tHTMLHelpcBseZdZejdZdZdZdZdZ dZ dZ dZ d Z ejd Zejd Zd ejd Zd ejdZdZejdZdZRS(s This class encapsulates support for HTML Help. Node names, file names, menu items, index items, and image file names are accumulated until a call to finalize(). At that time, three output files are created in the current directory: `helpbase`.hhp is a HTML Help Workshop project file. It contains various information, some of which I do not understand; I just copied the default project info from a fresh installation. `helpbase`.hhc is the Contents file for the project. `helpbase`.hhk is the Index file for the project. When these files are used as input to HTML Help Workshop, the resulting file will be named: `helpbase`.chm If none of the defaults in `helpbase`.hhp are changed, the .CHM file will have Contents, Index, Search, and Favorites tabs. s @code{(.*?)}cCsy||_||_d|_d|_d|_g|_i|_i|_i|_ g|_ d|_ i|_ i|_ dS(NR(thelpbaseRR4t projectfilet contentfilet indexfiletnodelistt nodenamest nodeindexR;t indexlisttcurrenttmenudicttdumped(R R(R((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR s            cCse|||||f}||j|s0sssGssss' s2 s* s) s sss$s$s ( R(R,Rt dumpfilesRRtsystexitt dumpnodest dumpindex(R t resultfileR)R*R+RRttopnextttopprevttopupttopfilet defaulttopicRR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR+s                                                     cCs8|jj}|jx|D]}||IJq WdS(N(R;RHR(R toutfiletfilelistR((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR4;s  cCsyi|_|jr:|jd\}}}}}||_n|dIJx$|jD]}|j|d|qNW|dIJdS(Nis
          s
        (R2R,ttopnodetdumpnode(R R?RRwRN((s//usr/lib64/python2.7/Tools/scripts/texi2html.pyR7As    ic Cs|r|\}}}}}||_|jj|r:dSd|j|<|d|I|dI|d|dI|d|dI|dIJy(|j|} |j| |d|Wqtk rqXndS( NiRBs
      • ssssBs<     Z -      9 PK!&l copytime.pycnu[ fc@sQddlZddlZddlmZmZdZedkrMendS(iN(tST_ATIMEtST_MTIMEcCsttjdkr5tjjdtjdntjdtjd}}ytj|}Wn5tjk rtjj|dtjdnXy"tj ||t |t fWn5tjk rtjj|dtjdnXdS(Nis#usage: copytime source destination iis: cannot stat s: cannot change time ( tlentsystargvtstderrtwritetexittoststatterrortutimeRR(tfile1tfile2tstat1((s./usr/lib64/python2.7/Tools/scripts/copytime.pytmain s"t__main__(RRR RRRt__name__(((s./usr/lib64/python2.7/Tools/scripts/copytime.pyts    PK!55 fixdiv.pyonu[ fc@sdZddlZddlZddlZddlZdadZdZdZdZ dZ d Z d Z d dd YZ d ZdZedkrejendS(s(fixdiv - tool to fix division operators. To use this tool, first run `python -Qwarnall yourscript.py 2>warnings'. This runs the script `yourscript.py' while writing warning messages about all uses of the classic division operator to the file `warnings'. The warnings look like this: :: DeprecationWarning: classic division The warnings are written to stderr, so you must use `2>' for the I/O redirect. I know of no way to redirect stderr on Windows in a DOS box, so you will have to modify the script to set sys.stderr to some kind of log file if you want to do this on Windows. The warnings are not limited to the script; modules imported by the script may also trigger warnings. In fact a useful technique is to write a test script specifically intended to exercise all code in a particular module or set of modules. Then run `python fixdiv.py warnings'. This first reads the warnings, looking for classic division warnings, and sorts them by file name and line number. Then, for each file that received at least one warning, it parses the file and tries to match the warnings up to the division operators found in the source code. If it is successful, it writes its findings to stdout, preceded by a line of dashes and a line of the form: Index: If the only findings found are suggestions to change a / operator into a // operator, the output is acceptable input for the Unix 'patch' program. Here are the possible messages on stdout (N stands for a line number): - A plain-diff-style change ('NcN', a line marked by '<', a line containing '---', and a line marked by '>'): A / operator was found that should be changed to //. This is the recommendation when only int and/or long arguments were seen. - 'True division / operator at line N' and a line marked by '=': A / operator was found that can remain unchanged. This is the recommendation when only float and/or complex arguments were seen. - 'Ambiguous / operator (..., ...) at line N', line marked by '?': A / operator was found for which int or long as well as float or complex arguments were seen. This is highly unlikely; if it occurs, you may have to restructure the code to keep the classic semantics, or maybe you don't care about the classic semantics. - 'No conclusive evidence on line N', line marked by '*': A / operator was found for which no warnings were seen. This could be code that was never executed, or code that was only executed with user-defined objects as arguments. You will have to investigate further. Note that // can be overloaded separately from /, using __floordiv__. True division can also be separately overloaded, using __truediv__. Classic division should be the same as either of those. (XXX should I add a warning for division on user-defined objects, to disambiguate this case from code that was never executed?) - 'Phantom ... warnings for line N', line marked by '*': A warning was seen for a line not containing a / operator. The most likely cause is a warning about code executed by 'exec' or eval() (see note below), or an indirect invocation of the / operator, for example via the div() function in the operator module. It could also be caused by a change to the file between the time the test script was run to collect warnings and the time fixdiv was run. - 'More than one / operator in line N'; or 'More than one / operator per statement in lines N-N': The scanner found more than one / operator on a single line, or in a statement split across multiple lines. Because the warnings framework doesn't (and can't) show the offset within the line, and the code generator doesn't always give the correct line number for operations in a multi-line statement, we can't be sure whether all operators in the statement were executed. To be on the safe side, by default a warning is issued about this case. In practice, these cases are usually safe, and the -m option suppresses these warning. - 'Can't find the / operator in line N', line marked by '*': This really shouldn't happen. It means that the tokenize module reported a '/' operator but the line it returns didn't contain a '/' character at the indicated position. - 'Bad warning for line N: XYZ', line marked by '*': This really shouldn't happen. It means that a 'classic XYZ division' warning was read with XYZ being something other than 'int', 'long', 'float', or 'complex'. Notes: - The augmented assignment operator /= is handled the same way as the / operator. - This tool never looks at the // operator; no warnings are ever generated for use of this operator. - This tool never looks at the / operator when a future division statement is in effect; no warnings are generated in this case, and because the tool only looks at files for which at least one classic division warning was seen, it will never look at files containing a future division statement. - Warnings may be issued for code not read from a file, but executed using an exec statement or the eval() function. These may have in the filename position, in which case the fixdiv script will attempt and fail to open a file named '' and issue a warning about this failure; or these may be reported as 'Phantom' warnings (see above). You're on your own to deal with these. You could make all recommended changes and add a future division statement to all affected files, and then re-run the test script; it should not issue any warnings. If there are any, and you have a hard time tracking down where they are generated, you can use the -Werror option to force an error instead of a first warning, generating a traceback. - The tool should be run from the same directory as that from which the original script was run, otherwise it won't be able to open files given by relative pathnames. iNic CsJy#tjtjdd\}}Wn!tjk rF}t|dSXx>|D]6\}}|dkrotGHdS|dkrNdaqNqNW|stddS|drtjjdtjdnt |d}|dkrdS|j }|sd G|dGHdS|j d}x-|D]%}t |||} |p?| }qW|S( Nithmis-hs-ms&at least one file argument is requireds!%s: extra file arguments ignored is&No classic division warnings read from(tgetopttsystargvterrortusaget__doc__tmulti_oktstderrtwritet readwarningstNonetkeystsorttprocess( toptstargstmsgtotatwarningstfilestexittfilenametx((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytmains:#           cCs[tjjdtjd|ftjjdtjdtjjdtjddS(Ns%s: %s isUsage: %s [-m] warnings s"Try `%s -h' for more information. (RRR R(R((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRs!sL^(.+?):(\d+): DeprecationWarning: classic (int|long|float|complex) division$c Cs"tjt}yt|}Wn(tk rI}tjjd|dSXi}x|j}|siPn|j |}|s|j ddkrStjjd|qSqSn|j \}}} |j |} | dkrg||<} n| jt|t| fqSW|j|S(Nscan't open: %s tdivisionisWarning: ignored input (tretcompiletPATTERNtopentIOErrorRRR treadlinetmatchtfindtgroupstgetR tappendtinttinterntclose( t warningsfiletprogtfRRtlinetmRtlinenotwhattlist((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR s.  # cCsddGHyt|}Wn(tk rC}tjjd|dSXdG|GHt|}|jd}tj|j }xzt |\}}} } |dkrPng} xE|t |kr||d|kr| j |||d7}qW| r t| |ng} xE|t |krX||d|krX| j |||d7}qW| rj| rjq~| r| rt| dq~| r| rt| |q~t | dkrMtsMg} d}x?| D]7\\}}}||krqn| j ||}qWt | dkr,dG| dGHqJd Gd | d| d fGHqMng}g}g}xY| D]Q\}}|dkr|j |qf|dkr|j |qf|j |qfWd}x0| D](\\}}}||krqn|}t|}|||d!dkr-d|GHdG|GHqn|rLd|G|GHdG|GHq|r| rd||fGHdG|GHdGHdG|| d||GHq|r| rd|GHdG|GHq|r|rddj|dj||fGHdG|GHqqWq~W|jdS(Nt-iFscan't open: %s isIndex:isNo conclusive evidences$*** More than one / operator in lines**** More than one / operator per statementsin lines %d-%diR&tlongtfloattcomplext/s)*** Can't find the / operator in line %d:t*s*** Bad warning for line %d:s%dc%dts$True division / operator at line %d:t=s-*** Ambiguous / operator (%s, %s) at line %d:t|t?(R&R2(R3R4(RRRRR t FileContextR ttokenizetgenerate_tokensR tscanlineR tlenR%treportphantomwarningstreportRtchoptjoinR((RR0tfpRR+tindextgt startlinenot endlinenotslashestlineinfotorphansRtrowstlastrowtrowtcolR,tintlongt floatcomplextbadR.R/((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRs     ))                   !c Csg}d}d}xF|D]>\}}||krJ|g}|j|n|j|qWxM|D]E}|d}dj|d}d||fGH|j|ddqbWdS(NiR5is$*** Phantom %s warnings for line %d:tmarkR6(R R%RDRB( RR+tblocksRNt lastblockROR/tblocktwhats((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRA$s    cCsZd}xM|D]E\\}}}||kr d||fGHdGt|GH|}q q WdS(Ns*** %s on line %d:R6(R RC(RJtmessageRNRORPR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRB3s  R<cBsAeZdddZdZdZdZdddZRS( iicCs:||_d|_d|_d|_g|_g|_dS(Niii(REtwindowR.t eoflookaheadt lookaheadtbuffer(tselfRERZR.((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt__init__<s      cCs_xXt|j|jkrZ|j rZ|jj}|sGd|_Pn|jj|qWdS(Ni(R@R\RZR[RER R%(R^R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pytfillCs % cCsL|j|jsdS|jjd}|jj||jd7_|S(Ntii(R`R\tpopR]R%R.(R^R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR Js  cCs|j|jt|j}|jt|j}||koP|jknrd|j||S|j|ko~|knr|j||jStdS(N(R`R.R@R]R\tKeyError(R^RFtbufstarttlookend((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyt __getitem__Rs R6cCsn|dkr|}nxRt||dD]=}y||}Wntk rVd}nX|Gt|GHq)WdS(Nis(R trangeRcRC(R^tfirsttlastRTtiR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRB[s    N(t__name__t __module__R_R`R RfR RB(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR<;s    c Csg}d}d}xq|D]i\}}}}}|d}|dkrM|}n|dkro|j||fn|tjkrPqqW|||fS(NiR5s/=(R5s/=(R R%R=tNEWLINE( RGRJRHRIttypettokentstarttendR,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyR?es    cCs|jdr|d S|SdS(Ns i(tendswith(R,((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyRCsst__main__((RRRRR=RRRRR RRARBR<R?RCRkR(((s,/usr/lib64/python2.7/Tools/scripts/fixdiv.pyts"       W  *   PK!sss cvsfiles.pyonu[ fc@sqdZddlZddlZddlZddlZdadZdZdZe dkrmendS(sDPrint a list of files that are mentioned in CVS directories. Usage: cvsfiles.py [-n file] [directory] ... If the '-n file' option is given, only files under CVS that are newer than the given file are printed; by default, all files under CVS are printed. As a special case, if a file does not exist, it is always printed. iNicCsy#tjtjdd\}}Wn tjk rE}|GHtGdSXd}x/|D]'\}}|dkrSt|aqSqSW|rx%|D]}t|qWn tddS(Nisn:s-nt.( tgetopttsystargvterrort__doc__tNonetgetmtimet cutofftimetprocess(toptstargstmsgt newerfiletotatarg((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pytmains#  c CsRd}g}tj|}xo|D]g}tjj||}|dkrR|}q"tjj|r"tjj|s|j|qq"q"W|r3tjj|d}xt|jD]q}|j d}|ddkr|dr|d}tjj||}t r$t |t kr$q,|GHqqWnx|D]} t | q:WdS(NitCVStEntriest/ti( tostlistdirtpathtjointisdirtislinktappendtopent readlinestsplitRRR ( tdirtcvsdirtsubdirstnamestnametfullnametentriestetwordstsub((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR &s,     cCs6ytj|}Wntjk r*dSX|tjS(Ni(RtstatRtST_MTIME(tfilenametst((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR@s t__main__( RRRR*RRRR Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyt s        PK!O xxci.pynuȯ#! /usr/bin/python2.7 # xxci # # check in files for which rcsdiff returns nonzero exit status import sys import os from stat import * import fnmatch EXECMAGIC = '\001\140\000\010' MAXSIZE = 200*1024 # Files this big must be binaries and are skipped. def getargs(): args = sys.argv[1:] if args: return args print 'No arguments, checking almost *, in "ls -t" order' list = [] for file in os.listdir(os.curdir): if not skipfile(file): list.append((getmtime(file), file)) list.sort() if not list: print 'Nothing to do -- exit 1' sys.exit(1) list.sort() list.reverse() for mtime, file in list: args.append(file) return args def getmtime(file): try: st = os.stat(file) return st[ST_MTIME] except os.error: return -1 badnames = ['tags', 'TAGS', 'xyzzy', 'nohup.out', 'core'] badprefixes = ['.', ',', '@', '#', 'o.'] badsuffixes = \ ['~', '.a', '.o', '.old', '.bak', '.orig', '.new', '.prev', '.not', \ '.pyc', '.fdc', '.rgb', '.elc', ',v'] ignore = [] def setup(): ignore[:] = badnames for p in badprefixes: ignore.append(p + '*') for p in badsuffixes: ignore.append('*' + p) try: f = open('.xxcign', 'r') except IOError: return ignore[:] = ignore + f.read().split() def skipfile(file): for p in ignore: if fnmatch.fnmatch(file, p): return 1 try: st = os.lstat(file) except os.error: return 1 # Doesn't exist -- skip it # Skip non-plain files. if not S_ISREG(st[ST_MODE]): return 1 # Skip huge files -- probably binaries. if st[ST_SIZE] >= MAXSIZE: return 1 # Skip executables try: data = open(file, 'r').read(len(EXECMAGIC)) if data == EXECMAGIC: return 1 except: pass return 0 def badprefix(file): for bad in badprefixes: if file[:len(bad)] == bad: return 1 return 0 def badsuffix(file): for bad in badsuffixes: if file[-len(bad):] == bad: return 1 return 0 def go(args): for file in args: print file + ':' if differing(file): showdiffs(file) if askyesno('Check in ' + file + ' ? '): sts = os.system('rcs -l ' + file) # ignored sts = os.system('ci -l ' + file) def differing(file): cmd = 'co -p ' + file + ' 2>/dev/null | cmp -s - ' + file sts = os.system(cmd) return sts != 0 def showdiffs(file): cmd = 'rcsdiff ' + file + ' 2>&1 | ${PAGER-more}' sts = os.system(cmd) def askyesno(prompt): s = raw_input(prompt) return s in ['y', 'yes'] if __name__ == '__main__': try: setup() go(getargs()) except KeyboardInterrupt: print '[Intr]' PK!FK dutree.pyonu[ fc@sbddlZddlZddlZdZdZdZdZedkr^endS(iNc Csgtjddjtjdd}di}}x|jD]}d}x||dkrl|d}qOWt|| }x||dkr|d}qW||d!}|jd }|dd krd |ds $    PK!@@ classfix.pynuȯ#! /usr/bin/python2.7 # This script is obsolete -- it is kept for historical purposes only. # # Fix Python source files to use the new class definition syntax, i.e., # the syntax used in Python versions before 0.9.8: # class C() = base(), base(), ...: ... # is changed to the current syntax: # class C(base, base, ...): ... # # The script uses heuristics to find class definitions that usually # work but occasionally can fail; carefully check the output! # # Command line arguments are files or directories to be processed. # Directories are searched recursively for files whose name looks # like a python module. # Symbolic links are always ignored (except as explicit directory # arguments). Of course, the original file is kept as a back-up # (with a "~" attached to its name). # # Changes made are reported to stdout in a diff-like format. # # Undoubtedly you can do this using find and sed or perl, but this is # a nice example of Python code that recurses down a directory tree # and uses regular expressions. Also note several subtleties like # preserving the file's mode and avoiding to even write a temp file # when no changes are needed for a file. # # NB: by changing only the function fixline() you can turn this # into a program for a different change to Python programs... import sys import re import os from stat import * err = sys.stderr.write dbg = err rep = sys.stdout.write def main(): bad = 0 if not sys.argv[1:]: # No arguments err('usage: ' + sys.argv[0] + ' file-or-directory ...\n') sys.exit(2) for arg in sys.argv[1:]: if os.path.isdir(arg): if recursedown(arg): bad = 1 elif os.path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad) ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$') def ispython(name): return ispythonprog.match(name) >= 0 def recursedown(dirname): dbg('recursedown(%r)\n' % (dirname,)) bad = 0 try: names = os.listdir(dirname) except os.error, msg: err('%s: cannot list directory: %r\n' % (dirname, msg)) return 1 names.sort() subdirs = [] for name in names: if name in (os.curdir, os.pardir): continue fullname = os.path.join(dirname, name) if os.path.islink(fullname): pass elif os.path.isdir(fullname): subdirs.append(fullname) elif ispython(name): if fix(fullname): bad = 1 for fullname in subdirs: if recursedown(fullname): bad = 1 return bad def fix(filename): ## dbg('fix(%r)\n' % (filename,)) try: f = open(filename, 'r') except IOError, msg: err('%s: cannot open: %r\n' % (filename, msg)) return 1 head, tail = os.path.split(filename) tempname = os.path.join(head, '@' + tail) g = None # If we find a match, we rewind the file and start over but # now copy everything to a temp file. lineno = 0 while 1: line = f.readline() if not line: break lineno = lineno + 1 while line[-2:] == '\\\n': nextline = f.readline() if not nextline: break line = line + nextline lineno = lineno + 1 newline = fixline(line) if newline != line: if g is None: try: g = open(tempname, 'w') except IOError, msg: f.close() err('%s: cannot create: %r\n' % (tempname, msg)) return 1 f.seek(0) lineno = 0 rep(filename + ':\n') continue # restart from the beginning rep(repr(lineno) + '\n') rep('< ' + line) rep('> ' + newline) if g is not None: g.write(newline) # End of file f.close() if not g: return 0 # No changes # Finishing touch -- move files # First copy the file's mode to the temp file try: statbuf = os.stat(filename) os.chmod(tempname, statbuf[ST_MODE] & 07777) except os.error, msg: err('%s: warning: chmod failed (%r)\n' % (tempname, msg)) # Then make a backup of the original file as filename~ try: os.rename(filename, filename + '~') except os.error, msg: err('%s: warning: backup failed (%r)\n' % (filename, msg)) # Now move the temp file to the original file try: os.rename(tempname, filename) except os.error, msg: err('%s: rename failed (%r)\n' % (filename, msg)) return 1 # Return succes return 0 # This expression doesn't catch *all* class definition headers, # but it's pretty darn close. classexpr = '^([ \t]*class +[a-zA-Z0-9_]+) *( *) *((=.*)?):' classprog = re.compile(classexpr) # Expressions for finding base class expressions. baseexpr = '^ *(.*) *( *) *$' baseprog = re.compile(baseexpr) def fixline(line): if classprog.match(line) < 0: # No 'class' keyword -- no change return line (a0, b0), (a1, b1), (a2, b2) = classprog.regs[:3] # a0, b0 = Whole match (up to ':') # a1, b1 = First subexpression (up to classname) # a2, b2 = Second subexpression (=.*) head = line[:b1] tail = line[b0:] # Unmatched rest of line if a2 == b2: # No base classes -- easy case return head + ':' + tail # Get rid of leading '=' basepart = line[a2+1:b2] # Extract list of base expressions bases = basepart.split(',') # Strip trailing '()' from each base expression for i in range(len(bases)): if baseprog.match(bases[i]) >= 0: x1, y1 = baseprog.regs[1] bases[i] = bases[i][x1:y1] # Join the bases back again and build the new line basepart = ', '.join(bases) return head + '(' + basepart + '):' + tail if __name__ == '__main__': main() PK!/ pathfix.pynuȯ#! /usr/bin/python2.7 # Change the #! line occurring in Python scripts. The new interpreter # pathname must be given with a -i option. # # Command line arguments are files or directories to be processed. # Directories are searched recursively for files whose name looks # like a python module. # Symbolic links are always ignored (except as explicit directory # arguments). Of course, the original file is kept as a back-up # (with a "~" attached to its name). # # Undoubtedly you can do this using find and sed or perl, but this is # a nice example of Python code that recurses down a directory tree # and uses regular expressions. Also note several subtleties like # preserving the file's mode and avoiding to even write a temp file # when no changes are needed for a file. # # NB: by changing only the function fixfile() you can turn this # into a program for a different change to Python programs... import sys import re import os from stat import * import getopt err = sys.stderr.write dbg = err rep = sys.stdout.write new_interpreter = None def main(): global new_interpreter usage = ('usage: %s -i /interpreter file-or-directory ...\n' % sys.argv[0]) try: opts, args = getopt.getopt(sys.argv[1:], 'i:') except getopt.error, msg: err(msg + '\n') err(usage) sys.exit(2) for o, a in opts: if o == '-i': new_interpreter = a if not new_interpreter or new_interpreter[0] != '/' or not args: err('-i option or file-or-directory missing\n') err(usage) sys.exit(2) bad = 0 for arg in args: if os.path.isdir(arg): if recursedown(arg): bad = 1 elif os.path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad) ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$') def ispython(name): return ispythonprog.match(name) >= 0 def recursedown(dirname): dbg('recursedown(%r)\n' % (dirname,)) bad = 0 try: names = os.listdir(dirname) except os.error, msg: err('%s: cannot list directory: %r\n' % (dirname, msg)) return 1 names.sort() subdirs = [] for name in names: if name in (os.curdir, os.pardir): continue fullname = os.path.join(dirname, name) if os.path.islink(fullname): pass elif os.path.isdir(fullname): subdirs.append(fullname) elif ispython(name): if fix(fullname): bad = 1 for fullname in subdirs: if recursedown(fullname): bad = 1 return bad def fix(filename): ## dbg('fix(%r)\n' % (filename,)) try: f = open(filename, 'r') except IOError, msg: err('%s: cannot open: %r\n' % (filename, msg)) return 1 line = f.readline() fixed = fixline(line) if line == fixed: rep(filename+': no change\n') f.close() return head, tail = os.path.split(filename) tempname = os.path.join(head, '@' + tail) try: g = open(tempname, 'w') except IOError, msg: f.close() err('%s: cannot create: %r\n' % (tempname, msg)) return 1 rep(filename + ': updating\n') g.write(fixed) BUFSIZE = 8*1024 while 1: buf = f.read(BUFSIZE) if not buf: break g.write(buf) g.close() f.close() # Finishing touch -- move files # First copy the file's mode to the temp file try: statbuf = os.stat(filename) os.chmod(tempname, statbuf[ST_MODE] & 07777) except os.error, msg: err('%s: warning: chmod failed (%r)\n' % (tempname, msg)) # Then make a backup of the original file as filename~ try: os.rename(filename, filename + '~') except os.error, msg: err('%s: warning: backup failed (%r)\n' % (filename, msg)) # Now move the temp file to the original file try: os.rename(tempname, filename) except os.error, msg: err('%s: rename failed (%r)\n' % (filename, msg)) return 1 # Return success return 0 def fixline(line): if not line.startswith('#!'): return line if "python" not in line: return line return '#! %s\n' % new_interpreter if __name__ == '__main__': main() PK!FK dutree.pycnu[ fc@sbddlZddlZddlZdZdZdZdZedkr^endS(iNc Csgtjddjtjdd}di}}x|jD]}d}x||dkrl|d}qOWt|| }x||dkr|d}qW||d!}|jd }|dd krd |ds $    PK!Bpplfcr.pycnu[ fc@sMdZddlZddlZddlZdZedkrIendS(sFReplace LF with CRLF in argument files. Print names of changed files.iNcCsxtjdD]}tjj|r5|GdGHqnt|dj}d|kre|GdGHqntjdd|}||kr|GHt|d}|j ||j qqWdS( Nis Directory!trbssBinary!s ? s twb( tsystargvtostpathtisdirtopentreadtretsubtwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pytmains     t__main__(t__doc__RR RRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/lfcr.pyts$  PK!qsuff.pycnu[ fc@s8ddlZdZdZedkr4endS(iNcCstjd}i}xG|D]?}t|}|j|sHg||s   PK! redemo.pycnu[ fc@sRdZddlTddlZdddYZdZedkrNendS( sDBasic regular expression demonstration facility (Perl style syntax).i(t*NtReDemocBs;eZdZdZdZddZddZRS(c Cs||_t|jdtdd|_|jjdtdtt|j|_|jjdt|jj |j t|jdddt|_ |j jdtdtt|jdtdd|_ |j jdt|j jdtt ||_|jjdtdtt||_|jjdt|jdd d |jd dd |j|_|jjdtt|jdd d |jd dd |j|_|jjdtt|jdddd|_|jjdtdd|jjdddt|jdddt|_|jjdtt|j|_|jjdddt|jjd|j|jjd|jd|_!|j|jj"}|jj"|d|d |jj"}|jj"|d|d dS(Ntanchorttexts&Enter a Perl-style regular expression:tsidetfilltsEnter a string to search:tfirstsHighlight first matchtvariabletvaluetcommandsHighlight all matchestalltwidthi<theightitexpandithitt backgroundtyellowsGroups:s(#tmastertLabeltWt promptdisplaytpacktTOPtXtEntryt regexdisplayt focus_sett addoptionst statusdisplayt labeldisplaytFramet showframet StringVartshowvartsett Radiobuttont recompiletshowfirstradiotLEFTt showallradiotTextt stringdisplaytBOTHt tag_configuret grouplabeltListboxt grouplisttbindt reevaluatetNonetcompiledtbindtags(tselfRtbtags((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyt__init__ sZ           c Csg|_g|_g|_xdD]}t|jddkrst|j}|jdt|jj|nt t |}t }t |d |d |d dd |d |j }|jdt|jj||jj|q"WdS(Nt IGNORECASEtLOCALEt MULTILINEtDOTALLtVERBOSEiiRRRtoffvaluetonvalueR R(R8R9R:R;R<(tframestboxestvarstlenRRRRtappendtgetattrtretIntVart CheckbuttonR%R'(R5tnametframetvaltvartbox((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyRHs*         cCs4d}x!|jD]}||jB}qW|}|S(Ni(RAtget(R5tflagsRK((s,/usr/lib64/python2.7/Tools/scripts/redemo.pytgetflags_s cCsyNtj|jj|j|_|jd}|jjddd|WnBtj k r}d|_|jjddt |ddnX|j dS(NRRRs re.error: %stred( REtcompileRRMROR3RRtconfigterrorR2tstrR1(R5teventtbgtmsg((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyR%fs    c CsUy|jjddtWntk r-nXy|jjddtWntk r[nX|jjdt|js|dS|jjddd|jjddd|jjdt}d}d}xJ|t |kr|jj ||}|dkrPn|j \}}||kr4|d}d}nd}d |}d |} |jj ||| |dkr|jj|t|j} | jd|jxDtt | D]-} d | | | f} |jjt| qWn|d}|jjd krPqqW|dkr>|jjd d ddn|jjd ddS(NRs1.0thit0iRRtorangeis1.0 + %d charss%2d: %rRRs (no match)R(R*t tag_removetENDtTclErrorR/tdeleteR3R,RMRBtsearchR2tspanttag_addtyview_pickplacetlisttgroupstinserttgrouptrangeR"RRR( R5RURtlasttnmatchestmRttagtpfirsttplastRctitg((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyR1ssT             N(t__name__t __module__R7RROR2R%R1(((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyRs  ?   cCs6t}t|}|jd|j|jdS(NtWM_DELETE_WINDOW(tTkRtprotocoltquittmainloop(troottdemo((s,/usr/lib64/python2.7/Tools/scripts/redemo.pytmains  t__main__((t__doc__tTkinterRERRxRo(((s,/usr/lib64/python2.7/Tools/scripts/redemo.pyts     PK!sss cvsfiles.pycnu[ fc@sqdZddlZddlZddlZddlZdadZdZdZe dkrmendS(sDPrint a list of files that are mentioned in CVS directories. Usage: cvsfiles.py [-n file] [directory] ... If the '-n file' option is given, only files under CVS that are newer than the given file are printed; by default, all files under CVS are printed. As a special case, if a file does not exist, it is always printed. iNicCsy#tjtjdd\}}Wn tjk rE}|GHtGdSXd}x/|D]'\}}|dkrSt|aqSqSW|rx%|D]}t|qWn tddS(Nisn:s-nt.( tgetopttsystargvterrort__doc__tNonetgetmtimet cutofftimetprocess(toptstargstmsgt newerfiletotatarg((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pytmains#  c CsRd}g}tj|}xo|D]g}tjj||}|dkrR|}q"tjj|r"tjj|s|j|qq"q"W|r3tjj|d}xt|jD]q}|j d}|ddkr|dr|d}tjj||}t r$t |t kr$q,|GHqqWnx|D]} t | q:WdS(NitCVStEntriest/ti( tostlistdirtpathtjointisdirtislinktappendtopent readlinestsplitRRR ( tdirtcvsdirtsubdirstnamestnametfullnametentriestetwordstsub((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR &s,     cCs6ytj|}Wntjk r*dSX|tjS(Ni(RtstatRtST_MTIME(tfilenametst((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyR@s t__main__( RRRR*RRRR Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/cvsfiles.pyt s        PK!TFm logmerge.pyonu[ fc@sdZddlZddlZddlZddlZdddZdddZdZd Zdd Z d Z e d kry eWqe k rZejejkrqqXndS( sConsolidate a bunch of CVS or RCS logs read from stdin. Input should be the output of a CVS or RCS logging command, e.g. cvs log -rrelease14: which dumps all log messages from release1.4 upwards (assuming that release 1.4 was tagged with tag 'release14'). Note the trailing colon! This collects all the revision records and outputs them sorted by date rather than by file, collapsing duplicate revision record, i.e., records with the same message for different files. The -t option causes it to truncate (discard) the last revision log entry; this is useful when using something like the above cvs log command, which shows the revisions including the given tag, while you probably want everything *since* that tag. The -r option reverses the output (oldest first; the default is oldest last). The -b tag option restricts the output to *only* checkin messages belonging to the given branch tag. The form -b HEAD restricts the output to checkin messages belonging to the CVS head (trunk). (It produces some output if tag is a non-branch tag, but this output is not very useful.) -h prints this message and exits. XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7 from their output. iNt=iMs t-ic Cs(d}d}d }tjtjdd\}}xt|D]l\}}|dkrYd}q8|dkrnd}q8|dkr|}q8|dkr8tGHtjdq8q8Wg}xLttj}|sPnt||} |r| d=n| |t |)qW|j |s|j nt |d S( s Main programiistrb:hs-ts-rs-bs-hiN( tNonetgetopttsystargvt__doc__texitt read_chunktstdint digest_chunktlentsorttreverset format_output( t truncate_lastR tbranchtoptstargstotatdatabasetchunktrecords((s./usr/lib64/python2.7/Tools/scripts/logmerge.pytmain*s6          cCsg}g}xx|j}|s%Pn|tkrK|rG|j|nPn|tkrv|r|j|g}qq|j|qW|S(skRead a chunk -- data for one file, ending with sep1. Split the chunk in parts separated by sep2. (treadlinetsep1tappendtsep2(tfpRtlinestline((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRHs      cCs5|d}d}t|}x8|D]*}|| |kr#||j}Pq#q#Wd}|dkrfn"|dkrtjd}ni}d}d}x~|D]v}||krd}q|r|ddkr |j\} } | dd kr| d } n| || $s.0.t.t^s\.\d+$iisdate:t;t isauthor:itrevisionN( R tstripRtretcompiletsplittgettfindtreplacetescapetinserttmatchR(RRRtkeytkeylenRt working_filet revisionstfoundttagtrevRtrevlinetdatelinettexttwordstauthortdatewordttimewordtdate((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyR `sx           &    "   "  "   c Csd}g}|jdx|D]\}}}}}||kr|rtGx+|D]#\}} } } |G| G| G| GHqRWtjj|ng}n|j||||f|}q WdS(N(NNNNN(RRRRtstdoutt writelines( RtprevtexttprevR?R3R7R<R:tp_datetp_working_filetp_revtp_author((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRs   t__main__(RRterrnoRR(RRRRRR Rt__name__tIOErrortetEPIPE(((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyt#s0   E   PK!($($ texcheck.pynu[""" TeXcheck.py -- rough syntax checking on Python style LaTeX documents. Written by Raymond D. Hettinger Copyright (c) 2003 Python Software Foundation. All rights reserved. Designed to catch common markup errors including: * Unbalanced or mismatched parenthesis, brackets, and braces. * Unbalanced or mismatched \\begin and \\end blocks. * Misspelled or invalid LaTeX commands. * Use of forward slashes instead of backslashes for commands. * Table line size mismatches. Sample command line usage: python texcheck.py -k chapterheading -m lib/librandomtex *.tex Options: -m Munge parenthesis and brackets. [0,n) would normally mismatch. -k keyword: Keyword is a valid LaTeX command. Do not include the backslash. -d: Delimiter check only (useful for non-LaTeX files). -h: Help -s lineno: Start at lineno (useful for skipping complex sections). -v: Verbose. Trace the matching of //begin and //end blocks. """ import re import sys import getopt from itertools import izip, count, islice import glob cmdstr = r""" \section \module \declaremodule \modulesynopsis \moduleauthor \sectionauthor \versionadded \code \class \method \begin \optional \var \ref \end \subsection \lineiii \hline \label \indexii \textrm \ldots \keyword \stindex \index \item \note \withsubitem \ttindex \footnote \citetitle \samp \opindex \noindent \exception \strong \dfn \ctype \obindex \character \indexiii \function \bifuncindex \refmodule \refbimodindex \subsubsection \nodename \member \chapter \emph \ASCII \UNIX \regexp \program \production \token \productioncont \term \grammartoken \lineii \seemodule \file \EOF \documentclass \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp \tableofcontents \kbd \programopt \envvar \refstmodindex \cfunction \constant \NULL \moreargs \cfuncline \cdata \textasciicircum \n \ABC \setindexsubitem \versionchanged \deprecated \seetext \newcommand \POSIX \pep \warning \rfc \verbatiminput \methodline \textgreater \seetitle \lineiv \funclineni \ulink \manpage \funcline \dataline \unspecified \textbackslash \mimetype \mailheader \seepep \textunderscore \longprogramopt \infinity \plusminus \shortversion \version \refmodindex \seerfc \makeindex \makemodindex \renewcommand \indexname \appendix \protect \indexiv \mbox \textasciitilde \platform \seeurl \leftmargin \labelwidth \localmoduletable \LaTeX \copyright \memberline \backslash \pi \centerline \caption \vspace \textwidth \menuselection \textless \makevar \csimplemacro \menuselection \bfcode \sub \release \email \kwindex \refexmodindex \filenq \e \menuselection \exindex \linev \newsgroup \verbatim \setshortversion \author \authoraddress \paragraph \subparagraph \cmemberline \textbar \C \seelink """ def matchclose(c_lineno, c_symbol, openers, pairmap): "Verify that closing delimiter matches most recent opening delimiter" try: o_lineno, o_symbol = openers.pop() except IndexError: print "\nDelimiter mismatch. On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol) return if o_symbol in pairmap.get(c_symbol, [c_symbol]): return print "\nOpener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno) return def checkit(source, opts, morecmds=[]): """Check the LaTeX formatting in a sequence of lines. Opts is a mapping of options to option values if any: -m munge parenthesis and brackets -d delimiters only checking -v verbose trace of delimiter matching -s lineno: linenumber to start scan (default is 1). Morecmds is a sequence of LaTeX commands (without backslashes) that are to be considered valid in the scan. """ texcmd = re.compile(r'\\[A-Za-z]+') falsetexcmd = re.compile(r'\/([A-Za-z]+)') # Mismarked with forward slash validcmds = set(cmdstr.split()) for cmd in morecmds: validcmds.add('\\' + cmd) if '-m' in opts: pairmap = {']':'[(', ')':'(['} # Munged openers else: pairmap = {']':'[', ')':'('} # Normal opener for a given closer openpunct = set('([') # Set of valid openers delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') braces = re.compile(r'({)|(})') doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b') spacingmarkup = re.compile(r'\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\s') openers = [] # Stack of pending open delimiters bracestack = [] # Stack of pending open braces tablestart = re.compile(r'\\begin{(?:long)?table([iv]+)}') tableline = re.compile(r'\\line([iv]+){') tableend = re.compile(r'\\end{(?:long)?table([iv]+)}') tablelevel = '' tablestartline = 0 startline = int(opts.get('-s', '1')) lineno = 0 for lineno, line in izip(count(startline), islice(source, startline-1, None)): line = line.rstrip() # Check balancing of open/close parenthesis, brackets, and begin/end blocks for begend, name, punct in delimiters.findall(line): if '-v' in opts: print lineno, '|', begend, name, punct, if begend == 'begin' and '-d' not in opts: openers.append((lineno, name)) elif punct in openpunct: openers.append((lineno, punct)) elif begend == 'end' and '-d' not in opts: matchclose(lineno, name, openers, pairmap) elif punct in pairmap: matchclose(lineno, punct, openers, pairmap) if '-v' in opts: print ' --> ', openers # Balance opening and closing braces for open, close in braces.findall(line): if open == '{': bracestack.append(lineno) if close == '}': try: bracestack.pop() except IndexError: print r'Warning, unmatched } on line %s.' % (lineno,) # Optionally, skip LaTeX specific checks if '-d' in opts: continue # Warn whenever forward slashes encountered with a LaTeX command for cmd in falsetexcmd.findall(line): if '822' in line or '.html' in line: continue # Ignore false positives for urls and for /rfc822 if '\\' + cmd in validcmds: print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd) # Check for markup requiring {} for correct spacing for cmd in spacingmarkup.findall(line): print r'Warning, \%s should be written as \%s{} on line %d' % (cmd, cmd, lineno) # Validate commands nc = line.find(r'\newcommand') if nc != -1: start = line.find('{', nc) end = line.find('}', start) validcmds.add(line[start+1:end]) for cmd in texcmd.findall(line): if cmd not in validcmds: print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd) # Check table levels (make sure lineii only inside tableii) m = tablestart.search(line) if m: tablelevel = m.group(1) tablestartline = lineno m = tableline.search(line) if m and m.group(1) != tablelevel: print r'Warning, \line%s on line %d does not match \table%s on line %d' % (m.group(1), lineno, tablelevel, tablestartline) if tableend.search(line): tablelevel = '' # Style guide warnings if 'e.g.' in line or 'i.e.' in line: print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,) for dw in doubledwords.findall(line): print r'Doubled word warning. "%s" on line %d' % (dw, lineno) lastline = lineno for lineno, symbol in openers: print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno) for lineno in bracestack: print "Unmatched { on line %d" % (lineno,) print 'Done checking %d lines.' % (lastline,) return 0 def main(args=None): if args is None: args = sys.argv[1:] optitems, arglist = getopt.getopt(args, "k:mdhs:v") opts = dict(optitems) if '-h' in opts or args==[]: print __doc__ return 0 if len(arglist) < 1: print 'Please specify a file to be checked' return 1 for i, filespec in enumerate(arglist): if '*' in filespec or '?' in filespec: arglist[i:i+1] = glob.glob(filespec) morecmds = [v for k,v in optitems if k=='-k'] err = [] for filename in arglist: print '=' * 30 print "Checking", filename try: f = open(filename) except IOError: print 'Cannot open file %s.' % arglist[0] return 2 try: err.append(checkit(f, opts, morecmds)) finally: f.close() return max(err) if __name__ == '__main__': sys.exit(main()) PK!((TT eptags.pycnu[ fc@s_dZddlZddlZdZejeZdZdZedkr[endS(sCreate a TAGS file for Python programs, usable with GNU Emacs. usage: eptags pyfiles... The output TAGS file is usable with Emacs version 18, 19, 20. Tagged are: - functions (even inside other defs or classes) - classes eptags warns about files it cannot open. eptags will not give warnings about duplicate tags. BUGS: Because of tag duplication (methods with the same name in different classes), TAGS files are not very useful for most object-oriented python projects. iNs;^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]c Cs yt|d}Wntjjd|dSXd}d}g}d}x|j}|scPn|d}tj|}|r|jdd||f} |j| |t | }n|t |}qMW|jd||fx|D]} |j| qWdS(sCAppend tags found in file named 'filename' to the open file 'outfp'trsCannot open %s Niis%d,%d s %s,%d ( topentsyststderrtwritetreadlinetmatchertsearchtgrouptappendtlen( tfilenametoutfptfptcharnotlinenottagstsizetlinetmttag((s,/usr/lib64/python2.7/Tools/scripts/eptags.pyt treat_files.    cCs8tdd}x"tjdD]}t||qWdS(NtTAGStwi(RRtargvR(R R ((s,/usr/lib64/python2.7/Tools/scripts/eptags.pytmain2st__main__( t__doc__RtretexprtcompileRRRt__name__(((s,/usr/lib64/python2.7/Tools/scripts/eptags.pyts   PK!CxWWcrlf.pyonu[ fc@sAdZddlZddlZdZedkr=endS(sFReplace CRLF with LF in argument files. Print names of changed files.iNcCsxtjdD]}tjj|r5|GdGHqnt|dj}d|kre|GdGHqn|jdd}||kr|GHt|d}|j||j qqWdS( Nis Directory!trbssBinary!s s twb( tsystargvtostpathtisdirtopentreadtreplacetwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/crlf.pytmains     t__main__(t__doc__RRRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/crlf.pyts  PK!r[u find_recursionlimit.pynuȯ#! /usr/bin/python2.7 """Find the maximum recursion limit that prevents interpreter termination. This script finds the maximum safe recursion limit on a particular platform. If you need to change the recursion limit on your system, this script will tell you a safe upper bound. To use the new limit, call sys.setrecursionlimit(). This module implements several ways to create infinite recursion in Python. Different implementations end up pushing different numbers of C stack frames, depending on how many calls through Python's abstract C API occur. After each round of tests, it prints a message: "Limit of NNNN is fine". The highest printed value of "NNNN" is therefore the highest potentially safe limit for your system (which depends on the OS, architecture, but also the compilation flags). Please note that it is practically impossible to test all possible recursion paths in the interpreter, so the results of this test should not be trusted blindly -- although they give a good hint of which values are reasonable. NOTE: When the C stack space allocated by your system is exceeded due to excessive recursion, exact behaviour depends on the platform, although the interpreter will always fail in a likely brutal way: either a segmentation fault, a MemoryError, or just a silent abort. NB: A program that does not use __methods__ can set a higher limit. """ import sys import itertools class RecursiveBlowup1: def __init__(self): self.__init__() def test_init(): return RecursiveBlowup1() class RecursiveBlowup2: def __repr__(self): return repr(self) def test_repr(): return repr(RecursiveBlowup2()) class RecursiveBlowup4: def __add__(self, x): return x + self def test_add(): return RecursiveBlowup4() + RecursiveBlowup4() class RecursiveBlowup5: def __getattr__(self, attr): return getattr(self, attr) def test_getattr(): return RecursiveBlowup5().attr class RecursiveBlowup6: def __getitem__(self, item): return self[item - 2] + self[item - 1] def test_getitem(): return RecursiveBlowup6()[5] def test_recurse(): return test_recurse() def test_cpickle(_cache={}): try: import cPickle except ImportError: print "cannot import cPickle, skipped!" return l = None for n in itertools.count(): try: l = _cache[n] continue # Already tried and it works, let's save some time except KeyError: for i in range(100): l = [l] cPickle.dumps(l, protocol=-1) _cache[n] = l def check_limit(n, test_func_name): sys.setrecursionlimit(n) if test_func_name.startswith("test_"): print test_func_name[5:] else: print test_func_name test_func = globals()[test_func_name] try: test_func() # AttributeError can be raised because of the way e.g. PyDict_GetItem() # silences all exceptions and returns NULL, which is usually interpreted # as "missing attribute". except (RuntimeError, AttributeError): pass else: print "Yikes!" limit = 1000 while 1: check_limit(limit, "test_recurse") check_limit(limit, "test_add") check_limit(limit, "test_repr") check_limit(limit, "test_init") check_limit(limit, "test_getattr") check_limit(limit, "test_getitem") check_limit(limit, "test_cpickle") print "Limit of %d is fine" % limit limit = limit + 100 PK!]KgAAh2py.pynuȯ#! /usr/bin/python2.7 # Read #define's and translate to Python code. # Handle #include statements. # Handle #define macros with one argument. # Anything that isn't recognized or doesn't translate into valid # Python is ignored. # Without filename arguments, acts as a filter. # If one or more filenames are given, output is written to corresponding # filenames in the local directory, translated to all uppercase, with # the extension replaced by ".py". # By passing one or more options of the form "-i regular_expression" # you can specify additional strings to be ignored. This is useful # e.g. to ignore casts to u_long: simply specify "-i '(u_long)'". # XXX To do: # - turn trailing C comments into Python comments # - turn C Boolean operators "&& || !" into Python "and or not" # - what to do about #if(def)? # - what to do about macros with multiple parameters? import sys, re, getopt, os p_define = re.compile('^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+') p_macro = re.compile( '^[\t ]*#[\t ]*define[\t ]+' '([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+') p_include = re.compile('^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>') p_comment = re.compile(r'/\*([^*]+|\*+[^/])*(\*+/)?') p_cpp_comment = re.compile('//.*') ignores = [p_comment, p_cpp_comment] p_char = re.compile(r"'(\\.[^\\]*|[^\\])'") p_hex = re.compile(r"0x([0-9a-fA-F]+)L?") filedict = {} importable = {} try: searchdirs=os.environ['include'].split(';') except KeyError: try: searchdirs=os.environ['INCLUDE'].split(';') except KeyError: try: if sys.platform.find("beos") == 0: searchdirs=os.environ['BEINCLUDES'].split(';') elif sys.platform.startswith("atheos"): searchdirs=os.environ['C_INCLUDE_PATH'].split(':') else: raise KeyError except KeyError: searchdirs=['/usr/include'] try: searchdirs.insert(0, os.path.join('/usr/include', os.environ['MULTIARCH'])) except KeyError: pass def main(): global filedict opts, args = getopt.getopt(sys.argv[1:], 'i:') for o, a in opts: if o == '-i': ignores.append(re.compile(a)) if not args: args = ['-'] for filename in args: if filename == '-': sys.stdout.write('# Generated by h2py from stdin\n') process(sys.stdin, sys.stdout) else: fp = open(filename, 'r') outfile = os.path.basename(filename) i = outfile.rfind('.') if i > 0: outfile = outfile[:i] modname = outfile.upper() outfile = modname + '.py' outfp = open(outfile, 'w') outfp.write('# Generated by h2py from %s\n' % filename) filedict = {} for dir in searchdirs: if filename[:len(dir)] == dir: filedict[filename[len(dir)+1:]] = None # no '/' trailing importable[filename[len(dir)+1:]] = modname break process(fp, outfp) outfp.close() fp.close() def pytify(body): # replace ignored patterns by spaces for p in ignores: body = p.sub(' ', body) # replace char literals by ord(...) body = p_char.sub("ord('\\1')", body) # Compute negative hexadecimal constants start = 0 UMAX = 2*(sys.maxint+1) while 1: m = p_hex.search(body, start) if not m: break s,e = m.span() val = long(body[slice(*m.span(1))], 16) if val > sys.maxint: val -= UMAX body = body[:s] + "(" + str(val) + ")" + body[e:] start = s + 1 return body def process(fp, outfp, env = {}): lineno = 0 while 1: line = fp.readline() if not line: break lineno = lineno + 1 match = p_define.match(line) if match: # gobble up continuation lines while line[-2:] == '\\\n': nextline = fp.readline() if not nextline: break lineno = lineno + 1 line = line + nextline name = match.group(1) body = line[match.end():] body = pytify(body) ok = 0 stmt = '%s = %s\n' % (name, body.strip()) try: exec stmt in env except: sys.stderr.write('Skipping: %s' % stmt) else: outfp.write(stmt) match = p_macro.match(line) if match: macro, arg = match.group(1, 2) body = line[match.end():] body = pytify(body) stmt = 'def %s(%s): return %s\n' % (macro, arg, body) try: exec stmt in env except: sys.stderr.write('Skipping: %s' % stmt) else: outfp.write(stmt) match = p_include.match(line) if match: regs = match.regs a, b = regs[1] filename = line[a:b] if importable.has_key(filename): outfp.write('from %s import *\n' % importable[filename]) elif not filedict.has_key(filename): filedict[filename] = None inclfp = None for dir in searchdirs: try: inclfp = open(dir + '/' + filename) break except IOError: pass if inclfp: outfp.write( '\n# Included from %s\n' % filename) process(inclfp, outfp, env) else: sys.stderr.write('Warning - could not find file %s\n' % filename) if __name__ == '__main__': main() PK! gprof2html.pycnu[ fc@szdZddlZddlZddlZddlZddlZdZdZdZdZ e dkrve ndS(s+Transform gprof(1) output into useful HTML.iNsF gprof output (%s)
        s
        ccs#x|D]}tj|VqWdS(N(tcgitescape(tinputtline((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pyt add_escapess c Csd}tjdr#tjd}n|d}tt|}t|d}|jt|x.|D]&}|j||jdrfPqfqfWi}xv|D]n}tjd|}|s|j|Pn|j dd\}}|||<|jd||||fqWx.|D]&}|j||jd rPqqWx|D]}tjd |}|s|j||jd rGPqGqGn|j ddd \} }} ||kr|j|qGn|jd r|jd| |||| fqG|jd| ||| fqGWxW|D]O}xFtj d|D]2} | |kr`d| | f} n|j| q;Wq"W|jt |j t jdtjj|dS(Ns gprof.outis.htmltws times (.* )(\w+)\nis+%s%s s index % times*(.* )(\w+)(( <cycle.*>)? \[\d+\])\nsIndex by function nameit[s-%s%s%s s%s%s%s s(\w+(?:\.c)?|\W+)s%ssfile:(tsystargvRtfiletwritetheadert startswithtretmatchtgrouptfindallttrailertcloset webbrowsertopentostpathtabspath( tfilenametoutputfilenameRtoutputRtlabelstmtstufftfnametprefixtsuffixtpart((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pytmainsb                    t__main__( t__doc__R RRRRR RRR"t__name__(((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pyts<   4 PK!p ifdef.pycnu[ fc@sPddlZddlZgZgZdZdZedkrLendS(iNcCstjtjdd\}}xL|D]D\}}|dkrNtj|n|dkr&tj|q&q&W|sdg}nxY|D]Q}|dkrttjtjqt |d}t|tj|j qWdS(NisD:U:s-Ds-Ut-tr( tgetopttsystargvtdefstappendtundefstprocesststdintstdouttopentclose(toptstargstotatfilenametf((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pytmain#s     cCs d}d}g}x|j}|s+Pnx4|ddkra|j}|sTPn||}q.W|j}|d d kr|r|j|qqn|dj}|j}|d } | |kr|r|j|qqn| dkrt|d kr| dkrd} nd } |d} | tkr_|j|| | f| sd }qq| tkr|j|| | f| rd }qq|j|d | f|r|j|qq| dkr|j|d d f|r|j|qq| dkrz|rz|d \} } }| d krH|rw|j|qwq| } | }| sdd }n| | |f|d s    ; PK!1 mkreal.pyonu[ fc@soddlZddlZddlTejjZdZd ZdZdZdZ e d krke ndS( iN(t*s mkreal errori icCstj|}t|t}tj|}t|d}tj|t|d}x*|jt}|suPn|j |q\W~tj ||dS(Ntrtw( toststattS_IMODEtST_MODEtreadlinktopentunlinktreadtBUFSIZEtwritetchmod(tnametsttmodetlinktotf_intf_outtbuf((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt mkrealfiles cCstj|}t|t}tj|}tj|}tj|tj||tj||t tj |}xK|D]C}|tj tj fkrtj t ||t ||qqWdS(N( RRRRRtlistdirR tmkdirR tjointpardirtcurdirtsymlink(RRRRtfilestfilename((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyt mkrealdirs  cCstjt_tjjtjd}|dkr:d}ntjd}|sjdG|GdGHtjdnd}xg|D]_}tjj|s|dG|dGd GHd}qwtjj |rt |qwt |qwWtj|dS( Nis-ctmkrealisusage:spath ...it:s not a symlink( tsyststderrtstdoutRtpathtbasenametargvtexittislinktisdirRR(tprognametargststatusR((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pytmain-s"       t__main__i( R!RRR$RterrorR RRR-t__name__(((s,/usr/lib64/python2.7/Tools/scripts/mkreal.pyts        PK!Rparseentities.pyonu[ fc@sdZddlZddlZddlZejdZdddZdZe dkre ej dkre ej dZ n ejZ e ej d kre ej d d Zn ejZe jZeeZeeendS( s Utility for parsing HTML entity definitions available from: http://www.w3.org/ as e.g. http://www.w3.org/TR/REC-html40/HTMLlat1.ent Input is read from stdin, output is written to stdout in form of a Python snippet defining a dictionary "entitydefs" mapping literal entity name to character or numeric entity. Marc-Andre Lemburg, mal@lemburg.com, 1999. Use as you like. NO WARRANTIES. iNs7icCsd}|dkr!t|}ni}xTtj|||}|sIPn|j\}}}||f||<|j}q*W|S(Ni(tNonetlententityREtsearchtgroupstend(ttexttpostendpostdtmtnametcharcodetcomment((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pytparses cCs|jd|j}|jx|D]\}\}}|d dkrt|dd!}|dkrxd|}qt|}n t|}tj|}|jd|||fq*W|jddS( Nsentitydefs = { is&#iis'\%o's '%s': %s, # %s s } (twritetitemstsorttinttreprt TextToolstcollapse(tftdefsRR R R tcode((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyt writefile#s      t__main__iitw(t__doc__tretsysRtcompileRRRRt__name__RtargvtopentinfiletstdintoutfiletstdouttreadRR(((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyts       PK!H66 fixdiv.pynuȯ#! /usr/bin/python2.7 """fixdiv - tool to fix division operators. To use this tool, first run `python -Qwarnall yourscript.py 2>warnings'. This runs the script `yourscript.py' while writing warning messages about all uses of the classic division operator to the file `warnings'. The warnings look like this: :: DeprecationWarning: classic division The warnings are written to stderr, so you must use `2>' for the I/O redirect. I know of no way to redirect stderr on Windows in a DOS box, so you will have to modify the script to set sys.stderr to some kind of log file if you want to do this on Windows. The warnings are not limited to the script; modules imported by the script may also trigger warnings. In fact a useful technique is to write a test script specifically intended to exercise all code in a particular module or set of modules. Then run `python fixdiv.py warnings'. This first reads the warnings, looking for classic division warnings, and sorts them by file name and line number. Then, for each file that received at least one warning, it parses the file and tries to match the warnings up to the division operators found in the source code. If it is successful, it writes its findings to stdout, preceded by a line of dashes and a line of the form: Index: If the only findings found are suggestions to change a / operator into a // operator, the output is acceptable input for the Unix 'patch' program. Here are the possible messages on stdout (N stands for a line number): - A plain-diff-style change ('NcN', a line marked by '<', a line containing '---', and a line marked by '>'): A / operator was found that should be changed to //. This is the recommendation when only int and/or long arguments were seen. - 'True division / operator at line N' and a line marked by '=': A / operator was found that can remain unchanged. This is the recommendation when only float and/or complex arguments were seen. - 'Ambiguous / operator (..., ...) at line N', line marked by '?': A / operator was found for which int or long as well as float or complex arguments were seen. This is highly unlikely; if it occurs, you may have to restructure the code to keep the classic semantics, or maybe you don't care about the classic semantics. - 'No conclusive evidence on line N', line marked by '*': A / operator was found for which no warnings were seen. This could be code that was never executed, or code that was only executed with user-defined objects as arguments. You will have to investigate further. Note that // can be overloaded separately from /, using __floordiv__. True division can also be separately overloaded, using __truediv__. Classic division should be the same as either of those. (XXX should I add a warning for division on user-defined objects, to disambiguate this case from code that was never executed?) - 'Phantom ... warnings for line N', line marked by '*': A warning was seen for a line not containing a / operator. The most likely cause is a warning about code executed by 'exec' or eval() (see note below), or an indirect invocation of the / operator, for example via the div() function in the operator module. It could also be caused by a change to the file between the time the test script was run to collect warnings and the time fixdiv was run. - 'More than one / operator in line N'; or 'More than one / operator per statement in lines N-N': The scanner found more than one / operator on a single line, or in a statement split across multiple lines. Because the warnings framework doesn't (and can't) show the offset within the line, and the code generator doesn't always give the correct line number for operations in a multi-line statement, we can't be sure whether all operators in the statement were executed. To be on the safe side, by default a warning is issued about this case. In practice, these cases are usually safe, and the -m option suppresses these warning. - 'Can't find the / operator in line N', line marked by '*': This really shouldn't happen. It means that the tokenize module reported a '/' operator but the line it returns didn't contain a '/' character at the indicated position. - 'Bad warning for line N: XYZ', line marked by '*': This really shouldn't happen. It means that a 'classic XYZ division' warning was read with XYZ being something other than 'int', 'long', 'float', or 'complex'. Notes: - The augmented assignment operator /= is handled the same way as the / operator. - This tool never looks at the // operator; no warnings are ever generated for use of this operator. - This tool never looks at the / operator when a future division statement is in effect; no warnings are generated in this case, and because the tool only looks at files for which at least one classic division warning was seen, it will never look at files containing a future division statement. - Warnings may be issued for code not read from a file, but executed using an exec statement or the eval() function. These may have in the filename position, in which case the fixdiv script will attempt and fail to open a file named '' and issue a warning about this failure; or these may be reported as 'Phantom' warnings (see above). You're on your own to deal with these. You could make all recommended changes and add a future division statement to all affected files, and then re-run the test script; it should not issue any warnings. If there are any, and you have a hard time tracking down where they are generated, you can use the -Werror option to force an error instead of a first warning, generating a traceback. - The tool should be run from the same directory as that from which the original script was run, otherwise it won't be able to open files given by relative pathnames. """ import sys import getopt import re import tokenize multi_ok = 0 def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hm") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == "-h": print __doc__ return if o == "-m": global multi_ok multi_ok = 1 if not args: usage("at least one file argument is required") return 2 if args[1:]: sys.stderr.write("%s: extra file arguments ignored\n", sys.argv[0]) warnings = readwarnings(args[0]) if warnings is None: return 1 files = warnings.keys() if not files: print "No classic division warnings read from", args[0] return files.sort() exit = None for filename in files: x = process(filename, warnings[filename]) exit = exit or x return exit def usage(msg): sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Usage: %s [-m] warnings\n" % sys.argv[0]) sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0]) PATTERN = ("^(.+?):(\d+): DeprecationWarning: " "classic (int|long|float|complex) division$") def readwarnings(warningsfile): prog = re.compile(PATTERN) try: f = open(warningsfile) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return warnings = {} while 1: line = f.readline() if not line: break m = prog.match(line) if not m: if line.find("division") >= 0: sys.stderr.write("Warning: ignored input " + line) continue filename, lineno, what = m.groups() list = warnings.get(filename) if list is None: warnings[filename] = list = [] list.append((int(lineno), intern(what))) f.close() return warnings def process(filename, list): print "-"*70 assert list # if this fails, readwarnings() is broken try: fp = open(filename) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return 1 print "Index:", filename f = FileContext(fp) list.sort() index = 0 # list[:index] has been processed, list[index:] is still to do g = tokenize.generate_tokens(f.readline) while 1: startlineno, endlineno, slashes = lineinfo = scanline(g) if startlineno is None: break assert startlineno <= endlineno is not None orphans = [] while index < len(list) and list[index][0] < startlineno: orphans.append(list[index]) index += 1 if orphans: reportphantomwarnings(orphans, f) warnings = [] while index < len(list) and list[index][0] <= endlineno: warnings.append(list[index]) index += 1 if not slashes and not warnings: pass elif slashes and not warnings: report(slashes, "No conclusive evidence") elif warnings and not slashes: reportphantomwarnings(warnings, f) else: if len(slashes) > 1: if not multi_ok: rows = [] lastrow = None for (row, col), line in slashes: if row == lastrow: continue rows.append(row) lastrow = row assert rows if len(rows) == 1: print "*** More than one / operator in line", rows[0] else: print "*** More than one / operator per statement", print "in lines %d-%d" % (rows[0], rows[-1]) intlong = [] floatcomplex = [] bad = [] for lineno, what in warnings: if what in ("int", "long"): intlong.append(what) elif what in ("float", "complex"): floatcomplex.append(what) else: bad.append(what) lastrow = None for (row, col), line in slashes: if row == lastrow: continue lastrow = row line = chop(line) if line[col:col+1] != "/": print "*** Can't find the / operator in line %d:" % row print "*", line continue if bad: print "*** Bad warning for line %d:" % row, bad print "*", line elif intlong and not floatcomplex: print "%dc%d" % (row, row) print "<", line print "---" print ">", line[:col] + "/" + line[col:] elif floatcomplex and not intlong: print "True division / operator at line %d:" % row print "=", line elif intlong and floatcomplex: print "*** Ambiguous / operator (%s, %s) at line %d:" % ( "|".join(intlong), "|".join(floatcomplex), row) print "?", line fp.close() def reportphantomwarnings(warnings, f): blocks = [] lastrow = None lastblock = None for row, what in warnings: if row != lastrow: lastblock = [row] blocks.append(lastblock) lastblock.append(what) for block in blocks: row = block[0] whats = "/".join(block[1:]) print "*** Phantom %s warnings for line %d:" % (whats, row) f.report(row, mark="*") def report(slashes, message): lastrow = None for (row, col), line in slashes: if row != lastrow: print "*** %s on line %d:" % (message, row) print "*", chop(line) lastrow = row class FileContext: def __init__(self, fp, window=5, lineno=1): self.fp = fp self.window = 5 self.lineno = 1 self.eoflookahead = 0 self.lookahead = [] self.buffer = [] def fill(self): while len(self.lookahead) < self.window and not self.eoflookahead: line = self.fp.readline() if not line: self.eoflookahead = 1 break self.lookahead.append(line) def readline(self): self.fill() if not self.lookahead: return "" line = self.lookahead.pop(0) self.buffer.append(line) self.lineno += 1 return line def __getitem__(self, index): self.fill() bufstart = self.lineno - len(self.buffer) lookend = self.lineno + len(self.lookahead) if bufstart <= index < self.lineno: return self.buffer[index - bufstart] if self.lineno <= index < lookend: return self.lookahead[index - self.lineno] raise KeyError def report(self, first, last=None, mark="*"): if last is None: last = first for i in range(first, last+1): try: line = self[first] except KeyError: line = "" print mark, chop(line) def scanline(g): slashes = [] startlineno = None endlineno = None for type, token, start, end, line in g: endlineno = end[0] if startlineno is None: startlineno = endlineno if token in ("/", "/="): slashes.append((start, line)) if type == tokenize.NEWLINE: break return startlineno, endlineno, slashes def chop(line): if line.endswith("\n"): return line[:-1] else: return line if __name__ == "__main__": sys.exit(main()) PK!Q<` db2pickle.pycnu[ fc@sBdZddlZyddlZWnek r;dZnXyddlZWnek redZnXyddlZWnek rdZnXyddlZWnek rdZnXddlZyddl Z Wnek rddl Z nXej dZ dZ dZedkr>ejeej dndS(s5 Synopsis: %(prog)s [-h|-g|-b|-r|-a] dbfile [ picklefile ] Convert the database file given on the command line to a pickle representation. The optional flags indicate the type of the database: -a - open using anydbm -b - open as bsddb btree file -d - open as dbm file -g - open as gdbm file -h - open as bsddb hash file -r - open as bsddb recno file The default is hash. If a pickle file is named it is opened for write access (deleting any existing data). If no pickle file is named, the pickle output is written to standard output. iNicCstjjttdS(N(tsyststderrtwritet__doc__tglobals(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytusage/sc Csy1tj|dddddddg\}}Wntjk rOtdSXt|d kstt|d krtdSt|dkr|d }tj}nN|d }yt|dd }Wn*tk rtjj d |ddSXd}x|D]\}}|d"krOy t j }Wqt k rKtjj ddSXq|d#kry t j}Wqt k rtjj ddSXq|d$kry t j}Wqt k rtjj ddSXq|d%kry tj}Wqt k rtjj ddSXq|d&krSy tj}Wqt k rOtjj ddSXq|d'kry tj}Wqt k rtjj ddSXqqW|dkrt dkrtjj dtjj ddSt j }ny||d}Wn9t jk r.tjj d |tjj d!dSXx7|jD])}tj|||f|ddkq<W|j|jd S((NthbrdagthashtbtreetrecnotdbmtgdbmtanydbmiiitwbsUnable to open %s s-hs--hashsbsddb module unavailable. s-bs--btrees-rs--recnos-as--anydbmsanydbm module unavailable. s-gs--gdbmsgdbm module unavailable. s-ds--dbmsdbm module unavailable. sbsddb module unavailable - smust specify dbtype. trsUnable to open %s. s&Check for format or version mismatch. (s-hs--hash(s-bs--btree(s-rs--recno(s-as--anydbm(s-gs--gdbm(s-ds--dbm(tgetoptterrorRtlenRtstdouttopentIOErrorRRtNonetbsddbthashopentAttributeErrortbtopentrnopenR R R tkeystpickletdumptclose( targstoptstdbfiletpfiletdbopentopttargtdbtk((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pytmain2s  $                          '  t__main__i(RRRt ImportErrorRR R R RtcPickleRtargvtprogRR(t__name__texit(((s//usr/lib64/python2.7/Tools/scripts/db2pickle.pyts6              T PK!8e e md5sum.pyonu[ fc@sdZdadadadtZddlZddlZddlZddl Z dZ ej dZ ej dZ ejd ej d Zed kseejd krejeejd ej ndS( s9Python utility to print MD5 checksums of argument files. itrbs? usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...] -b : read files in binary mode (default) -t : read files in text mode (you almost certainly don't want this!) -l : print last pathname component only -s bufsize: read buffer size (default %d) file ... : files to sum; '-' or no files means stdin iNcGsd}|r7t|dtr7|d|d }}n tj}t|dkrst|dt rs|d}nxt|D]l}t|tr|dkrttjd|p|}qt||p|}qzt ||p|}qzW|S(Niiit-s( t isinstancetfiletsyststdouttlentstrt printsumfptstdintprintsumtsum(tfilestststouttf((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR s &   cCsyyt|t}Wn.tk rC}tjjd||fdSXtrYt|}nt|||}|j|S(Ns%s: Can't open: %s i( topentrmodetIOErrorRtstderrtwritetfnfilterRtclose(tfilenameRtfptmsgR ((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR +s cCstj}y1x*|jt}|s+Pn|j|qWWn.tk rm}tjjd||fdSX|jd|j |fdS(Ns%s: I/O error: %s is%s %s i( tmd5tnewtreadtbufsizetupdateRRRRt hexdigest(RRRtmtdataR((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyR7s icCsytj|d\}}Wn;tjk rY}tjjdtjd|tfdSXxt|D]l\}}|dkrtjj a qa|dkrda qa|dkrd a qa|d krat |a qaqaW|sd g}nt||S( Nsblts:s %s: %s %siis-ls-bRs-ttrs-sR(tgetoptterrorRRRtargvtusagetostpathtbasenameRRtintRR (targsRtoptsRtota((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pytmainEs"$       t__main__i(t__doc__RtNoneRRR&RR'R#RR RR RR%R/t__name__texit(((s,/usr/lib64/python2.7/Tools/scripts/md5sum.pyts       PK!|$$ setup.pycnu[ fc@sWddlmZedkrSeddddddd d d d d dddg ndS(i(tsetupt__main__tscriptss byteyears.pys checkpyc.pys copytime.pyscrlf.pys dutree.pys ftpmirror.pysh2py.pyslfcr.pys../i18n/pygettext.pys logmerge.pys../../Lib/tabnanny.pys../../Lib/timeit.pys untabify.pyN(tdistutils.coreRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/setup.pyts PK! gprof2html.pyonu[ fc@szdZddlZddlZddlZddlZddlZdZdZdZdZ e dkrve ndS(s+Transform gprof(1) output into useful HTML.iNsF gprof output (%s)
        s
        ccs#x|D]}tj|VqWdS(N(tcgitescape(tinputtline((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pyt add_escapess c Csd}tjdr#tjd}n|d}tt|}t|d}|jt|x.|D]&}|j||jdrfPqfqfWi}xv|D]n}tjd|}|s|j|Pn|j dd\}}|||<|jd||||fqWx.|D]&}|j||jd rPqqWx|D]}tjd |}|s|j||jd rGPqGqGn|j ddd \} }} ||kr|j|qGn|jd r|jd| |||| fqG|jd| ||| fqGWxW|D]O}xFtj d|D]2} | |kr`d| | f} n|j| q;Wq"W|jt |j t jdtjj|dS(Ns gprof.outis.htmltws times (.* )(\w+)\nis+%s%s s index % times*(.* )(\w+)(( <cycle.*>)? \[\d+\])\nsIndex by function nameit[s-%s%s%s s%s%s%s s(\w+(?:\.c)?|\W+)s%ssfile:(tsystargvRtfiletwritetheadert startswithtretmatchtgrouptfindallttrailertcloset webbrowsertopentostpathtabspath( tfilenametoutputfilenameRtoutputRtlabelstmtstufftfnametprefixtsuffixtpart((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pytmainsb                    t__main__( t__doc__R RRRRR RRR"t__name__(((s0/usr/lib64/python2.7/Tools/scripts/gprof2html.pyts<   4 PK!|$$ setup.pyonu[ fc@sWddlmZedkrSeddddddd d d d d dddg ndS(i(tsetupt__main__tscriptss byteyears.pys checkpyc.pys copytime.pyscrlf.pys dutree.pys ftpmirror.pysh2py.pyslfcr.pys../i18n/pygettext.pys logmerge.pys../../Lib/tabnanny.pys../../Lib/timeit.pys untabify.pyN(tdistutils.coreRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/setup.pyts PK!ީ$YY rgrep.pycnu[ fc@sYdZddlZddlZddlZdZddZedkrUendS(s.Reverse grep. Usage: rgrep [-i] pattern file iNcCsAd}d}tjtjdd\}}x0|D](\}}|dkr2|tjB}q2q2Wt|dkr}tdnt|dkrtd n|\}}ytj||}Wn*tjk r} td t | nXyt |} Wn6t k r3} td t |t | fdnX| j dd| j} d} x| dkr<t| |} | | } | j | | j| }|jd }~| dkr|d s|d =qn|d | |d <| dkr|d} |d=nd} |jx%|D]}|j|r|GHqqWqYWdS(Ni@iiitis-iisnot enough argumentss"exactly one file argument requiredserror in regular expression: %sscan't open %s: %ss ii(tgetopttsystargvtret IGNORECASEtlentusagetcompileterrortstrtopentIOErrortreprtseekttelltNonetmintreadtsplittreversetsearch(tbufsizetreflagstoptstargstotatpatterntfilenametprogtmsgtftpostleftovertsizetbuffertlinestline((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pytmain sR    '           icCs'tjt_|GHtGHtj|dS(N(Rtstderrtstdoutt__doc__texit(Rtcode((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyR9s t__main__(R*RRRR'Rt__name__(((s+/usr/lib64/python2.7/Tools/scripts/rgrep.pyts    -  PK!n\6))find_recursionlimit.pyonu[ fc@sGdZddlZddlZdddYZdZdd dYZdZd d!d YZd Zd d"d YZ dZ dd#dYZ dZ dZ idZdZdZxreedeedeedeedeedeedeeddeGHedZqWdS($sAFind the maximum recursion limit that prevents interpreter termination. This script finds the maximum safe recursion limit on a particular platform. If you need to change the recursion limit on your system, this script will tell you a safe upper bound. To use the new limit, call sys.setrecursionlimit(). This module implements several ways to create infinite recursion in Python. Different implementations end up pushing different numbers of C stack frames, depending on how many calls through Python's abstract C API occur. After each round of tests, it prints a message: "Limit of NNNN is fine". The highest printed value of "NNNN" is therefore the highest potentially safe limit for your system (which depends on the OS, architecture, but also the compilation flags). Please note that it is practically impossible to test all possible recursion paths in the interpreter, so the results of this test should not be trusted blindly -- although they give a good hint of which values are reasonable. NOTE: When the C stack space allocated by your system is exceeded due to excessive recursion, exact behaviour depends on the platform, although the interpreter will always fail in a likely brutal way: either a segmentation fault, a MemoryError, or just a silent abort. NB: A program that does not use __methods__ can set a higher limit. iNtRecursiveBlowup1cBseZdZRS(cCs|jdS(N(t__init__(tself((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR$s(t__name__t __module__R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR#scCstS(N(R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt test_init'stRecursiveBlowup2cBseZdZRS(cCs t|S(N(trepr(R((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__repr__+s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR*scCs ttS(N(RR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt test_repr.stRecursiveBlowup4cBseZdZRS(cCs||S(N((Rtx((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt__add__2s(RRR (((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR 1scCsttS(N(R (((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyttest_add5stRecursiveBlowup5cBseZdZRS(cCs t||S(N(tgetattr(Rtattr((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt __getattr__9s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR8scCs tjS(N(RR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt test_getattr<stRecursiveBlowup6cBseZdZRS(cCs||d||dS(Nii((Rtitem((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt __getitem__@s(RRR(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyR?scCs tdS(Ni(R(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyt test_getitemCscCstS(N(t test_recurse(((s9/usr/lib64/python2.7/Tools/scripts/find_recursionlimit.pyRFscCsyddl}Wntk r)dGHdSXd}xvtjD]h}y||}w=Wn1tk rx!tdD]}|g}qqWnX|j|dd|||s4                  PK! [(Lmailerdaemon.pyonu[ fc@sdZddlZddlZddlZddlZddlZdZdejfdYZdd#d d$d d ddddddddgZ xe e e D]Z e e Z ee edkreje ejZ nBgZx*e D]"Z ejeje ejqWeeZ [e e e <[ qW[ ddejdejejdejdejgZejdejejBZdZegZdZdZd Zed!ksejd"ekrendS(%s6mailerdaemon - classes to parse mailer-daemon messagesiNsmailerdaemon.Unparseablet ErrorMessagecBs#eZdZdZdZRS(cCs tjj||d|_dS(Nt(trfc822tMessaget__init__tsub(tselftfp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR scCsU|jd}|sdS|j}|jdr8dSd|krHdS||_dS(NtSubjectis waiting mailitwarning(t getheadertlowert startswithR(RR((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt is_warnings   cCsPxCtD];}|jy||j|jSWqtk rAqXqWtdS(N(t EMPARSERSt rewindbodyRRt Unparseable(Rtp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt get_errorss   (t__name__t __module__RR R(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR s  s.error: (?Punresolvable): (?P.+)s?----- The following addresses had permanent fatal errors ----- s(?P[^ ].*) ( .* )?s(remote execution.* .*rmail (?P.+)s8The following recipients did not receive your message: sK +(?P.*) (The following recipients did not receive your message: )?s?------- Failure Reasons -------- (?P.*) (?P.*)s ^<(?P.*)>: (?P.*)s=^(?PUser mailbox exceeds allowed size): (?P.+)s0^5\d{2} <(?P[^ >]+)>\.\.\. (?P.+)s)^Original-Recipient: rfc822;(?P.*)sR^did not reach the following recipient\(s\): (?P.*) on .* +(?P.*)s+^ <(?P[^ >]+)> \.\.\. (?P.*)s@^Report on your message to: (?P.*) Reason: (?P.*)s^^Your message was not delivered to +(?P.*) +for the following reason: +(?P.*)sO^ was not +(?P[^ ].*?) * .* .* .* because:.* +(?P[^ ].*?) * Rs^5\d{2} <>\.\.\. (?P.*)s<>\.\.\. (?P.*)s^<<< 5\d{2} (?P.*)s,===== stderr was ===== rmail: (?P.*)s ^Diagnostic-Code: (?P.*)s^From:c Cs|j}tj|}|dkr6t|}n|jd}g}g}d}x*tD]"}t|td kr|dj|d|}|dk ry|jd}Wnt k rnXxL|dj ||j d|}|dkrPn|j |jdqWPqq^|j|d|}|dk r^|j |jdy|jd}Wnt k r{nXPq^q^W|st n|s|}|d dkr|d}nxtD] }t|tdkrxtt|dddD]} || } tjtj| j|jd tj} | j|}|dk r|j d j| jd |jdj|| =qqWqn|j|}|dk r|jd}PqqWnx8|D]0} |j d j| jd |jqW|S( Nitreasonitemailisreturned mail: Ris<>t s: ((treadtemparse_list_fromtsearchtNonetlentstarttemparse_list_listttypetgroupt IndexErrortmatchtendtappendRtemparse_list_reasontrangetretcompiletescapetjointsplitt MULTILINEtstrip( RRtdatatrest from_indexterrorstemailsRtregexptiRtexp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt emparse_list\sj     "      # 0 3   .cCs@t|}t|}||kr(dS||kr8dSdSdS(Niii(tint(tatb((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt sort_numerics    cCstj|tjd}i}i}i}d}}}t|dtjd} | jtx| D]} t| } t | } | j d} d| | dfG| j r| j dGH|d}|rntj | d | qnqnny| j}Wn-tk r4d GH|d}| j qnnXt|Gd GHx|D]}y7| jd dd!\}}dtj||f}Wn d}nX|j|sd||Rt.tFroms %s %-40s is warning onlyt,s** Not parseableR1tdateis%s %02ds??????s%s (%s)s--------------s files parsed,sfiles warning-only,sfiles unparseables %d %s - %s %si(tostchdirR'R(tfiltertlistdirtsortR:topenRtgetaddrR tclosetrenameRRRtgetdatetcalendart month_abbrthas_keytkeysR$(tdirtmodifyR<t errordictt errorfirstt errorlasttnoktnwarntnbadtfilesR;RtmtsenderR1tetmmtddRAtlisttnumtfirsttlast((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytparsedirsj                 ) cCsd}ttjdkrAtjddkrAd}tjd=nttjdkr~x2tjdD]}t||qdWn td|dS(Niis-ds/ufs/jack/Mail/errorsinbox(RtsystargvRb(RQtfolder((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytmains( t__main__i(s?----- The following addresses had permanent fatal errors ----- s(?P[^ ].*) ( .* )?(s8The following recipients did not receive your message: sK +(?P.*) (The following recipients did not receive your message: )?(t__doc__RRLR'RBRcRRRRR&RR4txRR(R,txlR$ttupleR%t IGNORECASERR6RR:RbRfRRd(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyts`     $        9   D PK!p ifdef.pyonu[ fc@sPddlZddlZgZgZdZdZedkrLendS(iNcCstjtjdd\}}xL|D]D\}}|dkrNtj|n|dkr&tj|q&q&W|sdg}nxY|D]Q}|dkrttjtjqt |d}t|tj|j qWdS(NisD:U:s-Ds-Ut-tr( tgetopttsystargvtdefstappendtundefstprocesststdintstdouttopentclose(toptstargstotatfilenametf((s+/usr/lib64/python2.7/Tools/scripts/ifdef.pytmain#s     cCs d}d}g}x|j}|s+Pnx4|ddkra|j}|sTPn||}q.W|j}|d d kr|r|j|qqn|dj}|j}|d } | |kr|r|j|qqn| dkrt|d kr| dkrd} nd } |d} | tkr_|j|| | f| sd }qq| tkr|j|| | f| rd }qq|j|d | f|r|j|qq| dkr|j|d d f|r|j|qq| dkrz|rz|d \} } }| d krH|rw|j|qwq| } | }| sdd }n| | |f|d s    ; PK!~Xcombinerefs.pycnu[ fc@sTdZddlZddlZdZdZedkrPeejdndS(sL combinerefs path A helper for analyzing PYTHONDUMPREFS output. When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown time Py_Finalize() prints the list of all live objects twice: first it prints the repr() of each object while the interpreter is still fully intact. After cleaning up everything it can, it prints all remaining live objects again, but the second time just prints their addresses, refcounts, and type names (because the interpreter has been torn down, calling repr methods at this point can get into infinite loops or blow up). Save all this output into a file, then run this script passing the path to that file. The script finds both output chunks, combines them, then prints a line of output for each object still alive at the end: address refcnt typename repr address is the address of the object, in whatever format the platform C produces for a %p format code. refcnt is of the form "[" ref "]" when the object's refcount is the same in both PYTHONDUMPREFS output blocks, or "[" ref_before "->" ref_after "]" if the refcount changed. typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS output block. repr is repr(object), extracted from the first PYTHONDUMPREFS output block. CAUTION: If object is a container type, it may not actually contain all the objects shown in the repr: the repr was captured from the first output block, and some of the containees may have been released since then. For example, it's common for the line showing the dict of interned strings to display strings that no longer exist at the end of Py_Finalize; this can be recognized (albeit painfully) because such containees don't have a line of their own. The objects are listed in allocation order, with most-recently allocated printed first, and the first object allocated printed last. Simple examples: 00857060 [14] str '__len__' The str object '__len__' is alive at shutdown time, and both PYTHONDUMPREFS output blocks said there were 14 references to it. This is probably due to C modules that intern the string "__len__" and keep a reference to it in a file static. 00857038 [46->5] tuple () 46-5 = 41 references to the empty tuple were removed by the cleanup actions between the times PYTHONDUMPREFS produced output. 00858028 [1025->1456] str '' The string '', which is used in dictobject.c to overwrite a real key that gets deleted, grew several hundred references during cleanup. It suggests that stuff did get removed from dicts by cleanup, but that the dicts themselves are staying alive for some reason. iNccs9x2|D]*}t|j||kr0|VqPqWdS(N(tbooltmatch(tfileitertpatt whilematchtline((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytreadQs c Cst|}t|}x#t|tjdtD]}q4Wtjd}i}i}d}xkt|tjdtD]N}|j|}|r|j\} || <|| <|d7}q{dG|GHq{Wd} xt||tD]}| d7} |j|}|st |j\} } } | |krGdG|j GHqn| G| || krfd| Gnd || | fG| G|| GHqW|j d || fGHdS( Ns^Remaining objects:$s([a-zA-Z\d]+) \[(\d+)\] (.*)is^Remaining object addresses:$is ??? skipped:s*??? new object created while tearing down:s[%s]s[%s->%s]s%d objects before, %d after( tfiletiterRtretcompiletFalseRtgroupstTruetAssertionErrortrstriptclose( tfnametftfiRtcracktaddr2rct addr2gutstbeforetmtaddrtaftertrctguts((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytcombineXs<  ""       t__main__i(t__doc__R tsysRRt__name__targv(((s1/usr/lib64/python2.7/Tools/scripts/combinerefs.pytFs     & PK! [(Lmailerdaemon.pycnu[ fc@sdZddlZddlZddlZddlZddlZdZdejfdYZdd#d d$d d ddddddddgZ xe e e D]Z e e Z ee edkreje ejZ nBgZx*e D]"Z ejeje ejqWeeZ [e e e <[ qW[ ddejdejejdejdejgZejdejejBZdZegZdZdZd Zed!ksejd"ekrendS(%s6mailerdaemon - classes to parse mailer-daemon messagesiNsmailerdaemon.Unparseablet ErrorMessagecBs#eZdZdZdZRS(cCs tjj||d|_dS(Nt(trfc822tMessaget__init__tsub(tselftfp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR scCsU|jd}|sdS|j}|jdr8dSd|krHdS||_dS(NtSubjectis waiting mailitwarning(t getheadertlowert startswithR(RR((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt is_warnings   cCsPxCtD];}|jy||j|jSWqtk rAqXqWtdS(N(t EMPARSERSt rewindbodyRRt Unparseable(Rtp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt get_errorss   (t__name__t __module__RR R(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR s  s.error: (?Punresolvable): (?P.+)s?----- The following addresses had permanent fatal errors ----- s(?P[^ ].*) ( .* )?s(remote execution.* .*rmail (?P.+)s8The following recipients did not receive your message: sK +(?P.*) (The following recipients did not receive your message: )?s?------- Failure Reasons -------- (?P.*) (?P.*)s ^<(?P.*)>: (?P.*)s=^(?PUser mailbox exceeds allowed size): (?P.+)s0^5\d{2} <(?P[^ >]+)>\.\.\. (?P.+)s)^Original-Recipient: rfc822;(?P.*)sR^did not reach the following recipient\(s\): (?P.*) on .* +(?P.*)s+^ <(?P[^ >]+)> \.\.\. (?P.*)s@^Report on your message to: (?P.*) Reason: (?P.*)s^^Your message was not delivered to +(?P.*) +for the following reason: +(?P.*)sO^ was not +(?P[^ ].*?) * .* .* .* because:.* +(?P[^ ].*?) * Rs^5\d{2} <>\.\.\. (?P.*)s<>\.\.\. (?P.*)s^<<< 5\d{2} (?P.*)s,===== stderr was ===== rmail: (?P.*)s ^Diagnostic-Code: (?P.*)s^From:c Cs|j}tj|}|dkr6t|}n|jd}g}g}d}x*tD]"}t|td kr|dj|d|}|dk ry|jd}Wnt k rnXxL|dj ||j d|}|dkrPn|j |jdqWPqq^|j|d|}|dk r^|j |jdy|jd}Wnt k r{nXPq^q^W|st n|s|}|d dkr|d}nxtD] }t|tdkrxtt|dddD]} || } tjtj| j|jd tj} | j|}|dk r|j d j| jd |jdj|| =qqWqn|j|}|dk r|jd}PqqWnx8|D]0} |j d j| jd |jqW|S( Nitreasonitemailisreturned mail: Ris<>t s: ((treadtemparse_list_fromtsearchtNonetlentstarttemparse_list_listttypetgroupt IndexErrortmatchtendtappendRtemparse_list_reasontrangetretcompiletescapetjointsplitt MULTILINEtstrip( RRtdatatrest from_indexterrorstemailsRtregexptiRtexp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt emparse_list\sj     "      # 0 3   .cCs@t|}t|}||kr(dS||kr8dSdSdS(Niii(tint(tatb((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt sort_numerics    cCstj|tjd}i}i}i}d}}}t|dtjd} | jtx| D]} t| } t | } | j d} d| | dfG| j r| j dGH|d}|rntj | d | qnqnny| j}Wn-tk r4d GH|d}| j qnnXt|Gd GHx|D]}y7| jd dd!\}}dtj||f}Wn d}nX|j|sd||Rt.tFroms %s %-40s is warning onlyt,s** Not parseableR1tdateis%s %02ds??????s%s (%s)s--------------s files parsed,sfiles warning-only,sfiles unparseables %d %s - %s %si(tostchdirR'R(tfiltertlistdirtsortR:topenRtgetaddrR tclosetrenameRRRtgetdatetcalendart month_abbrthas_keytkeysR$(tdirtmodifyR<t errordictt errorfirstt errorlasttnoktnwarntnbadtfilesR;RtmtsenderR1tetmmtddRAtlisttnumtfirsttlast((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytparsedirsj                 ) cCsd}ttjdkrAtjddkrAd}tjd=nttjdkr~x2tjdD]}t||qdWn td|dS(Niis-ds/ufs/jack/Mail/errorsinbox(RtsystargvRb(RQtfolder((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytmains( t__main__i(s?----- The following addresses had permanent fatal errors ----- s(?P[^ ].*) ( .* )?(s8The following recipients did not receive your message: sK +(?P.*) (The following recipients did not receive your message: )?(t__doc__RRLR'RBRcRRRRR&RR4txRR(R,txlR$ttupleR%t IGNORECASERR6RR:RbRfRRd(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyts`     $        9   D PK!/ checkpyc.pynuȯ#! /usr/bin/python2.7 # Check that all ".pyc" files exist and are up-to-date # Uses module 'os' import sys import os from stat import ST_MTIME import imp def main(): silent = 0 verbose = 0 if sys.argv[1:]: if sys.argv[1] == '-v': verbose = 1 elif sys.argv[1] == '-s': silent = 1 MAGIC = imp.get_magic() if not silent: print 'Using MAGIC word', repr(MAGIC) for dirname in sys.path: try: names = os.listdir(dirname) except os.error: print 'Cannot list directory', repr(dirname) continue if not silent: print 'Checking ', repr(dirname), '...' names.sort() for name in names: if name[-3:] == '.py': name = os.path.join(dirname, name) try: st = os.stat(name) except os.error: print 'Cannot stat', repr(name) continue if verbose: print 'Check', repr(name), '...' name_c = name + 'c' try: f = open(name_c, 'r') except IOError: print 'Cannot open', repr(name_c) continue magic_str = f.read(4) mtime_str = f.read(4) f.close() if magic_str <> MAGIC: print 'Bad MAGIC word in ".pyc" file', print repr(name_c) continue mtime = get_long(mtime_str) if mtime == 0 or mtime == -1: print 'Bad ".pyc" file', repr(name_c) elif mtime <> st[ST_MTIME]: print 'Out-of-date ".pyc" file', print repr(name_c) def get_long(s): if len(s) <> 4: return -1 return ord(s[0]) + (ord(s[1])<<8) + (ord(s[2])<<16) + (ord(s[3])<<24) if __name__ == '__main__': main() PK! ptags.pyonu[ fc@skddlZddlZddlZgZdZdZejeZdZe dkrgendS(iNcCsltjd}x|D]}t|qWtrhtdd}tjxtD]}|j|qNWndS(Nittagstw(tsystargvt treat_fileRtopentsorttwrite(targstfilenametfpts((s+/usr/lib64/python2.7/Tools/scripts/ptags.pytmains    s/^[ ]*(def|class)[ ]+([a-zA-Z0-9_]+)[ ]*[:\(]cCsyt|d}Wntjjd|dSXtjj|}|ddkra|d }n|d|dd}tj|xw|j }|sPnt j |}|r|j d}|j d}|d|d |d }tj|qqWdS( NtrsCannot open %s is.pys s1 iis /^s/ ( RRtstderrRtostpathtbasenameRtappendtreadlinetmatchertmatchtgroup(R R tbaseR tlinetmtcontenttname((s+/usr/lib64/python2.7/Tools/scripts/ptags.pyRs(   t__main__( RtreRRR texprtcompileRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/ptags.pyt s$   PK!= pdeps.pyonu[ fc@sddlZddlZddlZdZejdZejdZdZdZdZ dZ d Z e d kryej eWqek rej d qXndS( iNcCstjd}|sdGHdSi}x|D]}t||q)WdGHt|dGHt|}t|dGHt|}t|dGHt|}t|dS( Nis usage: pdeps file.py file.py ...is --- Uses ---s--- Used By ---s--- Closure of Uses ---s--- Closure of Used By ---i(tsystargvtprocesst printresultstinversetclosure(targsttabletargtinvtreachtinvreach((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pytmains&         s^[ ]*from[ ]+([^ ]+)[ ]+s^[ ]*import[ ]+([^#]+)c Csht|d}tjj|}|ddkr>|d }ng||<}x|j}|sePnx8|ddkr|j}|sPn|d |}qhWtj|dkrtjd \\}}\} } n:tj|dkrOtjd \\}}\} } nqO|| | !j d} x6| D].} | j } | |kr.|j | q.q.WqOWdS( Ntris.pyis\iit,( topentostpathtbasenametreadlinetm_importtmatchtregstm_fromtsplittstriptappend( tfilenameRtfptmodtlisttlinetnextlinetatbta1tb1twordstword((s+/usr/lib64/python2.7/Tools/scripts/pdeps.pyRBs0   ""   cCs|j}i}x|D]}||||s          PK!@wGGhotshotmain.pyonu[ fc@sdZddlZddlZddlZddlZddlZdZdZdZe dkrej eej dndS(s Run a Python script under hotshot's control. Adapted from a posting on python-dev by Walter Drwald usage %prog [ %prog args ] filename [ filename args ] Any arguments after the filename are used as sys.argv for the filename. iNs hotshot.profcCstj|}tjjdtjj||g|t_|jd||j tj j |}|j ddtj }tjt_ |j|t_ dS(Nis execfile(%r)ttimetcalls(thotshottProfiletsystpathtinserttostdirnametargvtruntclosetstatstloadt sort_statststdouttstderrt print_stats(tfilenametprofiletargstprofR t save_stdout((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pyt run_hotshots     c Cstjt}|j|jdddddtdddd |j|\}}t|d kry|jd d S|d }t ||j |d S( Ns-ps --profiletactiontstoretdefaulttdestRthelpsSpecify profile file to useismissing script to executei( toptparset OptionParsert__doc__tdisable_interspersed_argst add_optiontPROFILEt parse_argstlent print_helpRR(RtparsertoptionsR((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pytmain(s    t__main__i( RRRRRt hotshot.statsR"RR(t__name__texitR (((s1/usr/lib64/python2.7/Tools/scripts/hotshotmain.pyt s        PK!Rparseentities.pycnu[ fc@sdZddlZddlZddlZejdZdddZdZe dkre ej dkre ej dZ n ejZ e ej d kre ej d d Zn ejZe jZeeZeeendS( s Utility for parsing HTML entity definitions available from: http://www.w3.org/ as e.g. http://www.w3.org/TR/REC-html40/HTMLlat1.ent Input is read from stdin, output is written to stdout in form of a Python snippet defining a dictionary "entitydefs" mapping literal entity name to character or numeric entity. Marc-Andre Lemburg, mal@lemburg.com, 1999. Use as you like. NO WARRANTIES. iNs7icCsd}|dkr!t|}ni}xTtj|||}|sIPn|j\}}}||f||<|j}q*W|S(Ni(tNonetlententityREtsearchtgroupstend(ttexttpostendpostdtmtnametcharcodetcomment((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pytparses cCs|jd|j}|jx|D]\}\}}|d dkrt|dd!}|dkrxd|}qt|}n t|}tj|}|jd|||fq*W|jddS( Nsentitydefs = { is&#iis'\%o's '%s': %s, # %s s } (twritetitemstsorttinttreprt TextToolstcollapse(tftdefsRR R R tcode((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyt writefile#s      t__main__iitw(t__doc__tretsysRtcompileRRRRt__name__RtargvtopentinfiletstdintoutfiletstdouttreadRR(((s3/usr/lib64/python2.7/Tools/scripts/parseentities.pyts       PK!RTv%v% reindent.pyonu[ fc@sdZdZddlZddlZddlZddlZddlZdadada e a ddZ dZdZdZd Zd d Zd dd YZdZedkrendS(sAreindent [-d][-r][-v] [ path ... ] -d (--dryrun) Dry run. Analyze, but don't make any changes to, files. -r (--recurse) Recurse. Search for all .py files in subdirectories too. -n (--nobackup) No backup. Does not make a ".bak" file before reindenting. -v (--verbose) Verbose. Print informative msgs; else no output. -h (--help) Help. Print this usage information and exit. Change Python (.py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files. Also ensure the last line ends with a newline. If no paths are given on the command line, reindent operates as a filter, reading a single source file from standard input and writing the transformed source to standard output. In this case, the -d, -r and -v flags are ignored. You can pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. If output is not to standard output, reindent overwrites files in place, renaming the originals with a .bak extension. If it finds nothing to change, the file is left alone. If reindent does change a file, the changed file is a fixed-point for future runs (i.e., running reindent on the resulting .py file won't change it again). The hard part of reindenting is figuring out what to do with comment lines. So long as the input files get a clean bill of health from tabnanny.py, reindent should do a good job. The backup file is a copy of the one that is being reindented. The ".bak" file is generated with shutil.copy(), but some corner cases regarding user/group and permissions could leave the backup file more readable than you'd prefer. You can always use the --nobackup option to prevent this. t1iNicCs-|dk rtj|IJntjtIJdS(N(tNonetsyststderrt__doc__(tmsg((s./usr/lib64/python2.7/Tools/scripts/reindent.pytusage6s cGsKd}x.|D]&}tjj|t|d}q WtjjddS(Ntt s (RRtwritetstr(targstseptarg((s./usr/lib64/python2.7/Tools/scripts/reindent.pyterrprint;s   cCsEddl}y5|jtjdddddddg\}}Wn!|jk rd}t|dSXx|D]\}}|dkrtd7aql|dkrtd7aql|dkrtaql|dkrt d7a ql|dkrltdSqlW|s&t tj }|j |j tjdSx|D]}t|q-WdS(Niitdrnvhtdryruntrecursetnobackuptverbosethelps-ds--dryruns-rs --recurses-ns --nobackups-vs --verboses-hs--help(s-ds--dryrun(s-rs --recurse(s-ns --nobackup(s-vs --verbose(s-hs--help(tgetoptRtargvterrorRRRtFalset makebackupRt ReindentertstdintrunR tstdouttcheck(RtoptsR RtotatrR ((s./usr/lib64/python2.7/Tools/scripts/reindent.pytmainBs4 "            c Cs6tjj|rtjj| rtr7dG|GHntj|}x|D]}tjj||}trtjj|rtjj| rtjj|dj d s|j j drMt |qMqMWdStrdG|GdGnyt |d}Wn.tk r5}td|t|fdSXt|}|j|j}t|trvtd |dS|jr trd GHtrd GHqnts|d }trtj||trd G|GdG|GHqnt |d}|j||jtrdG|GHqntStr.dGHntSdS(Nslisting directoryit.s.pytcheckings...trbs%s: I/O Error: %ss0%s: mixed newlines detected; cannot process fileschanged.s+But this is a dry run, so leaving it alone.s.baks backed upttotwbs wrote news unchanged.(tostpathtisdirtislinkRtlistdirtjoinRtsplitt startswithtlowertendswithRtopentIOErrorRR Rtclosetnewlinest isinstancettupleRRRtshutiltcopyfileR tTrueR( tfiletnamestnametfullnametfRR"tnewlinetbak((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_sZ%           cCsWd|D}|jdtt|}|s9dSt|dkrS|dS|S(NcSsXh|]N}|ddkr"dn/|ddkr8dn|ddkrNdndqS(is is s R((t.0tline((s./usr/lib64/python2.7/Tools/scripts/reindent.pys s Rs ii(tdiscardR8tsortedtlen(tlinesR6((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_detect_newliness  s cCsEt|}x.|dkr<||d|kr<|d8}qW|| S(sReturn line stripped of trailing spaces, tabs, newlines. Note that line.rstrip() instead also strips sundry control characters, but at least one known Emacs user expects to keep junk like that, not mentioning Barry by name or anything . ii(RG(RDtJUNKti((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt_rstrips #RcBsSeZdZdZdZdZejejej ej ej dZ RS(cCsd|_d|_|j|_t|j|_t|jtrX|jd|_n |j|_g|jD]}t |j |j^qn|_ |j j ddd|_g|_dS(Nii(t find_stmttlevelt readlinestrawRIR6R7R8RARLt expandtabsRHtinsertRtindextstats(tselfR@RD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt__init__s   / cCstj|j|j|j}x'|rH|d|jkrH|jq"W|j}|jt|dfi}g}|_ |dd}|j |d|!xTt t|dD]<}||\}}||dd}t ||} |d} | dkr.| r%|j | d} | dkrxkt|dt|dD]I} || \} } | dkrG| t || kr| d} nPqGqGWn| dkr xgt|dddD]L} || \} } | dkr| t || dt || } PqqWn| dkr+| } q+q.d} n| || <| | }|dksZ| dkrq|j |||!qx|||!D]p}|dkr||jkr|j|q|jd||qtt || }|j||qWqW|j|j kS(NiiiiR(ttokenizetgetlinet tokeneaterRHRAtpopRTtappendRGtaftertextendtranget getlspacetgettxrangetminRP(RURHRTt have2wantR\RKtthisstmtt thisleveltnextstmtthavetwanttjtjlinetjleveltdiffRDtremove((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRs^      $            cCs|j|jdS(N(t writelinesR\(RUR@((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR scCsD|jt|jkr!d}n|j|j}|jd7_|S(NRi(RSRGRH(RURD((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRXs  c Cs|\} } ||kr$d|_n||krKd|_|jd7_n||krrd|_|jd8_nw|| kr|jr|jj| dfqnF|| krn7|jrd|_|r|jj| |jfqndS(Niii(RMRNRTR[( RUttypettokent.3tendRDtINDENTtDEDENTtNEWLINEtCOMMENTtNLtslinetscol((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRYs$            ( t__name__t __module__RVRR RXRWRsRtRuRvRwRY(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyRs  E  cCsDdt|}}x*||kr?||dkr?|d7}qW|S(NiRi(RG(RDRKtn((s./usr/lib64/python2.7/Tools/scripts/reindent.pyR_Fst__main__((Rt __version__RWR)R9RtioRRRR;RRRRR#RRIRLRR_Rz(((s./usr/lib64/python2.7/Tools/scripts/reindent.pyt(s&       4    PK!8>}EE objgraph.pycnu[ fc@sddlZddlZddlZddlZdZdZdZejdZdZ dZ iZ iZ iZ iZdZd Zd Zd Zd Zd ZedkryejeWqek rejdqXndS(iNt TRGDSBAECtUVt Nntrgdsbavucs(.*): ?........ (.) (.*)$cCs4|j|r#||j|n |g||s0          5  PK! tCC pindent.pynuȯ#! /usr/bin/python2.7 # This file contains a class and a main program that perform three # related (though complimentary) formatting operations on Python # programs. When called as "pindent -c", it takes a valid Python # program as input and outputs a version augmented with block-closing # comments. When called as "pindent -d", it assumes its input is a # Python program with block-closing comments and outputs a commentless # version. When called as "pindent -r" it assumes its input is a # Python program with block-closing comments but with its indentation # messed up, and outputs a properly indented version. # A "block-closing comment" is a comment of the form '# end ' # where is the keyword that opened the block. If the # opening keyword is 'def' or 'class', the function or class name may # be repeated in the block-closing comment as well. Here is an # example of a program fully augmented with block-closing comments: # def foobar(a, b): # if a == b: # a = a+1 # elif a < b: # b = b-1 # if b > a: a = a-1 # # end if # else: # print 'oops!' # # end if # # end def foobar # Note that only the last part of an if...elif...else... block needs a # block-closing comment; the same is true for other compound # statements (e.g. try...except). Also note that "short-form" blocks # like the second 'if' in the example must be closed as well; # otherwise the 'else' in the example would be ambiguous (remember # that indentation is not significant when interpreting block-closing # comments). # The operations are idempotent (i.e. applied to their own output # they yield an identical result). Running first "pindent -c" and # then "pindent -r" on a valid Python program produces a program that # is semantically identical to the input (though its indentation may # be different). Running "pindent -e" on that output produces a # program that only differs from the original in indentation. # Other options: # -s stepsize: set the indentation step size (default 8) # -t tabsize : set the number of spaces a tab character is worth (default 8) # -e : expand TABs into spaces # file ... : input file(s) (default standard input) # The results always go to standard output # Caveats: # - comments ending in a backslash will be mistaken for continued lines # - continuations using backslash are always left unchanged # - continuations inside parentheses are not extra indented by -r # but must be indented for -c to work correctly (this breaks # idempotency!) # - continued lines inside triple-quoted strings are totally garbled # Secret feature: # - On input, a block may also be closed with an "end statement" -- # this is a block-closing comment without the '#' sign. # Possible improvements: # - check syntax based on transitions in 'next' table # - better error reporting # - better error recovery # - check identifier after class/def # The following wishes need a more complete tokenization of the source: # - Don't get fooled by comments ending in backslash # - reindent continuation lines indicated by backslash # - handle continuation lines inside parentheses/braces/brackets # - handle triple quoted strings spanning lines # - realign comments # - optionally do much more thorough reformatting, a la C indent from __future__ import print_function # Defaults STEPSIZE = 8 TABSIZE = 8 EXPANDTABS = False import io import re import sys next = {} next['if'] = next['elif'] = 'elif', 'else', 'end' next['while'] = next['for'] = 'else', 'end' next['try'] = 'except', 'finally' next['except'] = 'except', 'else', 'finally', 'end' next['else'] = next['finally'] = next['with'] = \ next['def'] = next['class'] = 'end' next['end'] = () start = 'if', 'while', 'for', 'try', 'with', 'def', 'class' class PythonIndenter: def __init__(self, fpi = sys.stdin, fpo = sys.stdout, indentsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): self.fpi = fpi self.fpo = fpo self.indentsize = indentsize self.tabsize = tabsize self.lineno = 0 self.expandtabs = expandtabs self._write = fpo.write self.kwprog = re.compile( r'^(?:\s|\\\n)*(?P[a-z]+)' r'((?:\s|\\\n)+(?P[a-zA-Z_]\w*))?' r'[^\w]') self.endprog = re.compile( r'^(?:\s|\\\n)*#?\s*end\s+(?P[a-z]+)' r'(\s+(?P[a-zA-Z_]\w*))?' r'[^\w]') self.wsprog = re.compile(r'^[ \t]*') # end def __init__ def write(self, line): if self.expandtabs: self._write(line.expandtabs(self.tabsize)) else: self._write(line) # end if # end def write def readline(self): line = self.fpi.readline() if line: self.lineno += 1 # end if return line # end def readline def error(self, fmt, *args): if args: fmt = fmt % args # end if sys.stderr.write('Error at line %d: %s\n' % (self.lineno, fmt)) self.write('### %s ###\n' % fmt) # end def error def getline(self): line = self.readline() while line[-2:] == '\\\n': line2 = self.readline() if not line2: break # end if line += line2 # end while return line # end def getline def putline(self, line, indent): tabs, spaces = divmod(indent*self.indentsize, self.tabsize) i = self.wsprog.match(line).end() line = line[i:] if line[:1] not in ('\n', '\r', ''): line = '\t'*tabs + ' '*spaces + line # end if self.write(line) # end def putline def reformat(self): stack = [] while True: line = self.getline() if not line: break # EOF # end if m = self.endprog.match(line) if m: kw = 'end' kw2 = m.group('kw') if not stack: self.error('unexpected end') elif stack.pop()[0] != kw2: self.error('unmatched end') # end if self.putline(line, len(stack)) continue # end if m = self.kwprog.match(line) if m: kw = m.group('kw') if kw in start: self.putline(line, len(stack)) stack.append((kw, kw)) continue # end if if next.has_key(kw) and stack: self.putline(line, len(stack)-1) kwa, kwb = stack[-1] stack[-1] = kwa, kw continue # end if # end if self.putline(line, len(stack)) # end while if stack: self.error('unterminated keywords') for kwa, kwb in stack: self.write('\t%s\n' % kwa) # end for # end if # end def reformat def delete(self): begin_counter = 0 end_counter = 0 while True: line = self.getline() if not line: break # EOF # end if m = self.endprog.match(line) if m: end_counter += 1 continue # end if m = self.kwprog.match(line) if m: kw = m.group('kw') if kw in start: begin_counter += 1 # end if # end if self.write(line) # end while if begin_counter - end_counter < 0: sys.stderr.write('Warning: input contained more end tags than expected\n') elif begin_counter - end_counter > 0: sys.stderr.write('Warning: input contained less end tags than expected\n') # end if # end def delete def complete(self): stack = [] todo = [] currentws = thisid = firstkw = lastkw = topid = '' while True: line = self.getline() i = self.wsprog.match(line).end() m = self.endprog.match(line) if m: thiskw = 'end' endkw = m.group('kw') thisid = m.group('id') else: m = self.kwprog.match(line) if m: thiskw = m.group('kw') if not next.has_key(thiskw): thiskw = '' # end if if thiskw in ('def', 'class'): thisid = m.group('id') else: thisid = '' # end if elif line[i:i+1] in ('\n', '#'): todo.append(line) continue else: thiskw = '' # end if # end if indentws = line[:i] indent = len(indentws.expandtabs(self.tabsize)) current = len(currentws.expandtabs(self.tabsize)) while indent < current: if firstkw: if topid: s = '# end %s %s\n' % ( firstkw, topid) else: s = '# end %s\n' % firstkw # end if self.write(currentws + s) firstkw = lastkw = '' # end if currentws, firstkw, lastkw, topid = stack.pop() current = len(currentws.expandtabs(self.tabsize)) # end while if indent == current and firstkw: if thiskw == 'end': if endkw != firstkw: self.error('mismatched end') # end if firstkw = lastkw = '' elif not thiskw or thiskw in start: if topid: s = '# end %s %s\n' % ( firstkw, topid) else: s = '# end %s\n' % firstkw # end if self.write(currentws + s) firstkw = lastkw = topid = '' # end if # end if if indent > current: stack.append((currentws, firstkw, lastkw, topid)) if thiskw and thiskw not in start: # error thiskw = '' # end if currentws, firstkw, lastkw, topid = \ indentws, thiskw, thiskw, thisid # end if if thiskw: if thiskw in start: firstkw = lastkw = thiskw topid = thisid else: lastkw = thiskw # end if # end if for l in todo: self.write(l) # end for todo = [] if not line: break # end if self.write(line) # end while # end def complete # end class PythonIndenter # Simplified user interface # - xxx_filter(input, output): read and write file objects # - xxx_string(s): take and return string object # - xxx_file(filename): process file in place, return true iff changed def complete_filter(input = sys.stdin, output = sys.stdout, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs) pi.complete() # end def complete_filter def delete_filter(input= sys.stdin, output = sys.stdout, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs) pi.delete() # end def delete_filter def reformat_filter(input = sys.stdin, output = sys.stdout, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs) pi.reformat() # end def reformat_filter def complete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): input = io.BytesIO(source) output = io.BytesIO() pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs) pi.complete() return output.getvalue() # end def complete_string def delete_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): input = io.BytesIO(source) output = io.BytesIO() pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs) pi.delete() return output.getvalue() # end def delete_string def reformat_string(source, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): input = io.BytesIO(source) output = io.BytesIO() pi = PythonIndenter(input, output, stepsize, tabsize, expandtabs) pi.reformat() return output.getvalue() # end def reformat_string def make_backup(filename): import os, os.path backup = filename + '~' if os.path.lexists(backup): try: os.remove(backup) except os.error: print("Can't remove backup %r" % (backup,), file=sys.stderr) # end try # end if try: os.rename(filename, backup) except os.error: print("Can't rename %r to %r" % (filename, backup), file=sys.stderr) # end try # end def make_backup def complete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): with open(filename, 'r') as f: source = f.read() # end with result = complete_string(source, stepsize, tabsize, expandtabs) if source == result: return 0 # end if make_backup(filename) with open(filename, 'w') as f: f.write(result) # end with return 1 # end def complete_file def delete_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): with open(filename, 'r') as f: source = f.read() # end with result = delete_string(source, stepsize, tabsize, expandtabs) if source == result: return 0 # end if make_backup(filename) with open(filename, 'w') as f: f.write(result) # end with return 1 # end def delete_file def reformat_file(filename, stepsize = STEPSIZE, tabsize = TABSIZE, expandtabs = EXPANDTABS): with open(filename, 'r') as f: source = f.read() # end with result = reformat_string(source, stepsize, tabsize, expandtabs) if source == result: return 0 # end if make_backup(filename) with open(filename, 'w') as f: f.write(result) # end with return 1 # end def reformat_file # Test program when called as a script usage = """ usage: pindent (-c|-d|-r) [-s stepsize] [-t tabsize] [-e] [file] ... -c : complete a correctly indented program (add #end directives) -d : delete #end directives -r : reformat a completed program (use #end directives) -s stepsize: indentation step (default %(STEPSIZE)d) -t tabsize : the worth in spaces of a tab (default %(TABSIZE)d) -e : expand TABs into spaces (default OFF) [file] ... : files are changed in place, with backups in file~ If no files are specified or a single - is given, the program acts as a filter (reads stdin, writes stdout). """ % vars() def error_both(op1, op2): sys.stderr.write('Error: You can not specify both '+op1+' and -'+op2[0]+' at the same time\n') sys.stderr.write(usage) sys.exit(2) # end def error_both def test(): import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'cdrs:t:e') except getopt.error, msg: sys.stderr.write('Error: %s\n' % msg) sys.stderr.write(usage) sys.exit(2) # end try action = None stepsize = STEPSIZE tabsize = TABSIZE expandtabs = EXPANDTABS for o, a in opts: if o == '-c': if action: error_both(o, action) # end if action = 'complete' elif o == '-d': if action: error_both(o, action) # end if action = 'delete' elif o == '-r': if action: error_both(o, action) # end if action = 'reformat' elif o == '-s': stepsize = int(a) elif o == '-t': tabsize = int(a) elif o == '-e': expandtabs = True # end if # end for if not action: sys.stderr.write( 'You must specify -c(omplete), -d(elete) or -r(eformat)\n') sys.stderr.write(usage) sys.exit(2) # end if if not args or args == ['-']: action = eval(action + '_filter') action(sys.stdin, sys.stdout, stepsize, tabsize, expandtabs) else: action = eval(action + '_file') for filename in args: action(filename, stepsize, tabsize, expandtabs) # end for # end if # end def test if __name__ == '__main__': test() # end if PK!߉mjjlfcr.pynuȯ#! /usr/bin/python2.7 "Replace LF with CRLF in argument files. Print names of changed files." import sys, re, os def main(): for filename in sys.argv[1:]: if os.path.isdir(filename): print filename, "Directory!" continue data = open(filename, "rb").read() if '\0' in data: print filename, "Binary!" continue newdata = re.sub("\r?\n", "\r\n", data) if newdata != data: print filename f = open(filename, "wb") f.write(newdata) f.close() if __name__ == '__main__': main() PK!X> fixcid.pycnu[ fc@sddlZddlZddlZddlTddlZejjZeZej jZ dZ dZ dZ dZdZdZd Zd Zd Zd Zd ZdZdZdZededeZdZdedZdeZedeZedeZeeeeefZddj edZ!ej"e!Z#eeefZ$ddj e$dZ%ej"e%Z&dZ'dZ(da)dZ*da+dZ,iZ-iZ.dZ/e0dkre ndS(iN(t*cCstjd}td|dtdtdtdtdtdtdtd td td td dS( NisUsage: s/ [-c] [-r] [-s file] ... file-or-directory ... s s*-c : substitute inside comments s:-r : reverse direction for following -s options s+-s substfile : add a file of substitutions s<Each non-empty non-comment line in a substitution file must s>contain exactly two words: an identifier and its replacement. s:Comments start with a # character and end at end of line. s=If an identifier is preceded with a *, it is not substituted s,inside a comment even when -c is specified. (tsystargvterr(tprogname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytusage/s           cCsqy#tjtjdd\}}WnBtjk rg}tdt|dttjdnXd}|sttjdnxY|D]Q\}}|dkrtn|dkrt n|d krt |qqWxv|D]n}t j j |rt|r\d}q\qt j j|rGt|d d}qt|rd}qqWtj|dS( Niscrs:sOptions error: s iis-cs-rs-ss": will not process symbolic links (tgetoptRRterrorRtstrRtexitt setdocommentst setreversetaddsubsttostpathtisdirt recursedowntislinktfix(toptstargstmsgtbadtopttarg((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytmain>s6#         s^[a-zA-Z0-9_]+\.[ch]$cCstjt|S(N(tretmatchtWanted(tname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pytwanted\scCs9td|fd}ytj|}Wn3tjk r_}t|dt|ddSX|jg}x|D]}|tjtjfkrqwntj j ||}tj j |rqwtj j |r|j |qwt|rwt|r d}q qwqwWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is: cannot list directory: s i(tdbgR tlistdirRRRtsorttcurdirtpardirRtjoinRRtappendRRR(tdirnameRtnamesRtsubdirsRtfullname((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR_s0      c Cs-|dkr!tj}tj}n}yt|d}Wn0tk rf}t|dt|ddSXtjj |\}}tjj |d|}d}d}t xV|j }|sPn|d}x>|dd kr|j } | sPn|| }|d}qWt|} | |kr|dkryt|d }Wn:tk r}|jt|d t|ddSX|jdd}t t|d qntt|dtd |td| n|dk r|j| qqW|dkrdS|j|s(dS|jy+tj|} tj|| td@Wn2tjk r}t|dt|dnXytj||dWn2tjk r}t|dt|dnXytj||Wn3tjk r(}t|dt|ddSXdS(Nt-trs: cannot open: s it@iis\ tws: cannot create: s: s< s> is: warning: chmod failed (s) t~s: warning: backup failed (s: rename failed ((RtstdintstdouttopentIOErrorRRR RtsplitR$tNonet initfixlinetreadlinetfixlinetclosetseektreptreprtwritetstattchmodtST_MODERtrename( tfilenametftgRtheadttailttempnametlinenotlinetnextlinetnewlinetstatbuf((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyRus                  s (struct )?[a-zA-Z_][a-zA-Z0-9_]+s"([^\n\\"]|\\.)*"s'([^\n\\']|\\.)*'s/\*s\*/s0[xX][0-9a-fA-F]*[uUlL]*s0[0-7]*[uUlL]*s[1-9][0-9]*[uUlL]*t|s[eE][-+]?[0-9]+s([0-9]+\.[0-9]*|\.[0-9]+)(s)?s[0-9]+t(t)cCs tadS(N(tOutsideCommentProgramtProgram(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR5scCs7d}x*|t|kr2tj||}|dkr=Pn|j}|jd}t|dkr|dkrtaq|dkrtaqnt|}|tkr%t|}ttkrt sdG|GH||}q n|t kr|}qn|| ||||}t|}n||}q W|S(Niis/*s*/sFound in comment:( tlenRPtsearchR4tstarttgrouptInsideCommentProgramROtDictt Docommentst NotInComment(RHtiRtfoundtntsubst((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR7s4              icCs dadS(Ni(RW(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR scCs t adS(N(tReverse(((s,/usr/lib64/python2.7/Tools/scripts/fixcid.pyR sc Csyt|d}Wn<tk rQ}t|dt|dtjdnXd}x|j}|sqPn|d}y|jd}Wntk rd}nX|| j }|sq[nt |dkr|dd kr|dd |dg|d *n3t |d kr9t|d |||fq[nt rN|\}}n |\}}|dd krw|d}n|dd kr|d}|t |%sX            P   '   % PK!YVanalyze_dxp.pycnu[ fc@sdZddlZddlZddlZddlZddlZeeds`ednejZ ej a dZ dZ dZdZd Zd Zdd ZdS( s Some helper functions to analyze the output of sys.getdxp() (which is only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE). These will tell you which opcodes have been executed most frequently in the current process, and, if Python was also built with -DDXPAIRS, will tell you which instruction _pairs_ were executed most frequently, which may help in choosing new instructions. If Python was built without -DDYNAMIC_EXECUTION_PROFILE, importing this module will raise a RuntimeError. If you're running a script you want to profile, a simple way to get the common pairs is: $ PYTHONPATH=$PYTHONPATH:/Tools/scripts ./python -i -O the_script.py --args ... > from analyze_dxp import * > s = render_common_pairs() > open('/tmp/some_file', 'w').write(s) iNtgetdxpsKCan't import analyze_dxp: Python built without -DDYNAMIC_EXECUTION_PROFILE.cCs#t|dko"t|dtS(s[Returns True if the Python that produced the argument profile was built with -DDXPAIRS.i(tlent isinstancetlist(tprofile((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt has_pairs(scCs'ttjtjaWdQXdS(s<Forgets any execution profile that has been gathered so far.N(t _profile_locktsysRt_cumulative_profile(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt reset_profile/s c Csttj}t|r|xtttD]C}x:ttt|D]"}t||c|||7cs7dkrtnfd}dj|S(sRenders the most common opcode pairs to a string in order of descending frequency. The result is a series of lines of the form: # of occurrences: ('1st opname', '2nd opname') c3s3x,tD]\}}}d||fVq WdS(Ns%s: %s (R$(t_topsR(R(s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytseqstN(tNoneRtjoin(RR'((Rs1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pytrender_common_pairsus  (t__doc__RRRRt threadingthasattrt RuntimeErrortRLockRRRRR RRR R$R)R+(((s1/usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyts              PK!RA byext.pyonu[ fc@sddZddlmZddlZddlZdddYZdZedkr`endS( s"Show file statistics by extension.i(tprint_functionNtStatscBs>eZdZdZdZdZdZdZRS(cCs i|_dS(N(tstats(tself((s+/usr/lib64/python2.7/Tools/scripts/byext.pyt__init__ scCsxy|D]q}tjj|r/|j|qtjj|rQ|j|qtjjd||j dddqWdS(NsCan't find %s stunknowni( tostpathtisdirtstatdirtisfiletstatfiletsyststderrtwritetaddstats(Rtargstarg((s+/usr/lib64/python2.7/Tools/scripts/byext.pytstatargss cCs|jdddyttj|}WnDtjk rr}tjjd||f|jddddSXx|D]}|jdrqzn|j drqzntj j ||}tj j |r|jdd dqztj j |r |j|qz|j|qzWdS( NstdirsisCan't list %s: %s t unlistables.#t~stlinks(RtsortedRtlistdirterrorR R Rt startswithtendswithRtjointislinkRR R (Rtdirtnamesterrtnametfull((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR s$ c Cstjj|\}}tjj|\}}||krEd}ntjj|}|sfd}n|j|ddyt|d}WnAtk r}tj j d||f|j|dddSX|j }|j |j|dt |d |kr"|j|d ddS|s>|j|d dn|j}|j|d t |~|j} |j|d t | dS(NtstfilesitrbsCan't open %s: %s t unopenabletbytesstbinarytemptytlinestwords(RRtsplitexttsplittnormcaseRtopentIOErrorR R Rtreadtclosetlent splitlines( RtfilenametheadtexttbasetfR tdataR*R+((s+/usr/lib64/python2.7/Tools/scripts/byext.pyR .s6        cCs3|jj|i}|j|d|||s  o  PK!GiA[ checkpyc.pyonu[ fc@s`ddlZddlZddlmZddlZdZdZedkr\endS(iN(tST_MTIMEc Csgd}d}tjdrTtjddkr5d}qTtjddkrTd}qTntj}|sxdGt|GHnxtjD]}ytj|}Wn&tjk rdGt|GHqnX|sdGt|GdGHn|j xr|D]j}|d d krtjj ||}ytj |}Wn&tjk rWd Gt|GHqnX|rtd Gt|GdGHn|d }yt |d}Wn#t k rdGt|GHqnX|jd} |jd} |j| |krdGt|GHqnt| } | dks$| dkr6dGt|GHq[| |tkr[dGt|GHq[qqWqWdS(Niis-vs-ssUsing MAGIC wordsCannot list directorys Checking s...is.pys Cannot stattChecktctrs Cannot openisBad MAGIC word in ".pyc" fileisBad ".pyc" filesOut-of-date ".pyc" file(tsystargvtimpt get_magictreprtpathtostlistdirterrortsorttjointstattopentIOErrortreadtclosetget_longR( tsilenttverbosetMAGICtdirnametnamestnametsttname_ctft magic_strt mtime_strtmtime((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pytmain s`            cCsZt|dkrdSt|dt|dd>t|dd>t|dd >S( Niiiiiiiii(tlentord(ts((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pyR<st__main__(RR RRRR!Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/checkpyc.pyts    2  PK!!=e ndiff.pyonu[ fc@sdZdZddlZddlZdZdZdZd Zd Ze d krej dZ d e krddl Z ddl Z e jd d Ze jdee jeZejjdjqee ndS(sndiff [-q] file1 file2 or ndiff (-r1 | -r2) < ndiff_output > file1_or_file2 Print a human-friendly file difference report to stdout. Both inter- and intra-line differences are noted. In the second form, recreate file1 (-r1) or file2 (-r2) on stdout, from an ndiff report on stdin. In the first form, if -q ("quiet") is not specified, the first two lines of output are -: file1 +: file2 Each remaining line begins with a two-letter code: "- " line unique to file1 "+ " line unique to file2 " " line common to both files "? " line not present in either input file Lines beginning with "? " attempt to guide the eye to intraline differences, and were not present in either input file. These lines can be confusing if the source files contain tab characters. The first file can be recovered by retaining only lines that begin with " " or "- ", and deleting those 2-character prefixes; use ndiff with -r1. The second file can be recovered similarly, but by retaining only " " and "+ " lines; use ndiff with -r2; or, on Unix, the second file can be recovered by piping the output through sed -n '/^[+ ] /s/^..//p' iiiiNcCs(tjj}||d|tdS(Ns i(tsyststderrtwritet__doc__(tmsgtout((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfail5s  cCsDyt|dSWn,tk r?}td|dt|SXdS(NtUscouldn't open s: (topentIOErrorRtstr(tfnametdetail((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfopen=scCs{t|}t|}| s&| r*dS|j}|j|j}|jxtj||D] }|GqiWdS(Nii(R t readlinestclosetdifflibtndiff(tf1nametf2nametf1tf2tatbtline((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytfcompareDs    c CsKddl}y|j|d\}}Wn#|jk rM}tt|SXd}d}}xJ|D]B\}}|dkrd}d}qe|dkred}|} qeqeW|r|rtdS|r|rtdS| dkrt| dStd St|d krtd S|\} } |r>dG| GHdG| GHnt| | S(Nisqr:iis-qs-rscan't specify both -q and -rsno args allowed with -r optiont1t2s-r value must be 1 or 2isneed 2 filename argss-:s+:(RR(tgetoptterrorRR trestoretlenR( targsRtoptsR tnoisytqseentrseentopttvalt whichfileRR((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pytmainTs<                cCs/tjtjj|}tjj|dS(N(RRRtstdinRtstdoutt writelines(twhichtrestored((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyRwst__main__s-profiles ndiff.pros main(args)ttime(iii(Rt __version__RRRR RR(Rt__name__targvR tprofiletpstatstremovetstatftruntStatststatst strip_dirst sort_statst print_stats(((s+/usr/lib64/python2.7/Tools/scripts/ndiff.pyt/s"    #     PK!ECJ linktree.pycnu[ fc@sYddlZddlZdZdZdZdZedkrUejendS(iNs.LINKicCsudttjko dkns=dGtjdGdGHdStjdtjd}}ttjdkrtjd}d}n t}d}tjj|s|dGHdSytj|d Wn$tjk r}|d G|GHdSXtjj ||}y&tj tjj tj ||Wn:tjk r`}|sP|d G|GHdS|d G|GHnXt |||dS( Niisusage:isoldtree newtree [linkto]iis: not a directoryis: cannot mkdir:s: cannot symlink:s: warning: cannot symlink:( tlentsystargvtLINKtostpathtisdirtmkdirterrortjointsymlinktpardirt linknames(toldtreetnewtreetlinkt link_may_failtmsgtlinkname((s./usr/lib64/python2.7/Tools/scripts/linktree.pytmains6%    & c CstrdG|||fGHnytj|}Wn$tjk rT}|dG|GHdSXx$|D]}|tjtjfkr\tjj||}tjj||}tjj||}tdkr|G|G|GHntjj|retjj | reytj |dd} Wn|dG|GHd} nX| rutjjtj|}t |||quqxtj ||q\q\WdS(NR s: warning: cannot listdir:iis: warning: cannot mkdir:i( tdebugRtlistdirRtcurdirR RR RtislinkRR R ( toldtnewRtnamesRtnametoldnameRtnewnametok((s./usr/lib64/python2.7/Tools/scripts/linktree.pyR 2s8       t__main__(RRRRRR t__name__texit(((s./usr/lib64/python2.7/Tools/scripts/linktree.pyt s    PK!U6 svneol.pyonu[ fc@sdZddlZddlZdZdZejdjZxejdD]\Z Z Z de kr}e j dnx[e D]SZ ee rdee e krejje e Zejd eqqqWqRWdS( s SVN helper script. Try to set the svn:eol-style property to "native" on every .py, .txt, .c and .h file in the directory tree rooted at the current directory. Files with the svn:eol-style property already set (to anything) are skipped. svn will itself refuse to set this property on a file that's not under SVN control, or that has a binary mime-type property set. This script inherits that behavior, and passes on whatever warning message the failing "svn propset" command produces. In the Python project, it's safe to invoke this script from the root of a checkout. No output is produced for files that are ignored. For a file that gets svn:eol-style set, output looks like: property 'svn:eol-style' set on 'Lib\ctypes\__init__.py' For a file not under version control: svn: warning: 'patch-finalizer.txt' is not under version control and for a file with a binary mime-type property: svn: File 'Lib est est_pep263.py' has binary mime type property iNcCstjj|dd|d}y4tttjj|ddjj}Wntk rggSX|d krtjj|dd|dtjj|dd|dgStd dS( Ns.svntpropss .svn-worktformatii s prop-bases .svn-basesUnknown repository format(ii ( tostpathtjointinttopentreadtstriptIOErrort ValueError(troottfntdefaultR((s,/usr/lib64/python2.7/Tools/scripts/svneol.pyt propfiles$s4   c Csg}xt||D]}yt|}Wntk rBqnXx|j}|jdrePnt|jd}|j|}|j||j|j}t|jd}|j|}|jqFW|j qW|S(s=Return a list of property names for file fn in directory roottENDi( RRR treadlinet startswithRtsplitRtappendtclose( R R tresultRtftlinetLtkeytvalue((s,/usr/lib64/python2.7/Tools/scripts/svneol.pytproplist1s(     s\.([hc]|py|txt|sln|vcproj)$t.s.svns svn:eol-styles%svn propset svn:eol-style native "%s"(t__doc__treRRRtcompiletsearchtpossible_text_filetwalkR tdirstfilestremoveR RRtsystem(((s,/usr/lib64/python2.7/Tools/scripts/svneol.pyts   !   PK!'-'- pindent.pycnu[ fc@sddlmZdZdZeZddlZddlZddlZiZ d e d[a-z]+)((?:\s|\\\n)+(?P[a-zA-Z_]\w*))?[^\w]sE^(?:\s|\\\n)*#?\s*end\s+(?P[a-z]+)(\s+(?P[a-zA-Z_]\w*))?[^\w]s^[ \t]*( tfpitfpot indentsizettabsizetlinenot expandtabstwritet_writetretcompiletkwprogtendprogtwsprog(tselfRRRRR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt__init__fs         cCs6|jr%|j|j|jn |j|dS(N(RRR(Rtline((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyRzs cCs+|jj}|r'|jd7_n|S(Ni(RtreadlineR(RR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyRscGsE|r||}ntjjd|j|f|jd|dS(NsError at line %d: %s s ### %s ### (tsyststderrRR(Rtfmttargs((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyterrors cCsG|j}x4|ddkrB|j}|s5Pn||7}qW|S(Nis\ (R(RRtline2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytgetlines  cCs{t||j|j\}}|jj|j}||}|d dkrjd|d||}n|j|dS(Nis s ts t (s s R&(tdivmodRRRtmatchRR(RRtindentttabstspacesti((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytputlines  cCsg}xutr}|j}|s%Pn|jj|}|rd}|jd}|sh|jdn&|jd|kr|jdn|j|t|q n|j j|}|rd|jd}|t kr |j|t||j ||fq nt j |rd|rd|j|t|d|d\}}||f|dOsB     *        3 PK!Ӕ& eptags.pynuȯ#! /usr/bin/python2.7 """Create a TAGS file for Python programs, usable with GNU Emacs. usage: eptags pyfiles... The output TAGS file is usable with Emacs version 18, 19, 20. Tagged are: - functions (even inside other defs or classes) - classes eptags warns about files it cannot open. eptags will not give warnings about duplicate tags. BUGS: Because of tag duplication (methods with the same name in different classes), TAGS files are not very useful for most object-oriented python projects. """ import sys,re expr = r'^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]' matcher = re.compile(expr) def treat_file(filename, outfp): """Append tags found in file named 'filename' to the open file 'outfp'""" try: fp = open(filename, 'r') except: sys.stderr.write('Cannot open %s\n'%filename) return charno = 0 lineno = 0 tags = [] size = 0 while 1: line = fp.readline() if not line: break lineno = lineno + 1 m = matcher.search(line) if m: tag = m.group(0) + '\177%d,%d\n' % (lineno, charno) tags.append(tag) size = size + len(tag) charno = charno + len(line) outfp.write('\f\n%s,%d\n' % (filename,size)) for tag in tags: outfp.write(tag) def main(): outfp = open('TAGS', 'w') for filename in sys.argv[1:]: treat_file(filename, outfp) if __name__=="__main__": main() PK!x methfix.pycnu[ fc@sddlZddlZddlZddlTejjZeZejjZ dZ ej dZ dZ dZdZdZej eZd Zed kre ndS( iN(t*cCsd}tjds<tdtjddtjdnx}tjdD]n}tjj|rzt|rd}qqJtjj|rt|dd}qJt |rJd}qJqJWtj|dS(Niisusage: s file-or-directory ... is": will not process symbolic links ( tsystargvterrtexittostpathtisdirt recursedowntislinktfix(tbadtarg((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytmain&s    s^[a-zA-Z0-9_]+\.py$cCstj|dkS(Ni(t ispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pytispython6scCs1td|fd}ytj|}Wn+tjk rW}td||fdSX|jg}x|D]}|tjtjfkrqontjj ||}tjj |rqotjj |r|j |qot |rot|rd}qqoqoWx#|D]}t|rd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR RtappendRR R(tdirnameR tnamestmsgtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR9s0      c Csyt|d}Wn(tk r=}td||fdSXtjj|\}}tjj|d|}d}d}x |j}|sPn|d}|dkrd|krt|d|j dS|dkrc|dkrc|d d krc|dj} | rct j d | ddkrc|d | d}|d }t||j dSnx>|d dkr|j} | sPn|| }|d}qfWt |} | |krj|dkr7yt|d}Wn2tk r}|j td||fdSX|j dd}t|dq~ntt|dtd|td| n|dk r~|j| q~q~W|j |sdSy+tj|} tj|| td@Wn*tjk r}td||fnXytj||dWn*tjk r:}td||fnXytj||Wn+tjk r|}td||fdSXdS(Ntrs%s: cannot open: %r it@iss!: contains null bytes; not fixed is#!s [pP]ythons: s script; not fixed is\ tws%s: cannot create: %r s: s s< s> is%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) (topentIOErrorRRRtsplitRtNonetreadlinetclosetretsearchtfixlinetseektreptreprtwritetstattchmodtST_MODERtrename( tfilenametfRtheadttailttempnametgtlinenotlinetwordstnextlinetnewlinetstatbuf((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR Os   ("            s8^[ ]+def +[a-zA-Z0-9_]+ *( *self *, *(( *(.*) *)) *) *:cCs[tj|dkrWtjdd!\\}}\}}|| |||!||}n|S(Niii(tfixprogRtregs(R;tatbtctd((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyR+s" t__main__(RR)RR0tstderrR/RRtstdoutR-R tcompileRRRR tfixpatR@R+t__name__(((s-/usr/lib64/python2.7/Tools/scripts/methfix.pyts          R  PK!checkappend.pyonu[ fc@sdZd ZddlZddlZddlZddlZdadZdZdZ e d\Z Z Z ZZd d d YZed krendS(scheckappend.py -- search for multi-argument .append() calls. Usage: specify one or more file or directory paths: checkappend [-v] file_or_dir [file_or_dir] ... Each file_or_dir is checked for multi-argument .append() calls. When a directory, all .py files in the directory, and recursively in its subdirectories, are checked. Use -v for status msgs. Use -vv for more status msgs. In the absence of -v, the only output is pairs of the form filename(linenumber): line containing the suspicious append Note that this finds multi-argument append calls regardless of whether they're attached to list objects. If a module defines a class with an append method that takes more than one argument, calls to that method will be listed. Note that this will not find multi-argument list.append calls made via a bound method object. For example, this is not caught: somelist = [] push = somelist.append push(1, 2, 3) iiiNcGs3dj|}tjj|tjjddS(Nt s (tjointsyststderrtwrite(targstmsg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyterrprint+scCstjd}y#tjtjdd\}}Wn/tjk ra}tt|dtdSXx-|D]%\}}|dkritdaqiqiW|sttdSx|D]}t|qWdS(Nitvs s-v( RtargvtgetoptterrorRtstrt__doc__tverbosetcheck(RtoptsRtopttoptargtarg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pytmain0s #   cCsKtjj|rtjj| rtr:d|fGHntj|}xq|D]i}tjj||}tjj|rtjj| stjj|ddkrPt|qPqPWdSyt |}Wn(t k r}t d||fdSXtdkrd|fGHnt ||j }trG|rGd|fGHndS(Ns%r: listing directoryis.pys%r: I/O Error: %sischecking %r ...s%r: Clean bill of health.(tostpathtisdirtislinkRtlistdirRtnormcaseRtopentIOErrorRt AppendCheckertrun(tfiletnamestnametfullnametfRtok((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRAs*%   iRcBsDeZdZdZejejejfejej dZ RS(cCs(||_||_t|_d|_dS(Ni(tfnameRtFIND_DOTtstatetnerrors(tselfR%R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt__init__bs   cCsjytj|jj|jWn=tjk r\}td|j|f|jd|_nX|jdkS(Ns%r: Token Error: %sii(ttokenizeRtreadlinet tokeneatert TokenErrorRR%R((R)R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRhs c Cs|j} ||krn| tkrH||kr|dkrt} qn| tkr|| kr|dkr||_|d|_t} qt} n9| tkr||kr|dkrd|_t} qt} n| tkr||kr|dkr |jd|_q|dkrA|jd|_|jdkrt} qq|d kr|jdkr|jd|_d |j |j|jfGHt } qqn7| t kr||krt} qnt d | f| |_dS(Nt.tappendit(it{t[t)t}t]t,s %s(%d): %ssunknown internal state '%r'(R1R2R3(R4R5R6( R'R&t FIND_APPENDtlinetlinenot FIND_LPARENtlevelt FIND_COMMAR(R%t FIND_STMTt SystemError( R)ttypettokentstarttendR9tNEWLINEtJUNKtOPtNAMER'((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyR-psF                      ( t__name__t __module__R*RR+RDtCOMMENTtNLRFRGR-(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRas   t__main__(iii((R t __version__RRR R+RRRRtrangeR&R8R;R=R>RRH(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt s       E PK!5reindent-rst.pynuȯ#! /usr/bin/python2.7 # Make a reST file compliant to our pre-commit hook. # Currently just remove trailing whitespace. import sys import patchcheck def main(argv=sys.argv): patchcheck.normalize_docs_whitespace(argv[1:]) if __name__ == '__main__': sys.exit(main()) PK! #diff.pynuȯ#! /usr/bin/python2.7 """ Command line interface to difflib.py providing diffs in four formats: * ndiff: lists every line and highlights interline changes. * context: highlights clusters of changes in a before/after format. * unified: highlights clusters of changes in an inline format. * html: generates side by side comparison with change highlights. """ import sys, os, time, difflib, optparse def main(): usage = "usage: %prog [options] fromfile tofile" parser = optparse.OptionParser(usage) parser.add_option("-c", action="store_true", default=False, help='Produce a context format diff (default)') parser.add_option("-u", action="store_true", default=False, help='Produce a unified format diff') parser.add_option("-m", action="store_true", default=False, help='Produce HTML side by side diff (can use -c and -l in conjunction)') parser.add_option("-n", action="store_true", default=False, help='Produce a ndiff format diff') parser.add_option("-l", "--lines", type="int", default=3, help='Set number of context lines (default 3)') (options, args) = parser.parse_args() if len(args) == 0: parser.print_help() sys.exit(1) if len(args) != 2: parser.error("need to specify both a fromfile and tofile") n = options.lines fromfile, tofile = args fromdate = time.ctime(os.stat(fromfile).st_mtime) todate = time.ctime(os.stat(tofile).st_mtime) with open(fromfile, 'U') as f: fromlines = f.readlines() with open(tofile, 'U') as f: tolines = f.readlines() if options.u: diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n) elif options.n: diff = difflib.ndiff(fromlines, tolines) elif options.m: diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n) else: diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n) sys.stdout.writelines(diff) if __name__ == '__main__': main() PK!n6r r svneol.pynuȯ#! /usr/bin/python2.7 """ SVN helper script. Try to set the svn:eol-style property to "native" on every .py, .txt, .c and .h file in the directory tree rooted at the current directory. Files with the svn:eol-style property already set (to anything) are skipped. svn will itself refuse to set this property on a file that's not under SVN control, or that has a binary mime-type property set. This script inherits that behavior, and passes on whatever warning message the failing "svn propset" command produces. In the Python project, it's safe to invoke this script from the root of a checkout. No output is produced for files that are ignored. For a file that gets svn:eol-style set, output looks like: property 'svn:eol-style' set on 'Lib\ctypes\__init__.py' For a file not under version control: svn: warning: 'patch-finalizer.txt' is not under version control and for a file with a binary mime-type property: svn: File 'Lib\test\test_pep263.py' has binary mime type property """ import re import os def propfiles(root, fn): default = os.path.join(root, ".svn", "props", fn+".svn-work") try: format = int(open(os.path.join(root, ".svn", "format")).read().strip()) except IOError: return [] if format in (8, 9): # In version 8 and 9, committed props are stored in prop-base, local # modifications in props return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"), os.path.join(root, ".svn", "props", fn+".svn-work")] raise ValueError, "Unknown repository format" def proplist(root, fn): "Return a list of property names for file fn in directory root" result = [] for path in propfiles(root, fn): try: f = open(path) except IOError: # no properties file: not under version control, # or no properties set continue while 1: # key-value pairs, of the form # K # NL # V length # NL # END line = f.readline() if line.startswith("END"): break assert line.startswith("K ") L = int(line.split()[1]) key = f.read(L) result.append(key) f.readline() line = f.readline() assert line.startswith("V ") L = int(line.split()[1]) value = f.read(L) f.readline() f.close() return result possible_text_file = re.compile(r"\.([hc]|py|txt|sln|vcproj)$").search for root, dirs, files in os.walk('.'): if '.svn' in dirs: dirs.remove('.svn') for fn in files: if possible_text_file(fn): if 'svn:eol-style' not in proplist(root, fn): path = os.path.join(root, fn) os.system('svn propset svn:eol-style native "%s"' % path) PK!Xj fixps.pycnu[ fc@s;ddlZddlZdZedkr7endS(iNcCsxtjdD]}yt|d}Wn#tk rL}|GdG|GHqnX|j}tjd|s|GdGH|jqn|j}|jtj dd|}|GdGt |GHt|d }|j ||j ||jqWdS( Nitrs: can't open :s^#! */usr/local/bin/pythons$: not a /usr/local/bin/python scripts/usr/local/bin/pythons/usr/bin/env pythont:tw( tsystargvtopentIOErrortreadlinetretmatchtclosetreadtsubtreprtwrite(tfilenametftmsgtlinetrest((s+/usr/lib64/python2.7/Tools/scripts/fixps.pytmain s(          t__main__(RRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/fixps.pyts    PK!G_o##patchcheck.pycnu[ fc@sddlZddlZddlZddlZddlZddlZddlZddlZej j dddej j dddej j dddej j ddej j ddgZ ej d Z d Zedd Zd Zd ZeddddZedddddZdZeddedZeddedZejdZeddedZeddedZed ded!Zed"ded#Zd$Z e!d%kre ndS(&iNtModulest_ctypestlibffit libffi_osxt libffi_msvctexpattzlibtsrcdircCs"dj||dkrdndS(s7Return 'N file(s)' with the proper plurality on 'file'.s {} file{}itst(tformat(tcount((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt n_files_strscsfd}|S(s*Decorator to output status info to stdout.csfd}|S(Ncsotjjdtjj||} rF rFdGHn%rZ|GHn|rfdndGH|S(Ns ... tdonetyestNO(tsyststdouttwritetflush(targstkwargstresult(tfxntinfotmessagetmodal(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcall_fxns ((RR(RRR(Rs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt decorated_fxns ((RRRR((RRRs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytstatuss cCsBdj}ytj|dtjSWntjk r=dSXdS(s0Get the symbolic name for the current git branchsgit rev-parse --abbrev-ref HEADtstderrN(tsplitt subprocesst check_outputtPIPEtCalledProcessErrortNone(tcmd((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_branch.s  cCsBdj}ytj|dtjWntjk r=dSXdS(skGet the remote name to use for upstream branches Uses "upstream" if it exists, "origin" otherwise sgit remote get-url upstreamRtorigintupstream(RR R!R"R#(R%((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_upstream_remote7s  sGetting base branch for PRRcCs|dk r|SdS(Nsnot a PR branch(R$(tx((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytER cCstjjtjjtds%dStj}|jdkrFd}ndj |}t }|dksv||krzdSt }|d|S(Ns.gittalphatmasters{0.major}.{0.minor}t/( tostpathtexiststjointSRCDIRR$Rt version_infot releaselevelR R&R)(tversiont base_brancht this_branchtupstream_remote((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_base_branchDs!    s6Getting the list of files that have been added/changedcCstt|S(N(R tlen(R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyR+XR csvtjjtjjtdr |r4d|}nd}g}tj|jdtj}zx|j D]}|j j }|jd d\}t |}|jdsqkndkrjdddjn|jqkWWd |j jXn tjd g}xO|D]Gtjjtfd tDraq'n|jq'W|S( s0Get the list of changed or added files from git.s.gitsgit diff --name-status sgit status --porcelainRitMAUs -> iNs)need a git checkout to get modified filesc3s|]}j|VqdS(N(t startswith(t.0R0(tfilename(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys zs(R/R0R1R2R3R tPopenRR"RtdecodetrstripR$tsett intersectiontstriptappendtcloseRtexittnormpathtanyt EXCLUDE_DIRS(R7R%t filenameststtlinet status_textRt filenames2((R?s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt changed_filesWs2!     cCsrt|}|dkr"t|Sdjt|g}x$|D]}|jdj|qAWdj|SdS(Nis{}:s {}s (R;R R RFR2(t file_pathsR tlinesR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytreport_modified_filess    sFixing whitespacecCs\tt_g}xFd|DD]4}tjtjjt|r |j|q q W|S(sAMake sure that the whitespace for .py files have been normalized.css$|]}|jdr|VqdS(s.pyN(tendswith(R>R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys s( tFalsetreindentt makebackuptcheckR/R0R2R3RF(RRtfixedR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_whitespaces  sFixing C file whitespacecCsg}xv|D]n}tjjt|}t|d}d|jkrRw nWdQXtj|ddt|j |q W|S(sReport if any C files trs Nitverbose( R/R0R2R3topentreadtuntabifytprocessRVRF(RRRZR0tabspathtf((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_c_whitespaces  s \s+(\r?\n)$sFixing docs whitespacec Csg}x|D]}tjjt|}yt|d}|j}WdQXg|D]}tjd|^qV}||krtj ||dt|d}|j |WdQX|j |nWq t k r}d||fGHq Xq W|S(Ntrbs\1s.baktwbsCannot fix %s: %s( R/R0R2R3R^t readlinestws_retsubtshutiltcopyfilet writelinesRFt Exception( RRRZR0RbRcRSRNt new_linesterr((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_docs_whitespaces % s Docs modifiedRcCs t|S(s9Report if any file in the Doc directory has been changed.(tbool(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt docs_modifiedssMisc/ACKS updatedcCstjjdd|kS(s$Check if Misc/ACKS has been changed.tMisctACKS(R/R0R2(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt credit_givenss Misc/NEWS.d updated with `blurb`cCstd|DS(s&Check if Misc/NEWS.d has been changed.css0|]&}|jtjjdddVqdS(RssNEWS.dtnextN(R=R/R0R2(R>tp((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys s(RJ(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt reported_newss cCst}t|}g|D]}|jdr|^q}g|D]}|jd rD|^qD}g|D]*}|jdrl|jd rl|^ql}d|D}t|t|t|t|t|t ||s|r|rdnd }Hd |GHndS( Ns.pys.cs.htDocs.rsts.inccSs%h|]}|jdr|qS(Rs(R=(R>Rw((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys s s and check for refleaks?t?sDid you run the test suite(s.cs.h(s.rsts.inc( R:RQRUR=R[RdRpRrRuRx(R7RRtfnt python_filestc_filest doc_filest misc_filestend((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytmains"  ((       t__main__("treRRjtos.pathR/R t sysconfigRWR`R0R2RKtget_config_varR3R RVR$RR&R)R:RQRTR[RdtcompileRhRptTrueRrRuRxRt__name__(((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytsB            )    PK!▘E finddiv.pycnu[ fc@s}dZddlZddlZddlZddlZdZdZdZdZe dkryej endS(s finddiv - a grep-like tool that looks for division operators. Usage: finddiv [-l] file_or_directory ... For directory arguments, all files in the directory whose name ends in .py are processed, and subdirectories are processed recursively. This actually tokenizes the files to avoid false hits in comments or strings literals. By default, this prints all lines containing a / or /= operator, in grep -n style. With the -l option specified, it prints the filename of files that contain at least one / or /= operator. iNc Csy#tjtjdd\}}Wn!tjk rF}t|dSX|s[tddSd}x>|D]6\}}|dkrtGHdS|dkrhd}qhqhWd}x)|D]!}t||}|p|}qW|S(Nitlhis&at least one file argument is requiredis-hs-l(tgetopttsystargvterrortusaget__doc__tNonetprocess( toptstargstmsgt listnamestotatexittfilenametx((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pytmains(#      cCs[tjjdtjd|ftjjdtjdtjjdtjddS(Ns%s: %s isUsage: %s [-l] file ... s"Try `%s -h' for more information. (RtstderrtwriteR(R ((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR-s!c Cstjj|rt||Syt|}Wn(tk rY}tjjd|dSXt j |j }d}xg|D]_\}}\}} } } |dkry|r|GHPn||kr|}d||| fGqqyqyW|j dS(NsCan't open: %s it/s/=s%s:%d:%s(Rs/=(tostpathtisdirt processdirtopentIOErrorRRRttokenizetgenerate_tokenstreadlineRtclose( RR tfpR tgtlastrowttypettokentrowtcoltendtline((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR2s$ "  c Csytj|}Wn+tjk r@}tjjd|dSXg}x`|D]X}tjj||}tjj|j dstjj |rN|j |qNqNW|j dd}x)|D]!}t||}|p|}qW|S(NsCan't list directory: %s is.pycSs%ttjj|tjj|S(N(tcmpRRtnormcase(Rtb((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pytQt(RtlistdirRRRRRtjoinR*tendswithRtappendtsortRR( tdirR tnamesR tfilestnametfnRR((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyRFs  - t__main__( RRRRRRRRRt__name__R(((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyts         PK!w/=L fixnotice.pycnu[ fc@szdZdaddlZddlZddlZdadadaddZdZ dZ e d krve ndS( s(Ostensibly) fix copyright notices in files. Actually, this script will simply replace a block of text in a file from one string to another. It will only do this once though, i.e. not globally throughout the file. It writes a backup file and then does an os.rename() dance for atomicity. Usage: fixnotices.py [options] [filenames] Options: -h / --help Print this message and exit --oldnotice=file Use the notice in the file as the old (to be replaced) string, instead of the hard coded value in the script. --newnotice=file Use the notice in the file as the new (replacement) string, instead of the hard coded value in the script. --dry-run Don't actually make the changes, but print out the list of files that would change. When used with -v, a status will be printed for every file. -v / --verbose Print a message for every file looked at, indicating whether the file is changed or not. s/*********************************************************** Copyright (c) 2000, BeOpen.com. Copyright (c) 1995-2000, Corporation for National Research Initiatives. Copyright (c) 1990-1995, Stichting Mathematisch Centrum. All rights reserved. See the file "Misc/COPYRIGHT" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. ******************************************************************/ iNticCs+ttGH|r|GHntj|dS(N(t__doc__tglobalstsystexit(tcodetmsg((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytusage4s cCs6y5tjtjdddddddg\}}Wn#tjk rZ}td|nXx|D]\}}|dkrtd qb|dkrdaqb|d krdaqb|dkrt|}|ja |j qb|dkrbt|}|ja |j qbqbWx|D]}t |qWdS(Nithvthelps oldnotice=s newnotice=sdry-runtverboses-hs--helpis-vs --verboses --dry-runs --oldnotices --newnotice(s-hs--help(s-vs --verbose( tgetoptRtargvterrorRtVERBOSEtDRYRUNtopentreadt OLD_NOTICEtcloset NEW_NOTICEtprocess(toptstargsRtopttargtfp((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pytmain;s.               cCst|}|j}|j|jt}|dkrStrOdG|GHndSts_trkdG|GHntrudS|| t||tt}|d}|d}t|d}|j ||jt j ||t j ||dS(Nis no change:s change:s.news.baktw( RRRtfindRRRRtlentwritetostrename(tfiletftdatatitnewtbackup((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyRXs(            t__main__( RRR RR RRRRRRt__name__(((s//usr/lib64/python2.7/Tools/scripts/fixnotice.pyts        PK!ۣ. logmerge.pynuȯ#! /usr/bin/python2.7 """Consolidate a bunch of CVS or RCS logs read from stdin. Input should be the output of a CVS or RCS logging command, e.g. cvs log -rrelease14: which dumps all log messages from release1.4 upwards (assuming that release 1.4 was tagged with tag 'release14'). Note the trailing colon! This collects all the revision records and outputs them sorted by date rather than by file, collapsing duplicate revision record, i.e., records with the same message for different files. The -t option causes it to truncate (discard) the last revision log entry; this is useful when using something like the above cvs log command, which shows the revisions including the given tag, while you probably want everything *since* that tag. The -r option reverses the output (oldest first; the default is oldest last). The -b tag option restricts the output to *only* checkin messages belonging to the given branch tag. The form -b HEAD restricts the output to checkin messages belonging to the CVS head (trunk). (It produces some output if tag is a non-branch tag, but this output is not very useful.) -h prints this message and exits. XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7 from their output. """ import sys, errno, getopt, re sep1 = '='*77 + '\n' # file separator sep2 = '-'*28 + '\n' # revision separator def main(): """Main program""" truncate_last = 0 reverse = 0 branch = None opts, args = getopt.getopt(sys.argv[1:], "trb:h") for o, a in opts: if o == '-t': truncate_last = 1 elif o == '-r': reverse = 1 elif o == '-b': branch = a elif o == '-h': print __doc__ sys.exit(0) database = [] while 1: chunk = read_chunk(sys.stdin) if not chunk: break records = digest_chunk(chunk, branch) if truncate_last: del records[-1] database[len(database):] = records database.sort() if not reverse: database.reverse() format_output(database) def read_chunk(fp): """Read a chunk -- data for one file, ending with sep1. Split the chunk in parts separated by sep2. """ chunk = [] lines = [] while 1: line = fp.readline() if not line: break if line == sep1: if lines: chunk.append(lines) break if line == sep2: if lines: chunk.append(lines) lines = [] else: lines.append(line) return chunk def digest_chunk(chunk, branch=None): """Digest a chunk -- extract working file name and revisions""" lines = chunk[0] key = 'Working file:' keylen = len(key) for line in lines: if line[:keylen] == key: working_file = line[keylen:].strip() break else: working_file = None if branch is None: pass elif branch == "HEAD": branch = re.compile(r"^\d+\.\d+$") else: revisions = {} key = 'symbolic names:\n' found = 0 for line in lines: if line == key: found = 1 elif found: if line[0] in '\t ': tag, rev = line.split() if tag[-1] == ':': tag = tag[:-1] revisions[tag] = rev else: found = 0 rev = revisions.get(branch) branch = re.compile(r"^<>$") # <> to force a mismatch by default if rev: if rev.find('.0.') >= 0: rev = rev.replace('.0.', '.') branch = re.compile(r"^" + re.escape(rev) + r"\.\d+$") records = [] for lines in chunk[1:]: revline = lines[0] dateline = lines[1] text = lines[2:] words = dateline.split() author = None if len(words) >= 3 and words[0] == 'date:': dateword = words[1] timeword = words[2] if timeword[-1:] == ';': timeword = timeword[:-1] date = dateword + ' ' + timeword if len(words) >= 5 and words[3] == 'author:': author = words[4] if author[-1:] == ';': author = author[:-1] else: date = None text.insert(0, revline) words = revline.split() if len(words) >= 2 and words[0] == 'revision': rev = words[1] else: # No 'revision' line -- weird... rev = None text.insert(0, revline) if branch: if rev is None or not branch.match(rev): continue records.append((date, working_file, rev, author, text)) return records def format_output(database): prevtext = None prev = [] database.append((None, None, None, None, None)) # Sentinel for (date, working_file, rev, author, text) in database: if text != prevtext: if prev: print sep2, for (p_date, p_working_file, p_rev, p_author) in prev: print p_date, p_author, p_working_file, p_rev sys.stdout.writelines(prevtext) prev = [] prev.append((date, working_file, rev, author)) prevtext = text if __name__ == '__main__': try: main() except IOError, e: if e.errno != errno.EPIPE: raise PK!▘E finddiv.pyonu[ fc@s}dZddlZddlZddlZddlZdZdZdZdZe dkryej endS(s finddiv - a grep-like tool that looks for division operators. Usage: finddiv [-l] file_or_directory ... For directory arguments, all files in the directory whose name ends in .py are processed, and subdirectories are processed recursively. This actually tokenizes the files to avoid false hits in comments or strings literals. By default, this prints all lines containing a / or /= operator, in grep -n style. With the -l option specified, it prints the filename of files that contain at least one / or /= operator. iNc Csy#tjtjdd\}}Wn!tjk rF}t|dSX|s[tddSd}x>|D]6\}}|dkrtGHdS|dkrhd}qhqhWd}x)|D]!}t||}|p|}qW|S(Nitlhis&at least one file argument is requiredis-hs-l(tgetopttsystargvterrortusaget__doc__tNonetprocess( toptstargstmsgt listnamestotatexittfilenametx((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pytmains(#      cCs[tjjdtjd|ftjjdtjdtjjdtjddS(Ns%s: %s isUsage: %s [-l] file ... s"Try `%s -h' for more information. (RtstderrtwriteR(R ((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR-s!c Cstjj|rt||Syt|}Wn(tk rY}tjjd|dSXt j |j }d}xg|D]_\}}\}} } } |dkry|r|GHPn||kr|}d||| fGqqyqyW|j dS(NsCan't open: %s it/s/=s%s:%d:%s(Rs/=(tostpathtisdirt processdirtopentIOErrorRRRttokenizetgenerate_tokenstreadlineRtclose( RR tfpR tgtlastrowttypettokentrowtcoltendtline((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyR2s$ "  c Csytj|}Wn+tjk r@}tjjd|dSXg}x`|D]X}tjj||}tjj|j dstjj |rN|j |qNqNW|j dd}x)|D]!}t||}|p|}qW|S(NsCan't list directory: %s is.pycSs%ttjj|tjj|S(N(tcmpRRtnormcase(Rtb((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pytQt(RtlistdirRRRRRtjoinR*tendswithRtappendtsortRR( tdirR tnamesR tfilestnametfnRR((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyRFs  - t__main__( RRRRRRRRRt__name__R(((s-/usr/lib64/python2.7/Tools/scripts/finddiv.pyts         PK!+Qptags.pynuȯ#! /usr/bin/python2.7 # ptags # # Create a tags file for Python programs, usable with vi. # Tagged are: # - functions (even inside other defs or classes) # - classes # - filenames # Warns about files it cannot open. # No warnings about duplicate tags. import sys, re, os tags = [] # Modified global variable! def main(): args = sys.argv[1:] for filename in args: treat_file(filename) if tags: fp = open('tags', 'w') tags.sort() for s in tags: fp.write(s) expr = '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:\(]' matcher = re.compile(expr) def treat_file(filename): try: fp = open(filename, 'r') except: sys.stderr.write('Cannot open %s\n' % filename) return base = os.path.basename(filename) if base[-3:] == '.py': base = base[:-3] s = base + '\t' + filename + '\t' + '1\n' tags.append(s) while 1: line = fp.readline() if not line: break m = matcher.match(line) if m: content = m.group(0) name = m.group(2) s = name + '\t' + filename + '\t/^' + content + '/\n' tags.append(s) if __name__ == '__main__': main() PK!.rff treesync.pyonu[ fc@sdZddlZddlZddlZddlZdZdZdadada dZ dZ dZ dZ d Zd Zd ZddddZddZedkre ndS(sScript to synchronize two source trees. Invoke with two arguments: python treesync.py slave master The assumption is that "master" contains CVS administration while slave doesn't. All files in the slave tree that have a CVS/Entries entry in the master tree are synchronized. This means: If the files differ: if the slave file is newer: normalize the slave file if the files still differ: copy the slave to the master else (the master is newer): copy the master to the slave normalizing the slave means replacing CRLF with LF when the master doesn't use CRLF iNtasktyestnocCs)tjtjdd\}}x|D]\}}|dkrGd}n|dkr\d}n|dkrq|an|dkr|an|d kr|an|d kr|}n|d kr&|}aaaq&q&Wy|\}}Wn0tk rd Gtjd p dGdGdGHdSXt||dS(Nis nym:s:d:f:a:s-yRs-nRs-ss-ms-ds-fs-as usage: pythonis treesync.pys5[-n] [-y] [-m y|n|a] [-s y|n|a] [-d y|n|a] [-f n|y|a]sslavedir masterdir(tgetopttsystargvt write_slavet write_mastertcreate_directoriest ValueErrortprocess(toptstargstotatdefault_answert create_filestslavetmaster((s./usr/lib64/python2.7/Tools/scripts/treesync.pytmain#s0              cCsYtjj|d}tjj|s9dG|GHdGHdSddGHdG|GHdG|GHtjj|std|d tsdG|GHd G|GHdSd G|GHytj|Wn(tjk r}d G|Gd G|GHdSXdG|GHnd}g}tj |}x|D]}tjj||}tjj||}|dkrJ|}qtjj|rtjj | r|j ||fqqW|r1tjj|d} xt | j D]s} | jd} | ddkr| dr| d}tjj||} tjj||} t| | qqWnx!|D]\} } t| | q8WdS(NtCVSsskipping master subdirectorys-- not under CVSt-i(sslave Rscreate slave directory %s?tanswers-- no corresponding slavescreating slave directoryscan't make slave directoryt:smade slave directorytEntriest/iti(tostpathtjointisdirtokayRtmkdirterrortNonetlistdirtislinktappendtopent readlinestsplittcompareR (RRtcvsdirtmsgtsubdirstnamestnamet masternamet slavenametentriestetwordststm((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR ?sT             % cCsyt|d}Wntk r,d}nXyt|d}Wntk rYd}nX|s|ssdG|GHdSdG|GHt||dtdS|sdG|GHdS|r|rt||rdSnt|}t|}||kr)|j|jdG|GHdG|GHt||dtdSd G||Gd GH|j d t |}|j|j|rd GHt||ddt nd GHt||ddt dS(NtrtrbsNeither master nor slave existssCreating missing slaveRsNot updating missing mastersMaster sis newer than slavesSlave issseconds newer than masteris#***UPDATING MASTER (BINARY COPY)***s***UPDATING MASTER***( R&tIOErrorR"tcopyRt identicaltmtimetcloseRtseekt funnycharsR(RRtsftmftsfttmfttfun((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR)msP                   iicCsCx<|jt}|jt}||kr1dS|sPqqWdS(Nii(treadtBUFSIZE(R?R@tsdtmd((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR:s cCs tj|j}|tjS(N(RtfstattfilenotstattST_MTIME(tftst((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR;scCs@x9|jt}|sPnd|ks4d|krdSqWdS(Ns sii(RDRE(RLtbuf((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR>sR7twbcCsdG|GHdG|GHtd|s%dSt||}t||}x*|jt}|s_Pn|j|qFW|j|jdS(Ntcopyings tosokay to copy? (RR&RDREtwriteR<(tsrctdsttrmodetwmodeRRLtgRN((s./usr/lib64/python2.7/Tools/scripts/treesync.pyR9s   cCs|jj}| s)|ddkrYt|}|jj}|sYt}qYn|d dkrmdS|d dkrdSdGHt|S(NitnyitytnsYes or No please -- try again:(tstriptlowert raw_inputRR(tpromptR((s./usr/lib64/python2.7/Tools/scripts/treesync.pyRs  t__main__i@(t__doc__RRRJRRRRRRRR R)RER:R;R>R9Rt__name__(((s./usr/lib64/python2.7/Tools/scripts/treesync.pyts"0  . .     PK!= copytime.pynuȯ#! /usr/bin/python2.7 # Copy one file's atime and mtime to another import sys import os from stat import ST_ATIME, ST_MTIME # Really constants 7 and 8 def main(): if len(sys.argv) <> 3: sys.stderr.write('usage: copytime source destination\n') sys.exit(2) file1, file2 = sys.argv[1], sys.argv[2] try: stat1 = os.stat(file1) except os.error: sys.stderr.write(file1 + ': cannot stat\n') sys.exit(1) try: os.utime(file2, (stat1[ST_ATIME], stat1[ST_MTIME])) except os.error: sys.stderr.write(file2 + ': cannot change time\n') sys.exit(2) if __name__ == '__main__': main() PK!c3`` which.pyonu[ fc@szddlZejdd kr,ejd=nddlZddlZddlTdZdZedkrvendS( iNit.t(t*cCstjj|ddS(Ns (tsyststderrtwrite(tstr((s+/usr/lib64/python2.7/Tools/scripts/which.pytmsg sc Cstjdjtj}d}d}tjdrctjdd dkrctjd}tjd=nx]tjdD]N}d}x"|D]}tjj||}ytj|}Wntj k rqnXt |t st |dnpt |t }|d@rO|s|GH|d }q]|d |kr8d } nd } t | |nt |d |rtjd |d|}|rt dt|qqqW|sqt |dd}qqqqWtj|dS(NtPATHiRiis-ls: not a disk fileiIis same as: salso: s: not executablesls t s"ls -l" exit status: s : not found((tostenvirontsplittpathsepRtargvtpathtjointstatterrortS_ISREGtST_MODERtS_IMODEtsystemtreprtexit( tpathlisttststlonglisttprogtidenttdirtfilenametsttmodets((s+/usr/lib64/python2.7/Tools/scripts/which.pytmainsD$       t__main__(RR(RRR RRR#t__name__(((s+/usr/lib64/python2.7/Tools/scripts/which.pyts     + PK!'-'- pindent.pyonu[ fc@sddlmZdZdZeZddlZddlZddlZiZ d e d[a-z]+)((?:\s|\\\n)+(?P[a-zA-Z_]\w*))?[^\w]sE^(?:\s|\\\n)*#?\s*end\s+(?P[a-z]+)(\s+(?P[a-zA-Z_]\w*))?[^\w]s^[ \t]*( tfpitfpot indentsizettabsizetlinenot expandtabstwritet_writetretcompiletkwprogtendprogtwsprog(tselfRRRRR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyt__init__fs         cCs6|jr%|j|j|jn |j|dS(N(RRR(Rtline((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyRzs cCs+|jj}|r'|jd7_n|S(Ni(RtreadlineR(RR((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyRscGsE|r||}ntjjd|j|f|jd|dS(NsError at line %d: %s s ### %s ### (tsyststderrRR(Rtfmttargs((s-/usr/lib64/python2.7/Tools/scripts/pindent.pyterrors cCsG|j}x4|ddkrB|j}|s5Pn||7}qW|S(Nis\ (R(RRtline2((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytgetlines  cCs{t||j|j\}}|jj|j}||}|d dkrjd|d||}n|j|dS(Nis s ts t (s s R&(tdivmodRRRtmatchRR(RRtindentttabstspacesti((s-/usr/lib64/python2.7/Tools/scripts/pindent.pytputlines  cCsg}xutr}|j}|s%Pn|jj|}|rd}|jd}|sh|jdn&|jd|kr|jdn|j|t|q n|j j|}|rd|jd}|t kr |j|t||j ||fq nt j |rd|rd|j|t|d|d\}}||f|dOsB     *        3 PK!CxWWcrlf.pycnu[ fc@sAdZddlZddlZdZedkr=endS(sFReplace CRLF with LF in argument files. Print names of changed files.iNcCsxtjdD]}tjj|r5|GdGHqnt|dj}d|kre|GdGHqn|jdd}||kr|GHt|d}|j||j qqWdS( Nis Directory!trbssBinary!s s twb( tsystargvtostpathtisdirtopentreadtreplacetwritetclose(tfilenametdatatnewdatatf((s*/usr/lib64/python2.7/Tools/scripts/crlf.pytmains     t__main__(t__doc__RRRt__name__(((s*/usr/lib64/python2.7/Tools/scripts/crlf.pyts  PK!ECJ linktree.pyonu[ fc@sYddlZddlZdZdZdZdZedkrUejendS(iNs.LINKicCsudttjko dkns=dGtjdGdGHdStjdtjd}}ttjdkrtjd}d}n t}d}tjj|s|dGHdSytj|d Wn$tjk r}|d G|GHdSXtjj ||}y&tj tjj tj ||Wn:tjk r`}|sP|d G|GHdS|d G|GHnXt |||dS( Niisusage:isoldtree newtree [linkto]iis: not a directoryis: cannot mkdir:s: cannot symlink:s: warning: cannot symlink:( tlentsystargvtLINKtostpathtisdirtmkdirterrortjointsymlinktpardirt linknames(toldtreetnewtreetlinkt link_may_failtmsgtlinkname((s./usr/lib64/python2.7/Tools/scripts/linktree.pytmains6%    & c CstrdG|||fGHnytj|}Wn$tjk rT}|dG|GHdSXx$|D]}|tjtjfkr\tjj||}tjj||}tjj||}tdkr|G|G|GHntjj|retjj | reytj |dd} Wn|dG|GHd} nX| rutjjtj|}t |||quqxtj ||q\q\WdS(NR s: warning: cannot listdir:iis: warning: cannot mkdir:i( tdebugRtlistdirRtcurdirR RR RtislinkRR R ( toldtnewRtnamesRtnametoldnameRtnewnametok((s./usr/lib64/python2.7/Tools/scripts/linktree.pyR 2s8       t__main__(RRRRRR t__name__texit(((s./usr/lib64/python2.7/Tools/scripts/linktree.pyt s    PK!$O0mmsuff.pynuȯ#! /usr/bin/python2.7 # suff # # show different suffixes amongst arguments import sys def main(): files = sys.argv[1:] suffixes = {} for filename in files: suff = getsuffix(filename) if not suffixes.has_key(suff): suffixes[suff] = [] suffixes[suff].append(filename) keys = suffixes.keys() keys.sort() for suff in keys: print repr(suff), len(suffixes[suff]) def getsuffix(filename): suff = '' for i in range(len(filename)): if filename[i] == '.': suff = filename[i:] return suff if __name__ == '__main__': main() PK!y~ ' ' fixcid.pynuȯ#! /usr/bin/python2.7 # Perform massive identifier substitution on C source files. # This actually tokenizes the files (to some extent) so it can # avoid making substitutions inside strings or comments. # Inside strings, substitutions are never made; inside comments, # it is a user option (off by default). # # The substitutions are read from one or more files whose lines, # when not empty, after stripping comments starting with #, # must contain exactly two words separated by whitespace: the # old identifier and its replacement. # # The option -r reverses the sense of the substitutions (this may be # useful to undo a particular substitution). # # If the old identifier is prefixed with a '*' (with no intervening # whitespace), then it will not be substituted inside comments. # # Command line arguments are files or directories to be processed. # Directories are searched recursively for files whose name looks # like a C file (ends in .h or .c). The special filename '-' means # operate in filter mode: read stdin, write stdout. # # Symbolic links are always ignored (except as explicit directory # arguments). # # The original files are kept as back-up with a "~" suffix. # # Changes made are reported to stdout in a diff-like format. # # NB: by changing only the function fixline() you can turn this # into a program for different changes to C source files; by # changing the function wanted() you can make a different selection of # files. import sys import re import os from stat import * import getopt err = sys.stderr.write dbg = err rep = sys.stdout.write def usage(): progname = sys.argv[0] err('Usage: ' + progname + ' [-c] [-r] [-s file] ... file-or-directory ...\n') err('\n') err('-c : substitute inside comments\n') err('-r : reverse direction for following -s options\n') err('-s substfile : add a file of substitutions\n') err('\n') err('Each non-empty non-comment line in a substitution file must\n') err('contain exactly two words: an identifier and its replacement.\n') err('Comments start with a # character and end at end of line.\n') err('If an identifier is preceded with a *, it is not substituted\n') err('inside a comment even when -c is specified.\n') def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'crs:') except getopt.error, msg: err('Options error: ' + str(msg) + '\n') usage() sys.exit(2) bad = 0 if not args: # No arguments usage() sys.exit(2) for opt, arg in opts: if opt == '-c': setdocomments() if opt == '-r': setreverse() if opt == '-s': addsubst(arg) for arg in args: if os.path.isdir(arg): if recursedown(arg): bad = 1 elif os.path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad) # Change this regular expression to select a different set of files Wanted = r'^[a-zA-Z0-9_]+\.[ch]$' def wanted(name): return re.match(Wanted, name) def recursedown(dirname): dbg('recursedown(%r)\n' % (dirname,)) bad = 0 try: names = os.listdir(dirname) except os.error, msg: err(dirname + ': cannot list directory: ' + str(msg) + '\n') return 1 names.sort() subdirs = [] for name in names: if name in (os.curdir, os.pardir): continue fullname = os.path.join(dirname, name) if os.path.islink(fullname): pass elif os.path.isdir(fullname): subdirs.append(fullname) elif wanted(name): if fix(fullname): bad = 1 for fullname in subdirs: if recursedown(fullname): bad = 1 return bad def fix(filename): ## dbg('fix(%r)\n' % (filename,)) if filename == '-': # Filter mode f = sys.stdin g = sys.stdout else: # File replacement mode try: f = open(filename, 'r') except IOError, msg: err(filename + ': cannot open: ' + str(msg) + '\n') return 1 head, tail = os.path.split(filename) tempname = os.path.join(head, '@' + tail) g = None # If we find a match, we rewind the file and start over but # now copy everything to a temp file. lineno = 0 initfixline() while 1: line = f.readline() if not line: break lineno = lineno + 1 while line[-2:] == '\\\n': nextline = f.readline() if not nextline: break line = line + nextline lineno = lineno + 1 newline = fixline(line) if newline != line: if g is None: try: g = open(tempname, 'w') except IOError, msg: f.close() err(tempname+': cannot create: '+ str(msg)+'\n') return 1 f.seek(0) lineno = 0 initfixline() rep(filename + ':\n') continue # restart from the beginning rep(repr(lineno) + '\n') rep('< ' + line) rep('> ' + newline) if g is not None: g.write(newline) # End of file if filename == '-': return 0 # Done in filter mode f.close() if not g: return 0 # No changes g.close() # Finishing touch -- move files # First copy the file's mode to the temp file try: statbuf = os.stat(filename) os.chmod(tempname, statbuf[ST_MODE] & 07777) except os.error, msg: err(tempname + ': warning: chmod failed (' + str(msg) + ')\n') # Then make a backup of the original file as filename~ try: os.rename(filename, filename + '~') except os.error, msg: err(filename + ': warning: backup failed (' + str(msg) + ')\n') # Now move the temp file to the original file try: os.rename(tempname, filename) except os.error, msg: err(filename + ': rename failed (' + str(msg) + ')\n') return 1 # Return success return 0 # Tokenizing ANSI C (partly) Identifier = '(struct )?[a-zA-Z_][a-zA-Z0-9_]+' String = r'"([^\n\\"]|\\.)*"' Char = r"'([^\n\\']|\\.)*'" CommentStart = r'/\*' CommentEnd = r'\*/' Hexnumber = '0[xX][0-9a-fA-F]*[uUlL]*' Octnumber = '0[0-7]*[uUlL]*' Decnumber = '[1-9][0-9]*[uUlL]*' Intnumber = Hexnumber + '|' + Octnumber + '|' + Decnumber Exponent = '[eE][-+]?[0-9]+' Pointfloat = r'([0-9]+\.[0-9]*|\.[0-9]+)(' + Exponent + r')?' Expfloat = '[0-9]+' + Exponent Floatnumber = Pointfloat + '|' + Expfloat Number = Floatnumber + '|' + Intnumber # Anything else is an operator -- don't list this explicitly because of '/*' OutsideComment = (Identifier, Number, String, Char, CommentStart) OutsideCommentPattern = '(' + '|'.join(OutsideComment) + ')' OutsideCommentProgram = re.compile(OutsideCommentPattern) InsideComment = (Identifier, Number, CommentEnd) InsideCommentPattern = '(' + '|'.join(InsideComment) + ')' InsideCommentProgram = re.compile(InsideCommentPattern) def initfixline(): global Program Program = OutsideCommentProgram def fixline(line): global Program ## print '-->', repr(line) i = 0 while i < len(line): match = Program.search(line, i) if match is None: break i = match.start() found = match.group(0) ## if Program is InsideCommentProgram: print '...', ## else: print ' ', ## print found if len(found) == 2: if found == '/*': Program = InsideCommentProgram elif found == '*/': Program = OutsideCommentProgram n = len(found) if found in Dict: subst = Dict[found] if Program is InsideCommentProgram: if not Docomments: print 'Found in comment:', found i = i + n continue if found in NotInComment: ## print 'Ignored in comment:', ## print found, '-->', subst ## print 'Line:', line, subst = found ## else: ## print 'Substituting in comment:', ## print found, '-->', subst ## print 'Line:', line, line = line[:i] + subst + line[i+n:] n = len(subst) i = i + n return line Docomments = 0 def setdocomments(): global Docomments Docomments = 1 Reverse = 0 def setreverse(): global Reverse Reverse = (not Reverse) Dict = {} NotInComment = {} def addsubst(substfile): try: fp = open(substfile, 'r') except IOError, msg: err(substfile + ': cannot read substfile: ' + str(msg) + '\n') sys.exit(1) lineno = 0 while 1: line = fp.readline() if not line: break lineno = lineno + 1 try: i = line.index('#') except ValueError: i = -1 # Happens to delete trailing \n words = line[:i].split() if not words: continue if len(words) == 3 and words[0] == 'struct': words[:2] = [words[0] + ' ' + words[1]] elif len(words) != 2: err(substfile + '%s:%r: warning: bad line: %r' % (substfile, lineno, line)) continue if Reverse: [value, key] = words else: [key, value] = words if value[0] == '*': value = value[1:] if key[0] == '*': key = key[1:] NotInComment[key] = value if key in Dict: err('%s:%r: warning: overriding: %r %r\n' % (substfile, lineno, key, value)) err('%s:%r: warning: previous: %r\n' % (substfile, lineno, Dict[key])) Dict[key] = value fp.close() if __name__ == '__main__': main() PK! ܥ checkpip.pynuȯ#! /usr/bin/python2.7 """ Checks that the version of the projects bundled in ensurepip are the latest versions available. """ import ensurepip import json import urllib2 import sys def main(): outofdate = False for project, version in ensurepip._PROJECTS: data = json.loads(urllib2.urlopen( "https://pypi.python.org/pypi/{}/json".format(project), ).read().decode("utf8")) upstream_version = data["info"]["version"] if version != upstream_version: outofdate = True print("The latest version of {} on PyPI is {}, but ensurepip " "has {}".format(project, upstream_version, version)) if outofdate: sys.exit(1) if __name__ == "__main__": main() PK!ae cvsfiles.pynuȯ#! /usr/bin/python2.7 """Print a list of files that are mentioned in CVS directories. Usage: cvsfiles.py [-n file] [directory] ... If the '-n file' option is given, only files under CVS that are newer than the given file are printed; by default, all files under CVS are printed. As a special case, if a file does not exist, it is always printed. """ import os import sys import stat import getopt cutofftime = 0 def main(): try: opts, args = getopt.getopt(sys.argv[1:], "n:") except getopt.error, msg: print msg print __doc__, return 1 global cutofftime newerfile = None for o, a in opts: if o == '-n': cutofftime = getmtime(a) if args: for arg in args: process(arg) else: process(".") def process(dir): cvsdir = 0 subdirs = [] names = os.listdir(dir) for name in names: fullname = os.path.join(dir, name) if name == "CVS": cvsdir = fullname else: if os.path.isdir(fullname): if not os.path.islink(fullname): subdirs.append(fullname) if cvsdir: entries = os.path.join(cvsdir, "Entries") for e in open(entries).readlines(): words = e.split('/') if words[0] == '' and words[1:]: name = words[1] fullname = os.path.join(dir, name) if cutofftime and getmtime(fullname) <= cutofftime: pass else: print fullname for sub in subdirs: process(sub) def getmtime(filename): try: st = os.stat(filename) except os.error: return 0 return st[stat.ST_MTIME] if __name__ == '__main__': main() PK!R pysource.pyonu[ fc@sdZdZddddgZddlZddlZejdZeZd Z d Z d Z d Z d Z e ddZedkrxedgD] ZeGHqWdGHx%edgde D] ZeGHqWndS(sCList python source files. There are three functions to check whether a file is a Python source, listed here with increasing complexity: - has_python_ext() checks whether a file name ends in '.py[w]'. - look_like_python() checks whether the file is not binary and either has the '.py[w]' extension or the first line contains the word 'python'. - can_be_compiled() checks whether the file can be compiled by compile(). The file also must be of appropriate size - not bigger than a megabyte. walk_python_files() recursively lists all Python files under the given directories. sOleg Broytmann, Georg Brandlthas_python_exttlooks_like_pythontcan_be_compiledtwalk_python_filesiNs [--]cCstr|GHndS(N(tdebug(tmsg((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt print_debugscCsytj|j}Wn(tk r@}td||fdSX|dkretd||fdSyt|dSWn(tk r}td||fdSXdS(Ns%s: permission denied: %sis!%s: the file is too big: %d bytestrUs%s: access denied: %si(toststattst_sizetOSErrorRtNonetopentIOError(tfullpathtsizeterr((s./usr/lib64/python2.7/Tools/scripts/pysource.pyt_open!s cCs|jdp|jdS(Ns.pys.pyw(tendswith(R((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR2scCst|}|dkrtS|j}|jtj|rStd|tS|jdsq|jdrut Sd|krt StS(Ns%s: appears to be binarys.pys.pywtpython( RR tFalsetreadlinetcloset binary_retsearchRRtTrue(Rtinfiletline((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR5s     cCsut|}|dkrtS|j}|jyt||dWn(tk rp}td||ftSXtS(Ntexecs%s: cannot compile: %s( RR RtreadRtcompilet ExceptionRR(RRtcodeR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyRJs    c cs"|dkrg}nx|D]}td|tjj|rY||r|Vqqtjj|rtdxtj|D]\}}}x*|D]"}||kr|j|qqWxE|D]=}tjj||} td| || r| VqqWqWqtdqWdS(s^ Recursively yield all Python source files below the given paths. paths: a list of files and/or directories to be checked. is_python: a function that takes a file name and checks whether it is a Python source file exclude_dirs: a list of directory base names that should be excluded in the search s testing: %ss it is a directorys unknown typeN( R RRtpathtisfiletisdirtwalktremovetjoin( tpathst is_pythont exclude_dirsR"tdirpathtdirnamest filenamestexcludetfilenameR((s./usr/lib64/python2.7/Tools/scripts/pysource.pyR[s&          t__main__t.s ----------R)(t__doc__t __author__t__all__RtreRRRRRRRRRR Rt__name__R(((s./usr/lib64/python2.7/Tools/scripts/pysource.pyts"     !  PK!Srifdef.pynuȯ#! /usr/bin/python2.7 # Selectively preprocess #ifdef / #ifndef statements. # Usage: # ifdef [-Dname] ... [-Uname] ... [file] ... # # This scans the file(s), looking for #ifdef and #ifndef preprocessor # commands that test for one of the names mentioned in the -D and -U # options. On standard output it writes a copy of the input file(s) # minus those code sections that are suppressed by the selected # combination of defined/undefined symbols. The #if(n)def/#else/#else # lines themselves (if the #if(n)def tests for one of the mentioned # names) are removed as well. # Features: Arbitrary nesting of recognized and unrecognized # preprocessor statements works correctly. Unrecognized #if* commands # are left in place, so it will never remove too much, only too # little. It does accept whitespace around the '#' character. # Restrictions: There should be no comments or other symbols on the # #if(n)def lines. The effect of #define/#undef commands in the input # file or in included files is not taken into account. Tests using # #if and the defined() pseudo function are not recognized. The #elif # command is not recognized. Improperly nesting is not detected. # Lines that look like preprocessor commands but which are actually # part of comments or string literals will be mistaken for # preprocessor commands. import sys import getopt defs = [] undefs = [] def main(): opts, args = getopt.getopt(sys.argv[1:], 'D:U:') for o, a in opts: if o == '-D': defs.append(a) if o == '-U': undefs.append(a) if not args: args = ['-'] for filename in args: if filename == '-': process(sys.stdin, sys.stdout) else: f = open(filename, 'r') process(f, sys.stdout) f.close() def process(fpi, fpo): keywords = ('if', 'ifdef', 'ifndef', 'else', 'endif') ok = 1 stack = [] while 1: line = fpi.readline() if not line: break while line[-2:] == '\\\n': nextline = fpi.readline() if not nextline: break line = line + nextline tmp = line.strip() if tmp[:1] != '#': if ok: fpo.write(line) continue tmp = tmp[1:].strip() words = tmp.split() keyword = words[0] if keyword not in keywords: if ok: fpo.write(line) continue if keyword in ('ifdef', 'ifndef') and len(words) == 2: if keyword == 'ifdef': ko = 1 else: ko = 0 word = words[1] if word in defs: stack.append((ok, ko, word)) if not ko: ok = 0 elif word in undefs: stack.append((ok, not ko, word)) if ko: ok = 0 else: stack.append((ok, -1, word)) if ok: fpo.write(line) elif keyword == 'if': stack.append((ok, -1, '')) if ok: fpo.write(line) elif keyword == 'else' and stack: s_ok, s_ko, s_word = stack[-1] if s_ko < 0: if ok: fpo.write(line) else: s_ko = not s_ko ok = s_ok if not s_ko: ok = 0 stack[-1] = s_ok, s_ko, s_word elif keyword == 'endif' and stack: s_ok, s_ko, s_word = stack[-1] if s_ko < 0: if ok: fpo.write(line) del stack[-1] ok = s_ok else: sys.stderr.write('Unknown keyword %s\n' % keyword) if stack: sys.stderr.write('stack: %s\n' % stack) if __name__ == '__main__': main() PK!`''bbcrlf.pynuȯ#! /usr/bin/python2.7 "Replace CRLF with LF in argument files. Print names of changed files." import sys, os def main(): for filename in sys.argv[1:]: if os.path.isdir(filename): print filename, "Directory!" continue data = open(filename, "rb").read() if '\0' in data: print filename, "Binary!" continue newdata = data.replace("\r\n", "\n") if newdata != data: print filename f = open(filename, "wb") f.write(newdata) f.close() if __name__ == '__main__': main() PK!checkappend.pycnu[ fc@sdZd ZddlZddlZddlZddlZdadZdZdZ e d\Z Z Z ZZd d d YZed krendS(scheckappend.py -- search for multi-argument .append() calls. Usage: specify one or more file or directory paths: checkappend [-v] file_or_dir [file_or_dir] ... Each file_or_dir is checked for multi-argument .append() calls. When a directory, all .py files in the directory, and recursively in its subdirectories, are checked. Use -v for status msgs. Use -vv for more status msgs. In the absence of -v, the only output is pairs of the form filename(linenumber): line containing the suspicious append Note that this finds multi-argument append calls regardless of whether they're attached to list objects. If a module defines a class with an append method that takes more than one argument, calls to that method will be listed. Note that this will not find multi-argument list.append calls made via a bound method object. For example, this is not caught: somelist = [] push = somelist.append push(1, 2, 3) iiiNcGs3dj|}tjj|tjjddS(Nt s (tjointsyststderrtwrite(targstmsg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyterrprint+scCstjd}y#tjtjdd\}}Wn/tjk ra}tt|dtdSXx-|D]%\}}|dkritdaqiqiW|sttdSx|D]}t|qWdS(Nitvs s-v( RtargvtgetoptterrorRtstrt__doc__tverbosetcheck(RtoptsRtopttoptargtarg((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pytmain0s #   cCsKtjj|rtjj| rtr:d|fGHntj|}xq|D]i}tjj||}tjj|rtjj| stjj|ddkrPt|qPqPWdSyt |}Wn(t k r}t d||fdSXtdkrd|fGHnt ||j }trG|rGd|fGHndS(Ns%r: listing directoryis.pys%r: I/O Error: %sischecking %r ...s%r: Clean bill of health.(tostpathtisdirtislinkRtlistdirRtnormcaseRtopentIOErrorRt AppendCheckertrun(tfiletnamestnametfullnametfRtok((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRAs*%   iRcBsDeZdZdZejejejfejej dZ RS(cCs(||_||_t|_d|_dS(Ni(tfnameRtFIND_DOTtstatetnerrors(tselfR%R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt__init__bs   cCsjytj|jj|jWn=tjk r\}td|j|f|jd|_nX|jdkS(Ns%r: Token Error: %sii(ttokenizeRtreadlinet tokeneatert TokenErrorRR%R((R)R((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRhs c Cs|j} ||krn| tkrH||kr|dkrt} qn| tkr|| kr|dkr||_|d|_t} qt} n9| tkr||kr|dkrd|_t} qt} n| tkr||kr|dkr |jd|_q|dkrA|jd|_|jdkrt} qq|d kr|jdkr|jd|_d |j |j|jfGHt } qqn7| t kr||krt} qnt d | f| |_dS(Nt.tappendit(it{t[t)t}t]t,s %s(%d): %ssunknown internal state '%r'(R1R2R3(R4R5R6( R'R&t FIND_APPENDtlinetlinenot FIND_LPARENtlevelt FIND_COMMAR(R%t FIND_STMTt SystemError( R)ttypettokentstarttendR9tNEWLINEtJUNKtOPtNAMER'((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyR-psF                      ( t__name__t __module__R*RR+RDtCOMMENTtNLRFRGR-(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyRas   t__main__(iii((R t __version__RRR R+RRRRtrangeR&R8R;R=R>RRH(((s1/usr/lib64/python2.7/Tools/scripts/checkappend.pyt s       E PK!Xj fixps.pyonu[ fc@s;ddlZddlZdZedkr7endS(iNcCsxtjdD]}yt|d}Wn#tk rL}|GdG|GHqnX|j}tjd|s|GdGH|jqn|j}|jtj dd|}|GdGt |GHt|d }|j ||j ||jqWdS( Nitrs: can't open :s^#! */usr/local/bin/pythons$: not a /usr/local/bin/python scripts/usr/local/bin/pythons/usr/bin/env pythont:tw( tsystargvtopentIOErrortreadlinetretmatchtclosetreadtsubtreprtwrite(tfilenametftmsgtlinetrest((s+/usr/lib64/python2.7/Tools/scripts/fixps.pytmain s(          t__main__(RRRt__name__(((s+/usr/lib64/python2.7/Tools/scripts/fixps.pyts    PK!tw!Ycombinerefs.pynuȯ#! /usr/bin/python2.7 """ combinerefs path A helper for analyzing PYTHONDUMPREFS output. When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown time Py_Finalize() prints the list of all live objects twice: first it prints the repr() of each object while the interpreter is still fully intact. After cleaning up everything it can, it prints all remaining live objects again, but the second time just prints their addresses, refcounts, and type names (because the interpreter has been torn down, calling repr methods at this point can get into infinite loops or blow up). Save all this output into a file, then run this script passing the path to that file. The script finds both output chunks, combines them, then prints a line of output for each object still alive at the end: address refcnt typename repr address is the address of the object, in whatever format the platform C produces for a %p format code. refcnt is of the form "[" ref "]" when the object's refcount is the same in both PYTHONDUMPREFS output blocks, or "[" ref_before "->" ref_after "]" if the refcount changed. typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS output block. repr is repr(object), extracted from the first PYTHONDUMPREFS output block. CAUTION: If object is a container type, it may not actually contain all the objects shown in the repr: the repr was captured from the first output block, and some of the containees may have been released since then. For example, it's common for the line showing the dict of interned strings to display strings that no longer exist at the end of Py_Finalize; this can be recognized (albeit painfully) because such containees don't have a line of their own. The objects are listed in allocation order, with most-recently allocated printed first, and the first object allocated printed last. Simple examples: 00857060 [14] str '__len__' The str object '__len__' is alive at shutdown time, and both PYTHONDUMPREFS output blocks said there were 14 references to it. This is probably due to C modules that intern the string "__len__" and keep a reference to it in a file static. 00857038 [46->5] tuple () 46-5 = 41 references to the empty tuple were removed by the cleanup actions between the times PYTHONDUMPREFS produced output. 00858028 [1025->1456] str '' The string '', which is used in dictobject.c to overwrite a real key that gets deleted, grew several hundred references during cleanup. It suggests that stuff did get removed from dicts by cleanup, but that the dicts themselves are staying alive for some reason. """ import re import sys # Generate lines from fileiter. If whilematch is true, continue reading # while the regexp object pat matches line. If whilematch is false, lines # are read so long as pat doesn't match them. In any case, the first line # that doesn't match pat (when whilematch is true), or that does match pat # (when whilematch is false), is lost, and fileiter will resume at the line # following it. def read(fileiter, pat, whilematch): for line in fileiter: if bool(pat.match(line)) == whilematch: yield line else: break def combine(fname): f = file(fname) fi = iter(f) for line in read(fi, re.compile(r'^Remaining objects:$'), False): pass crack = re.compile(r'([a-zA-Z\d]+) \[(\d+)\] (.*)') addr2rc = {} addr2guts = {} before = 0 for line in read(fi, re.compile(r'^Remaining object addresses:$'), False): m = crack.match(line) if m: addr, addr2rc[addr], addr2guts[addr] = m.groups() before += 1 else: print '??? skipped:', line after = 0 for line in read(fi, crack, True): after += 1 m = crack.match(line) assert m addr, rc, guts = m.groups() # guts is type name here if addr not in addr2rc: print '??? new object created while tearing down:', line.rstrip() continue print addr, if rc == addr2rc[addr]: print '[%s]' % rc, else: print '[%s->%s]' % (addr2rc[addr], rc), print guts, addr2guts[addr] f.close() print "%d objects before, %d after" % (before, after) if __name__ == '__main__': combine(sys.argv[1]) PK!K< finddiv.pynuȯ#! /usr/bin/python2.7 """finddiv - a grep-like tool that looks for division operators. Usage: finddiv [-l] file_or_directory ... For directory arguments, all files in the directory whose name ends in .py are processed, and subdirectories are processed recursively. This actually tokenizes the files to avoid false hits in comments or strings literals. By default, this prints all lines containing a / or /= operator, in grep -n style. With the -l option specified, it prints the filename of files that contain at least one / or /= operator. """ import os import sys import getopt import tokenize def main(): try: opts, args = getopt.getopt(sys.argv[1:], "lh") except getopt.error, msg: usage(msg) return 2 if not args: usage("at least one file argument is required") return 2 listnames = 0 for o, a in opts: if o == "-h": print __doc__ return if o == "-l": listnames = 1 exit = None for filename in args: x = process(filename, listnames) exit = exit or x return exit def usage(msg): sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Usage: %s [-l] file ...\n" % sys.argv[0]) sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0]) def process(filename, listnames): if os.path.isdir(filename): return processdir(filename, listnames) try: fp = open(filename) except IOError, msg: sys.stderr.write("Can't open: %s\n" % msg) return 1 g = tokenize.generate_tokens(fp.readline) lastrow = None for type, token, (row, col), end, line in g: if token in ("/", "/="): if listnames: print filename break if row != lastrow: lastrow = row print "%s:%d:%s" % (filename, row, line), fp.close() def processdir(dir, listnames): try: names = os.listdir(dir) except os.error, msg: sys.stderr.write("Can't list directory: %s\n" % dir) return 1 files = [] for name in names: fn = os.path.join(dir, name) if os.path.normcase(fn).endswith(".py") or os.path.isdir(fn): files.append(fn) files.sort(lambda a, b: cmp(os.path.normcase(a), os.path.normcase(b))) exit = None for fn in files: x = process(fn, listnames) exit = exit or x return exit if __name__ == "__main__": sys.exit(main()) PK!:zVV methfix.pynuȯ#! /usr/bin/python2.7 # Fix Python source files to avoid using # def method(self, (arg1, ..., argn)): # instead of the more rational # def method(self, arg1, ..., argn): # # Command line arguments are files or directories to be processed. # Directories are searched recursively for files whose name looks # like a python module. # Symbolic links are always ignored (except as explicit directory # arguments). Of course, the original file is kept as a back-up # (with a "~" attached to its name). # It complains about binaries (files containing null bytes) # and about files that are ostensibly not Python files: if the first # line starts with '#!' and does not contain the string 'python'. # # Changes made are reported to stdout in a diff-like format. # # Undoubtedly you can do this using find and sed or perl, but this is # a nice example of Python code that recurses down a directory tree # and uses regular expressions. Also note several subtleties like # preserving the file's mode and avoiding to even write a temp file # when no changes are needed for a file. # # NB: by changing only the function fixline() you can turn this # into a program for a different change to Python programs... import sys import re import os from stat import * err = sys.stderr.write dbg = err rep = sys.stdout.write def main(): bad = 0 if not sys.argv[1:]: # No arguments err('usage: ' + sys.argv[0] + ' file-or-directory ...\n') sys.exit(2) for arg in sys.argv[1:]: if os.path.isdir(arg): if recursedown(arg): bad = 1 elif os.path.islink(arg): err(arg + ': will not process symbolic links\n') bad = 1 else: if fix(arg): bad = 1 sys.exit(bad) ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$') def ispython(name): return ispythonprog.match(name) >= 0 def recursedown(dirname): dbg('recursedown(%r)\n' % (dirname,)) bad = 0 try: names = os.listdir(dirname) except os.error, msg: err('%s: cannot list directory: %r\n' % (dirname, msg)) return 1 names.sort() subdirs = [] for name in names: if name in (os.curdir, os.pardir): continue fullname = os.path.join(dirname, name) if os.path.islink(fullname): pass elif os.path.isdir(fullname): subdirs.append(fullname) elif ispython(name): if fix(fullname): bad = 1 for fullname in subdirs: if recursedown(fullname): bad = 1 return bad def fix(filename): ## dbg('fix(%r)\n' % (filename,)) try: f = open(filename, 'r') except IOError, msg: err('%s: cannot open: %r\n' % (filename, msg)) return 1 head, tail = os.path.split(filename) tempname = os.path.join(head, '@' + tail) g = None # If we find a match, we rewind the file and start over but # now copy everything to a temp file. lineno = 0 while 1: line = f.readline() if not line: break lineno = lineno + 1 if g is None and '\0' in line: # Check for binary files err(filename + ': contains null bytes; not fixed\n') f.close() return 1 if lineno == 1 and g is None and line[:2] == '#!': # Check for non-Python scripts words = line[2:].split() if words and re.search('[pP]ython', words[0]) < 0: msg = filename + ': ' + words[0] msg = msg + ' script; not fixed\n' err(msg) f.close() return 1 while line[-2:] == '\\\n': nextline = f.readline() if not nextline: break line = line + nextline lineno = lineno + 1 newline = fixline(line) if newline != line: if g is None: try: g = open(tempname, 'w') except IOError, msg: f.close() err('%s: cannot create: %r\n' % (tempname, msg)) return 1 f.seek(0) lineno = 0 rep(filename + ':\n') continue # restart from the beginning rep(repr(lineno) + '\n') rep('< ' + line) rep('> ' + newline) if g is not None: g.write(newline) # End of file f.close() if not g: return 0 # No changes # Finishing touch -- move files # First copy the file's mode to the temp file try: statbuf = os.stat(filename) os.chmod(tempname, statbuf[ST_MODE] & 07777) except os.error, msg: err('%s: warning: chmod failed (%r)\n' % (tempname, msg)) # Then make a backup of the original file as filename~ try: os.rename(filename, filename + '~') except os.error, msg: err('%s: warning: backup failed (%r)\n' % (filename, msg)) # Now move the temp file to the original file try: os.rename(tempname, filename) except os.error, msg: err('%s: rename failed (%r)\n' % (filename, msg)) return 1 # Return succes return 0 fixpat = '^[ \t]+def +[a-zA-Z0-9_]+ *( *self *, *(( *(.*) *)) *) *:' fixprog = re.compile(fixpat) def fixline(line): if fixprog.match(line) >= 0: (a, b), (c, d) = fixprog.regs[1:3] line = line[:a] + line[c:d] + line[b:] return line if __name__ == '__main__': main() PK!F8kI#I#common/Activate.ps1nu[<# .Synopsis Activate a Python virtual environment for the current PowerShell session. .Description Pushes the python executable for a virtual environment to the front of the $Env:PATH environment variable and sets the prompt to signify that you are in a Python virtual environment. Makes use of the command line switches as well as the `pyvenv.cfg` file values present in the virtual environment. .Parameter VenvDir Path to the directory that contains the virtual environment to activate. The default value for this is the parent of the directory that the Activate.ps1 script is located within. .Parameter Prompt The prompt prefix to display when this virtual environment is activated. By default, this prompt is the name of the virtual environment folder (VenvDir) surrounded by parentheses and followed by a single space (ie. '(.venv) '). .Example Activate.ps1 Activates the Python virtual environment that contains the Activate.ps1 script. .Example Activate.ps1 -Verbose Activates the Python virtual environment that contains the Activate.ps1 script, and shows extra information about the activation as it executes. .Example Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv Activates the Python virtual environment located in the specified location. .Example Activate.ps1 -Prompt "MyPython" Activates the Python virtual environment that contains the Activate.ps1 script, and prefixes the current prompt with the specified string (surrounded in parentheses) while the virtual environment is active. .Notes On Windows, it may be required to enable this Activate.ps1 script by setting the execution policy for the user. You can do this by issuing the following PowerShell command: PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser For more information on Execution Policies: https://go.microsoft.com/fwlink/?LinkID=135170 #> Param( [Parameter(Mandatory = $false)] [String] $VenvDir, [Parameter(Mandatory = $false)] [String] $Prompt ) <# Function declarations --------------------------------------------------- #> <# .Synopsis Remove all shell session elements added by the Activate script, including the addition of the virtual environment's Python executable from the beginning of the PATH variable. .Parameter NonDestructive If present, do not remove this function from the global namespace for the session. #> function global:deactivate ([switch]$NonDestructive) { # Revert to original values # The prior prompt: if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT } # The prior PYTHONHOME: if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME } # The prior PATH: if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH Remove-Item -Path Env:_OLD_VIRTUAL_PATH } # Just remove the VIRTUAL_ENV altogether: if (Test-Path -Path Env:VIRTUAL_ENV) { Remove-Item -Path env:VIRTUAL_ENV } # Just remove VIRTUAL_ENV_PROMPT altogether. if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { Remove-Item -Path env:VIRTUAL_ENV_PROMPT } # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force } # Leave deactivate function in the global namespace if requested: if (-not $NonDestructive) { Remove-Item -Path function:deactivate } } <# .Description Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the given folder, and returns them in a map. For each line in the pyvenv.cfg file, if that line can be parsed into exactly two strings separated by `=` (with any amount of whitespace surrounding the =) then it is considered a `key = value` line. The left hand string is the key, the right hand is the value. If the value starts with a `'` or a `"` then the first and last character is stripped from the value before being captured. .Parameter ConfigDir Path to the directory that contains the `pyvenv.cfg` file. #> function Get-PyVenvConfig( [String] $ConfigDir ) { Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue # An empty map will be returned if no config file is found. $pyvenvConfig = @{ } if ($pyvenvConfigPath) { Write-Verbose "File exists, parse `key = value` lines" $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath $pyvenvConfigContent | ForEach-Object { $keyval = $PSItem -split "\s*=\s*", 2 if ($keyval[0] -and $keyval[1]) { $val = $keyval[1] # Remove extraneous quotations around a string value. if ("'""".Contains($val.Substring(0, 1))) { $val = $val.Substring(1, $val.Length - 2) } $pyvenvConfig[$keyval[0]] = $val Write-Verbose "Adding Key: '$($keyval[0])'='$val'" } } } return $pyvenvConfig } <# Begin Activate script --------------------------------------------------- #> # Determine the containing directory of this script $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition $VenvExecDir = Get-Item -Path $VenvExecPath Write-Verbose "Activation script is located in path: '$VenvExecPath'" Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" # Set values required in priority: CmdLine, ConfigFile, Default # First, get the location of the virtual environment, it might not be # VenvExecDir if specified on the command line. if ($VenvDir) { Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" } else { Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") Write-Verbose "VenvDir=$VenvDir" } # Next, read the `pyvenv.cfg` file to determine any required value such # as `prompt`. $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir # Next, set the prompt from the command line, or the config file, or # just use the name of the virtual environment folder. if ($Prompt) { Write-Verbose "Prompt specified as argument, using '$Prompt'" } else { Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" if ($pyvenvCfg -and $pyvenvCfg['prompt']) { Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" $Prompt = $pyvenvCfg['prompt']; } else { Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" $Prompt = Split-Path -Path $venvDir -Leaf } } Write-Verbose "Prompt = '$Prompt'" Write-Verbose "VenvDir='$VenvDir'" # Deactivate any currently active virtual environment, but leave the # deactivate function in place. deactivate -nondestructive # Now set the environment variable VIRTUAL_ENV, used by many tools to determine # that there is an activated venv. $env:VIRTUAL_ENV = $VenvDir if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { Write-Verbose "Setting prompt to '$Prompt'" # Set the prompt to include the env name # Make sure _OLD_VIRTUAL_PROMPT is global function global:_OLD_VIRTUAL_PROMPT { "" } Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt function global:prompt { Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " _OLD_VIRTUAL_PROMPT } $env:VIRTUAL_ENV_PROMPT = $Prompt } # Clear PYTHONHOME if (Test-Path -Path Env:PYTHONHOME) { Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME Remove-Item -Path Env:PYTHONHOME } # Add the venv to the PATH Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH $Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" PK!?\common/activatenu[# This file must be used with "source bin/activate" *from bash* # you cannot run it directly deactivate () { # reset old environment variables if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then PATH="${_OLD_VIRTUAL_PATH:-}" export PATH unset _OLD_VIRTUAL_PATH fi if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" export PYTHONHOME unset _OLD_VIRTUAL_PYTHONHOME fi # Call hash to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected hash -r 2> /dev/null if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then PS1="${_OLD_VIRTUAL_PS1:-}" export PS1 unset _OLD_VIRTUAL_PS1 fi unset VIRTUAL_ENV unset VIRTUAL_ENV_PROMPT if [ ! "${1:-}" = "nondestructive" ] ; then # Self destruct! unset -f deactivate fi } # unset irrelevant variables deactivate nondestructive VIRTUAL_ENV=__VENV_DIR__ export VIRTUAL_ENV _OLD_VIRTUAL_PATH="$PATH" PATH="$VIRTUAL_ENV/"__VENV_BIN_NAME__":$PATH" export PATH # unset PYTHONHOME if set # this will fail if PYTHONHOME is set to the empty string (which is bad anyway) # could use `if (set -u; : $PYTHONHOME) ;` in bash if [ -n "${PYTHONHOME:-}" ] ; then _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" unset PYTHONHOME fi if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then _OLD_VIRTUAL_PS1="${PS1:-}" PS1=__VENV_PROMPT__"${PS1:-}" export PS1 VIRTUAL_ENV_PROMPT=__VENV_PROMPT__ export VIRTUAL_ENV_PROMPT fi # Call hash to forget past commands. Without forgetting # past commands the $PATH changes we made may not be respected hash -r 2> /dev/null PK!@+posix/activate.cshnu[# This file must be used with "source bin/activate.csh" *from csh*. # You cannot run it directly. # Created by Davide Di Blasi . # Ported to Python 3.3 venv by Andrew Svetlov alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' # Unset irrelevant variables. deactivate nondestructive setenv VIRTUAL_ENV __VENV_DIR__ set _OLD_VIRTUAL_PATH="$PATH" setenv PATH "$VIRTUAL_ENV/"__VENV_BIN_NAME__":$PATH" set _OLD_VIRTUAL_PROMPT="$prompt" if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then set prompt = __VENV_PROMPT__"$prompt" setenv VIRTUAL_ENV_PROMPT __VENV_PROMPT__ endif alias pydoc python -m pydoc rehash PK!Pposix/activate.fishnu[# This file must be used with "source /bin/activate.fish" *from fish* # (https://fishshell.com/); you cannot run it directly. function deactivate -d "Exit virtual environment and return to normal shell environment" # reset old environment variables if test -n "$_OLD_VIRTUAL_PATH" set -gx PATH $_OLD_VIRTUAL_PATH set -e _OLD_VIRTUAL_PATH end if test -n "$_OLD_VIRTUAL_PYTHONHOME" set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME set -e _OLD_VIRTUAL_PYTHONHOME end if test -n "$_OLD_FISH_PROMPT_OVERRIDE" set -e _OLD_FISH_PROMPT_OVERRIDE # prevents error when using nested fish instances (Issue #93858) if functions -q _old_fish_prompt functions -e fish_prompt functions -c _old_fish_prompt fish_prompt functions -e _old_fish_prompt end end set -e VIRTUAL_ENV set -e VIRTUAL_ENV_PROMPT if test "$argv[1]" != "nondestructive" # Self-destruct! functions -e deactivate end end # Unset irrelevant variables. deactivate nondestructive set -gx VIRTUAL_ENV __VENV_DIR__ set -gx _OLD_VIRTUAL_PATH $PATH set -gx PATH "$VIRTUAL_ENV/"__VENV_BIN_NAME__ $PATH # Unset PYTHONHOME if set. if set -q PYTHONHOME set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME set -e PYTHONHOME end if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" # fish uses a function instead of an env var to generate the prompt. # Save the current fish_prompt function as the function _old_fish_prompt. functions -c fish_prompt _old_fish_prompt # With the original prompt function renamed, we can override with our own. function fish_prompt # Save the return status of the last command. set -l old_status $status # Output the venv prompt; color taken from the blue of the Python logo. printf "%s%s%s" (set_color 4B8BBE) __VENV_PROMPT__ (set_color normal) # Restore the return status of the previous command. echo "exit $old_status" | . # Output the original/"old" prompt. _old_fish_prompt end set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" set -gx VIRTUAL_ENV_PROMPT __VENV_PROMPT__ end PK!sJo update-dist-tags.jsnu['use strict' /** * Usage: * * node scripts/update-dist-tags.js --otp * node scripts/update-dist-tags.js --otp= * node scripts/update-dist-tags.js --otp */ const usage = ` Usage: node scripts/update-dist-tags.js --otp node scripts/update-dist-tags.js --otp= node scripts/update-dist-tags.js --otp ` const { execSync } = require('child_process') const semver = require('semver') const path = require('path') const getMajorVersion = (input) => semver.parse(input).major const getMinorVersion = (input) => semver.parse(input).minor // INFO: String templates to generate the tags to update const LATEST_TAG = (strings, major) => `latest-${major}` const NEXT_TAG = (strings, major) => `next-${major}` const TAG_LIST = ['lts', 'next', 'latest'] const REMOVE_TAG = (strings, major, minor) => `v${major}.${minor}-next` // INFO: Finds `--otp` and subsequently otp value (if present) const PARSE_OTP_FLAG = new RegExp(/(--otp)(=|\s)?([0-9]{6})?/, 'gm') // INFO: Used to validate otp value (if not found by other regexp) const PARSE_OTP_VALUE = new RegExp(/^[0-9]{6}$/, 'g') const args = process.argv.slice(2) const versionPath = path.resolve(__dirname, '..', 'package.json') const { version } = require(versionPath) // Run Script main() function main () { const otp = parseOTP(args) if (version) { const major = getMajorVersion(version) const minor = getMinorVersion(version) const latestTag = LATEST_TAG`${major}` const nextTag = NEXT_TAG`${major}` const removeTag = REMOVE_TAG`${major}${minor}` const updateList = [].concat(TAG_LIST, latestTag, nextTag) updateList.forEach((tag) => { setDistTag(tag, version, otp) }) removeDistTag(removeTag, version, otp) } else { console.error('Invalid semver.') process.exit(1) } } function parseOTP (args) { // NOTE: making assumption first _thing_ is a string with "--otp" in it const parsedArgs = PARSE_OTP_FLAG.exec(args[0]) if (!parsedArgs) { console.error('Invalid arguments supplied. Must supply --otp flag.') console.error(usage) process.exit(1) } // INFO: From the regexp, third group is the OTP code const otp = parsedArgs[3] switch (args.length) { case 0: { console.error('No arguments supplied.') console.error(usage) process.exit(1) } case 1: { // --otp=123456 or --otp123456 if (otp) { return otp } console.error('Invalid otp value supplied. [CASE 1]') process.exit(1) } case 2: { // --otp 123456 // INFO: validating the second argument is an otp code const isValidOtp = PARSE_OTP_VALUE.test(args[1]) if (isValidOtp) { return args[1] } console.error('Invalid otp value supplied. [CASE 2]') process.exit(1) } default: { console.error('Invalid arguments supplied.') process.exit(1) } } } function setDistTag (tag, version, otp) { try { const result = execSync(`npm dist-tag set npm@${version} ${tag} --otp=${otp}`, { encoding: 'utf-8' }) console.log('Result:', result) } catch (err) { console.error('Bad dist-tag command.') process.exit(1) } } function removeDistTag (tag, version, otp) { try { const result = execSync(`npm dist-tag rm npm ${tag} --otp=${otp}`, { encoding: 'utf-8' }) console.log('Result:', result) } catch (err) { console.error('Bad dist-tag command.') process.exit(1) } } PK!kEuLL docs-build.jsnu[#!/opt/alt/alt-nodejs8/root/usr/bin/node var fs = require('fs') var marked = require('marked-man') var npm = require('../lib/npm.js') var args = process.argv.slice(2) var src = args[0] var dest = args[1] || src fs.readFile(src, 'utf8', function (err, data) { if (err) return console.log(err) function replacer (match, p1) { return 'npm help ' + p1.replace(/npm /, '') } var result = data.replace(/@VERSION@/g, npm.version) .replace(/---([\s\S]+)---/g, '') .replace(/\[([^\]]+)\]\(\/cli-commands\/([^)]+)\)/g, replacer) .replace(/\[([^\]]+)\]\(\/configuring-npm\/([^)]+)\)/g, replacer) .replace(/\[([^\]]+)\]\(\/using-npm\/([^)]+)\)/g, replacer) .replace(/(# .*)\s+(## (.*))/g, '$1 - $3') .trim() fs.writeFile(dest, marked(result), 'utf8', function (err) { if (err) return console.log(err) }) }) PK!\5.prnuȯ#!/usr/bin/bash # Land a pull request # Creates a PR-### branch, pulls the commits, opens up an interactive rebase to # squash, and then annotates the commit with the changelog goobers # # Usage: # pr [=origin] main () { if [ "$1" = "finish" ]; then shift finish "$@" return $? fi local url="$(prurl "$@")" local num=$(basename $url) local prpath="${url#git@github.com:}" local repo=${prpath%/pull/$num} local prweb="https://github.com/$prpath" local root="$(prroot "$url")" local api="https://api.github.com/repos/${repo}/pulls/${num}" local user=$(curl -s $api | json user.login) local ref="$(prref "$url" "$root")" local curhead="$(git show --no-patch --pretty=%H HEAD)" local curbranch="$(git rev-parse --abbrev-ref HEAD)" local cleanlines IFS=$'\n' cleanlines=($(git status -s -uno)) if [ ${#cleanlines[@]} -ne 0 ]; then echo "working dir not clean" >&2 IFS=$'\n' echo "${cleanlines[@]}" >&2 echo "aborting PR merge" >&2 fi # ok, ready to rock branch=PR-$num if [ "$curbranch" == "$branch" ]; then echo "already on $branch, you're on your own" >&2 return 1 fi me=$(git config github.user || git config user.name) if [ "$me" == "" ]; then echo "run 'git config --add github.user '" >&2 return 1 fi exists=$(git show --no-patch --pretty=%H $branch 2>/dev/null) if [ "$exists" == "" ]; then git fetch origin pull/$num/head:$branch git checkout $branch else git checkout $branch git pull --rebase origin pull/$num/head fi git rebase -i $curbranch # squash and test if [ $? -eq 0 ]; then finish "${curbranch}" else echo "resolve conflicts and run: $0 finish "'"'${curbranch}'"' fi } # add the PR-URL to the last commit, after squashing finish () { if [ $# -eq 0 ]; then echo "Usage: $0 finish (while on a PR-### branch)" >&2 return 1 fi local curbranch="$1" local ref=$(cat .git/HEAD) local prnum case $ref in "ref: refs/heads/PR-"*) prnum=${ref#ref: refs/heads/PR-} ;; *) echo "not on the PR-## branch any more!" >&2 return 1 ;; esac local me=$(git config github.user || git config user.name) if [ "$me" == "" ]; then echo "run 'git config --add github.user '" >&2 return 1 fi set -x local url="$(prurl "$prnum")" local num=$prnum local prpath="${url#git@github.com:}" local repo=${prpath%/pull/$num} local prweb="https://github.com/$prpath" local root="$(prroot "$url")" local api="https://api.github.com/repos/${repo}/pulls/${num}" local user=$(curl -s $api | json user.login) local lastmsg="$(git log -1 --pretty=%B)" local newmsg="${lastmsg} PR-URL: ${prweb} Credit: @${user} Close: #${num} Reviewed-by: @${me} " git commit --amend -m "$newmsg" git checkout $curbranch git merge PR-${prnum} --ff-only set +x } prurl () { local url="$1" if [ "$url" == "" ] && type pbpaste &>/dev/null; then url="$(pbpaste)" fi if [[ "$url" =~ ^[0-9]+$ ]]; then local us="$2" if [ "$us" == "" ]; then us="origin" fi local num="$url" local o="$(git config --get remote.${us}.url)" url="${o}" url="${url#(git:\/\/|https:\/\/)}" url="${url#git@}" url="${url#github.com[:\/]}" url="${url%.git}" url="https://github.com/${url}/pull/$num" fi url=${url%/commits} url=${url%/files} url="$(echo $url | perl -p -e 's/#issuecomment-[0-9]+$//g')" local p='^https:\/\/github.com\/[^\/]+\/[^\/]+\/pull\/[0-9]+$' if ! [[ "$url" =~ $p ]]; then echo "Usage:" echo " $0 " echo " $0 [=origin]" type pbpaste &>/dev/null && echo "(will read url/id from clipboard if not specified)" exit 1 fi url="${url/https:\/\/github\.com\//git@github.com:}" echo "$url" } prroot () { local url="$1" echo "${url/\/pull\/+([0-9])/}" } prref () { local url="$1" local root="$2" echo "refs${url:${#root}}/head" } main "$@" PK!))frisk.gonu[GOOF----LE-8-2.0)]4h] gguile  gdefine-module*   gscripts gfrisk  gfilenameS fscripts/frisk.scm gimportsS gsrfi gsrfi-1    gselectS gfilter gremove    gexportsS g make-frisker g mod-up-ls g mod-down-ls gmod-int? g edge-type gedge-up g edge-down  g autoloadsS gice-9 g getopt-long !  "  #!" $gset-current-module %$ &$ 'g%include-in-guild-list (f)Show dependency information for a module. )g%summary *g guile-user +* ,g*default-module* -g open-file .fr /g eof-object? 0g define-module 1gdef 2g use-moduleS 3g :use-module 4gregular 5gautoloadS 6g :autoload 7gautoload 8g use-modules 9gfor-each :gload ;gprimitive-load gformat ?f[computed in ~A] @gread Ag grok-proc Bgmake-object-property Cgup-ls Dgdn-ls Egint? Fgi Ggx Hgi-or-x Igsetter JI KI Lg make-edge Mgcar Ngcdr Ogup-ls+! Pgdn-ls+! Qgassq-ref Rg make-body Sgmember Tgmodules Uginternal Vgexternal Wgi-up Xgmap Ygx-up Zgi-down [gx-down \gedges ]gscan ^gdefault-module _f~A ~A --- ~A --- ~A  `g dump-updown af~A ~A  bf ~A ~A  cgdump-up dg dump-down effrisk fgupstream gg single-char hgu ifh jg downstream kgd ljk mgi nUm ogx pVo qgm rgvalue sr t^qs uilnpt vg option-ref wf$~A ~A, ~A ~A (~A ~A, ~A ~A), ~A ~A  xglength yffiles zfmodules {finternal |fexternal }fedges ~gmainC5hg]4   #5 4&>"G'R()R+,R-./01234567894h8] LM$"L$"6guse  4gt  gmaybe  2gfilenamefscripts/frisk.scm !  .  .  s "  s  # t  ' t  4 #  4 C:;<=>?@h]I45H"45$C$$K4L>"G"("$"$>4L  $ " >"G" $" $#4L >"G"b"Y"N" $"4 LLO>"G"f$"$O4LJ$"L45$" 45>"G"45"\45"O45"Bgfilename  gp gcurmod   gform   gt   gkey  0 gmodule  ? gls  ^ gkey  k guse  gmaybe gt  ` sgfile  w  gfilenamefscripts/frisk.scm o   p  p " p  p   x   y   y  ) z  - y  0 {  0 {  > } % ? }  E ~  F   J  $ R   ^  d  k % k  " - E = s " s  t  t  " ( "  " - > " ( " -  '    {  !  1 ! 6  K {  Z  ^ " ` " v . w " z (  $  (  3  (    q     q   z "  x   q   x C   Ch]OCgdefault-module  g note-use!  gfilenamefscripts/frisk.scm n   gnameg grok-procCAR4Bi5CR4Bi5DR4Bi5ERCiRDiREiREFGh]45$CCgmodule  gfilenamefscripts/frisk.scm          gnamegi-or-xCHR4Bi5RKh(] 445>"GCgtype  %gup  %gdown   %gnew   %gfilenamefscripts/frisk.scm      % gnameg make-edgeCLRMiRNiRKCh]45456gm  gnew  gfilenamefscripts/frisk.scm  2  (     gnamegup-ls+!CORKDh]45456gm  gnew  gfilenamefscripts/frisk.scm  2  (     gnamegdn-ls+!CPRQh`]L6Xgkey  gfilenamefscripts/frisk.scm    Chn]OCfgalist  gfilenamefscripts/frisk.scm   gnameg make-bodyCRRASKCD1ELOP h]4M5$"=445>"G445>"GMN& 4564M5$"=445>"G445>"GMN45MN4>"G 6gtype  gd  gu   gt  Zgd  Z gt  y gu  gedge  gfilenamefscripts/frisk.scm       ' 4 ,  5  A 4 F  S - U  Z  ` , d  p " q  y   4   4  -  " / " 0 $ $ $!  C9RTUEVWXYZ[\h]HH4O54>"GJ4J5 4 J5 44  J554 4  J5544 J554 4 J55J6gdefault-module  gfiles  gmodules   gedges  ggrok   gfilenamefscripts/frisk.scm            6  <  E  H  Q  T  Y ! c  d  g  l ! v  w  z   !    !     gnamegscanC]RQ^,]hb]L6Zgfiles  gfilenamefscripts/frisk.scm    Ch0-1345$"OCgoptions /gt  %gdefault-module % /gfilenamefscripts/frisk.scm   .     %  / gnameg make-friskerCR9>_HXhs]4545Ckgedge  gfilenamefscripts/frisk.scm   # #     CChs]4545Ckgedge  gfilenamefscripts/frisk.scm   # #     CD h0]45445544556gm  .gfilenamefscripts/frisk.scm             $  ,  .   . Ch{]6sgmodules  gfilenamefscripts/frisk.scm   gnameg dump-updownC`R9>aH9>bh|]45456tgedge  gfilenamefscripts/frisk.scm   %  "  3     CCh0]445>"G456gm  +gfilenamefscripts/frisk.scm     #   #  +   + Chw]6ogmodules  gfilenamefscripts/frisk.scm   gnamegdump-upCcR9>aH9>bh|]45456tgedge  gfilenamefscripts/frisk.scm   %  "  3     CDh0]445>"G456gm  +gfilenamefscripts/frisk.scm     #   #  +   + Chy]6qgmodules  gfilenamefscripts/frisk.scm   gnameg dump-downCdR euvfjUV^,T\>wxyz{|}`cdh-13 45454545454544  4  5554 545 45 4 5 445454 54 54 5> "G$$""$$" " 6gargs g parsed-opts  g=u  ! g=d  - g=i  9 g=x  E gfiles  R greport  l gmodules  u ginternal ~ gexternal gedges  gfilenamefscripts/frisk.scm                % !  !  $  *  % -  -  0  6  % 9  9  <  B  % E  E  H   M  + P  / R   R  U   V   Z   [   a  3 e   f   h   l   l  o   s   u   u  x   |   ~   ~                                             I  gnamegfriskCRi~RC_gm  0gfilenamefscripts/frisk.scm  a 4 i 6 j  9 j ; l  > l  n                 W  )   ^ z     !   C6PK!X)lread-text-outline.gonu[GOOF----LE-8-2.0]L4h] gguile  gdefine-module*   gscripts gread-text-outline  gfilenameS fscripts/read-text-outline.scm gimportsS gice-9 gregex      gexportsS gread-text-outline-silently gmake-text-outline-reader  g autoloadsS grdelim   g read-line  g getopt-long     gset-current-module   !g%include-in-guild-list "f*Convert textual outlines to s-expressions. #g%summary $gsymbol->string %gstring=? &f? 'g substring (g string-length )g?? *gmatch:substring +gmsub ,f -g ??-predicates .g make-regexp /f^ 0g string-append 1gassq-ref 2glevel-submatch-number 3g compute-level 4glevel-substring-divisor 5gbody-submatch-number 6g match:suffix 7g extra-fields 8gmap 9gfor-each :gset-object-property! ;g regexp-exec gstart ?> @g eof-object? Agobject-property Bgerror Cfunhandled diff not 1: Df(([ ][ ])*)- * E4  FE Ggwrite Hg open-file Ifr Jgnewline KgmainC5hP]4   5 4 >"G!R"#R$%&'(h ] 4544556gsymbol  gname gfilenamefscripts/read-text-outline.scm {  |  |   }   }   } &  } "  }  }   gnameg??C)R*hj]L6bgm  gfilenamefscripts/read-text-outline.scm    Chp]OChgn  gfilenamefscripts/read-text-outline.scm    gnamegmsubC+R)%,*h]44L55Cgm  gfilenamefscripts/read-text-outline.scm       3        C+h(]45$ O"45Cgpair  &gfilenamefscripts/read-text-outline.scm        "  $ %   & gnameg ??-predicatesC-R'.%/0+123hj]L6bgm  gfilenamefscripts/read-text-outline.scm $  &   C4(h]44L55LC}gm  gfilenamefscripts/read-text-outline.scm $  )  8  )  &   C(hs]4L56kgm  gfilenamefscripts/read-text-outline.scm   0 !  C56hj]6bgm  gfilenamefscripts/read-text-outline.scm   *   C78-9:h]L4L56gpair  gfilenamefscripts/read-text-outline.scm ' . * +  *  )   Ch{]OL6sgobj  gm  gfilenamefscripts/read-text-outline.scm $  &   Chr]Cjgobj  gm  gfilenamefscripts/read-text-outline.scm    C;:<hX]4L5$?4L54L54>"G4L>"GCCgline  Tgt Tglevel  ! Rgbody  ! Rgfilenamefscripts/read-text-outline.scm        !  &  , / 3  <   T Ch]24 5445$" 455445$" 54 5$  O"(4 5$  O" O45$ 45"45$45O"OCgre  gspecs  gfc  1grx  1 gt  ? Qglevel-substring  S gt  ^ gt  z g extract-level  gt  g extract-body  gt  gnew  g misc-props!  gfilenamefscripts/read-text-outline.scm       *    $ ( / , .  1  4  7  = + ?  ? S  S  V  \ & ^  ^  r  x & z  z    %     $   - " *   gnamegmake-line-parserC=R=?@A<BC:> h`]QHH"%45$"'4L5$45  $ " $S    $"4 >"G 4>"GJK"E $=""4 5$ K"  "J "JJK"45" 45"45 J"JK J&CJCgport  \gall  \gpchain  \gline   4g prev-level   4gtp   4gt   4gt  ) 1gwords  6 glevel  A gdiff H gt g gp  gfilenamefscripts/read-text-outline.scm             #  )  6 ( 6  9 ( ? ; A ( A  H ' H  M  R  W  ^  c  g " g  t " x ) "  7  +  1 +     , = E , #  # -  (  +  "    .  4  5  I  L  N  P  V  W [ B  \ Ch] 45OCgre  gspecs  g parse-line  gfilenamefscripts/read-text-outline.scm      gnamegmake-text-outline-readerCR4iDF5RGHIJh@-1344455>"G4>"GCgargs :gfilenamefscripts/read-text-outline.scm   %  0  ;  %   )  : gnamegread-text-outlineCRiKRCgm  0gfilenamefscripts/read-text-outline.scm  p 4 x 6 y  9 y 7 { S  1           G N   P C6PK!"m#G#Gsnarf-check-and-output-texi.gonu[GOOF----LE-8-2.0 G]4h ] gguile  gdefine-module*   gscripts gsnarf-check-and-output-texi  gfilenameS f'scripts/snarf-check-and-output-texi.scm gimportsS gice-9 gstreams     gmatch     gexportsS  gset-current-module   g%include-in-guild-list f8Transform snarfed .doc files into texinfo documentation. g%summary gmake-syntax-transformer   gwhen gmacro !g $sc-dispatch "! #! $g_ %gany &$% 'g syntax->datum (' )' *g datum->syntax +* ,* -gif .gbegin /gsyntax-violation 0/ 1/ 2f-source expression failed to match any pattern 3gunless 4gnot 5g *manual-flag* 6gmember 7f--manual 8gprocess-stream 9gcurrent-input-port :g stream-null? ;g stream-car g stream-cdr ?g stream-map @gstring? Agstring Bgint_hex Cgint Dgstring->number Egint_oct Fgint_dec Ggid Hgstring->symbol Ig make-stream Jgeol Kghash Lg port->stream Mgread Ngerror Ogsyntax Pfpremature end of file Qg brace_open Rgconsume-multiline Sgconsume-upto-cookie Tgprocess-singleline Uf*premature end of file in directive context Vgreverse! Wgbegin-multiline Xf*premature end of file in multiline context Yg brace_close Zg end-multiline [gprocess-multiline-directive \g*file* ]g*line* ^g*c-function-name* _g*function-name* `g *snarf-type* ag*args* bg*sig* cg *docstring* df@deffnx {Scheme Procedure}  eg*primitive-deffnx-signature* fg string-length gg*primitive-deffnx-sig-length* hgregister iglength jgformat kf;~A:~A: ~A's C implementation takes ~A args (should take ~A) lgwith-output-to-string mf~A nf ~A of [~A pf . ~A qg primitive rf@deffnx {C Function} ~A ( sf, ~A tf)  uf ~A  vf@c snarfed from ~A:~A  wf@deffn {Scheme Procedure} ~A  xgstring=? yg substring zgdisplay {f  |f @end deffn  }f ~g string-append f@ f@@ g texi-quote gSCM G finvalid argument syntax: ~A gmap gcdr gcomma  g paren_close  gargsig funknown doc attribute: ~A garglist g paren_open  finvalid arglist syntax: ~A gvoid G glocation gtype gfname greverse   gcname gsymbol->string f unknown doc attribute syntax: ~A gargpos G g list-index f9~A:~A: wrong position for argument ~A: ~A (should be ~A)  gcurrent-error-port funknown check: ~A gmainC5h8Q]4   54>"GRR4 #&),-.h-13Cgcond gbody gfilenamef'scripts/snarf-check-and-output-texi.scm ! "   Ch{] 45L4?6sgargs  gv gfilenamef'scripts/snarf-check-and-output-texi.scm  !    C12h(y] 45$ O@6qgy  'gtmp 'gfilenamef'scripts/snarf-check-and-output-texi.scm !   ' C5R43 #&),-4.h -13Cgcond gbody gfilenamef'scripts/snarf-check-and-output-texi.scm $ %   Ch{] 45L4?6sgargs  gv gfilenamef'scripts/snarf-check-and-output-texi.scm  $    C12h(y] 45$ O@6qgy  'gtmp 'gfilenamef'scripts/snarf-check-and-output-texi.scm $   ' C53R5R67589h(-1345$ "456gflags &gfilenamef'scripts/snarf-check-and-output-texi.scm ) *   *   *   *   +  ,  & ,  & gnamegsnarf-check-and-output-texiCR:;<=>h@] 45$C45& 45L645"ginput  ;gtoken  ;gfilenamef'scripts/snarf-check-and-output-texi.scm /   F F   G   G   H   H  ! H  $ I  . I / K  ; K   ; gnamegloopC?@ABCDEFGH h]"""S"!$C45$CC$#& 4 5C""$#& 4 5C""$!& 45C"S"O$!& 4 5C"#"gexpr  gw @ ]gx  @ ]gw n gx  n gw gx  gw gx   gfilenamef'scripts/snarf-check-and-output-texi.scm /  9 " / , ; ( / ; " 3 / N 7 ( O 7 - X 7 " ] / | 5 ( } 5 - 5 " / 3 ( 3 - 3 " / 1 ( 1 , 1 " /   CI:;JK>h`]"L45$C45&"$ 45"4545C"gs  Zgs  Rgt   1gfilenamef'scripts/snarf-check-and-output-texi.scm = -  > /  @ 4  ? 1  A :  A 4 5 ? 1 6 B : B B 4 C C ? J C N Q C 9 R > /  Z CLMh0] OQ4445556gport  *gloop *gfilenamef'scripts/snarf-check-and-output-texi.scm . /   /   =  D - & = ( /  * /   * gnamegprocess-streamC8R:NOP;QR>ST hP"] 45$4>"G"45& 456  6ginput  Ngcont  Ngtoken  , Ngfilenamef'scripts/snarf-check-and-output-texi.scm M  O  O   P   P  P   P  & R  , R  1 T 3 T  7 S  : U  D U  N X   N gnamegdispatch-top-cookieC=R:NOU;<V> h]"k45$4>"G"45&"445>"G45645""gprocess  |ginput  |gcont   |gacc   qginput   qgtoken  0 qgfilenamef'scripts/snarf-check-and-output-texi.scm \  ]   _  _   `   `  `   `  * b  0 b  5 d  7 d  ; c  < e ? e  J e U f  ] f b h  c h % q h  q ]  r ]  | ]   | gnamegconsume-upto-cookieCSRW:NOX;YZ>S[ h` ] 45$4>"G"45&4>"GL456  L6ginput  \gtoken , \gfilenamef'scripts/snarf-check-and-output-texi.scm m   o o   p   p  p   p  & r  , r  1 t  3 t  7 s  8 u J v  R v \ x   \ gnamegloopC:NOX;YZ>S[ hJ]4>"GOQ45$4>"G"45&4 >"G4 56  6Bginput  |gcont  |gloop   |gtoken  L |gfilenamef'scripts/snarf-check-and-output-texi.scm j  k   m  # o - o  . p  2 p 4 p  9 p  F r  L r  Q t  S t  W s  X u j v  r v | x   | gnamegconsume-multilineCRR\R]R^R_R`RaRbRcR\]^_`abc h ]        Cgfilenamef'scripts/snarf-check-and-output-texi.scm                  gnamegbegin-multilineCWRdeR4fiei5gRbh`iaNjk\]_ljm_nopah`]04>"G"L$$4>"G""L$+4>"G]"L $4>"G""'(C4>"G"" "i "-Xgargs  gr  go  L gargs  L gtail  L gtail  gfilenamef'scripts/snarf-check-and-output-texi.scm           $  %  * " - ( 2  = ! @ , H  L  Q  U  V  [ % ^ , c  n $ q , v 7     ' $    " - 2 " - "   =  -  C5qjr^amsthx+]4>"G("L4>"G")("(4>"G""6#gargs ; dgfilenamef'scripts/snarf-check-and-output-texi.scm          "  ' ! * & /  ;  A  F  K % N , S  ^ d  d  g ' m  r  t   t Cuvwfgxyezc{|h]@&" 45$+44   455>"G"& "4  O5$& 4 5""4 >"G4  >"G4>"G"|("~$*45$44 55""$ 4>"G"4>"G""x4>"G6greq  gopt gvar   gall   gnice-sig  g scm-deffnx  gstrings  gg scm-deffnx  ggfilenamef'scripts/snarf-check-and-output-texi.scm               % &  ,  5  6 :  ;  > C  J + T Y  i " m t  5                  +          "  -  "   &  *  +  0  5  @  J  K  g  g  t  x  }     C   gnameg end-multilineCZRf}~yxhH#] 4L5$C4L545$"4L56gi  Egss ! ;gfilenamef'scripts/snarf-check-and-output-texi.scm           . !  !  $  * ( ,  0  2  <  A  C  E   E gnamegrecCh] OQ 6gs  grec gfilenamef'scripts/snarf-check-and-output-texi.scm    gnameg texi-quoteCRGNj h@|]1" "$$$t$N&'$ 4L5C445564455644556445564455644556$*$$""""$( $C"""tgexpr  =gw  gx   gw  1 gx  1 gw  B gx  B gw gx  gw $ 5 gfilenamef'scripts/snarf-check-and-output-texi.scm  X  _  c  h  i 8 s  u  x  }  ~ 8     8     8     8     8        0  5 '  = gnamegdo-argsCCNjbaA\]`G~_^c!hZ ]yO""" ""=""L$7&$$&$   $     &o"456 $R (G   $-  &   C456456""456456456456456456456456$A&+$ "$_ $,$ 45"44 4  555"44 4  555"44 4  555"$ $l$] $<$-(  $""' """""" """""" C"p"l"h$&|$q$\&F$;(0  $      &   C"""""""""$X&B$7(,$& C"t"p"l"h"d"`$X&B$7(,$& C" " """"$&o"`(4544?5 C$6$& & """|"x""i"e$b&L$A(6$&&4455 C"""""""""t(45 C$J$0&"4 564 564 56"$A$,&$ ")"="9"5"1Q" R gl  gexpr   gw  3 dgx  3 dgw  L Hgx  L Hgw  ] :gx  ] :gw v gx v gw gx gw gw  gx  gw   gx   gw   gx   gw  # gx  # gw  = gx  = gw [ rgw   Wgx   Wgw   Ogx   Ogw   Kgx   Kgw  ?gw ! ;gx ! ;gw  h gx  h gw   gw   gx   gw   gx   gw   gw    gx    gw  . gx  . gls  > gp-ls  > gname  K ]gw  g gw  v gx v gw   gx   gw   gw    gx    gexpr  " gls  * gp-ls  * gstring  7 ?gw  I gw  X gx  X gw   gx   gw   gx   gdo-args  Dgfilenamef'scripts/snarf-check-and-output-texi.scm                                                        !   &   *   ,   /   4   8   :   =   B   F   H   K   P   T   V   Y   ^   b   d   g   l   p   r   r             7          7          7       g  o       1   5   ;            N  Q ( Y  [  `     *       "   =   B   w   |                                               o   gnamegprocess-multiline-directiveC[R_GCazj\Nh({]q$$$$$$&$$   &o$f(]  $O     &;45$( $C4    54 56CCCCCCCCCCC 4 56 4 56 4 56Csgl  $gw  gx   gw  6 gx  6 gw  G gx  G gw  ` gx  ` gw q gx q gw gw gx gidx  gfilenamef'scripts/snarf-check-and-output-texi.scm   3  .  , #  %  %  &  '  '  ' (  ( ) 2 (  *  ( 1   1   1   1   1   1   1   1   1   1   1  " 1   $ gnamegprocess-singlelineCTRiRCIgm  ,gfilenamef'scripts/snarf-check-and-output-texi.scm   0  2   5   '  ) . M  \ u j y | } }  ~         %   &  > ! 5 8  8 6   8 C6PK!XZSk)k) scan-api.gonu[GOOF----LE-8-2.0S)]4hT ] gguile  gdefine-module*   gscripts gscan-api  gfilenameS fscripts/scan-api.scm gimportsS gice-9 gpopen     grdelim    gregex     gexportsS  gset-current-module   g%include-in-guild-list f2Generate an API description for a Guile extension. g%summary gset-object-property! gput !gobject-property "gget #g add-props $g make-regexp %g open-pipe &g OPEN_READ 'g eof-object? (g regexp-exec )g read-line *gscan +f ^.guile.+: ([^ ]+)([ ]+(.+))*$ ,gformat -f ~A -c '~S ~S' .g use-modules /gsession 0 / 1.0 2gapropos 3f. 423 5gstring->symbol 6gmatch:substring 7gScheme 8f 9g hashq-set! :g scan-Scheme! ;f^[0-9a-fA-F]+ ([B-TV-Z]) (.+)$ ghashq-get-handle ?gerror @fboth Scheme and C: Agscan-C! Bgcurrent-module Cg THIS-MODULE Dgmemq Eggroups Fg in-group? Gg string-match Hg string-append If^ Jgsymbol->string Kg name-prefix? Lgadd-group-name! Mgeval Ngname Ogmake-grok-proc Pgmake-members-proc Qg make-hook Rgfor-each Sgassq-ref Tgmembers Uggrok Vf+bad grouping, must have `members' or `grok' Wg add-hook! Xg description Ygread Zg open-file [g make-grouper \glist-ref ]gcatch ^] _] `gmake-hash-table agsort bg hash-fold cgstring dg scan-data e7 f= ggrun-hook hgstringlist 7= f) ;; end of meta  f (interface  f(~A ~A (scan-data ~S))  f) ;; end of interface  f ) ;; eof  gmainC5hX]4   54>"GRRi R!i"R hP-13"4(C4>"G""gobject Igargs Igargs  Agkey   Agvalue   Agfilenamefscripts/scan-api.scm I J   K   M   N   M  " O : P  A P A J  I gnameg add-propsC#R$%&'()hpJ]#4545"I45$C45$4>"G"45"45"Bgre  pgcommand  pgmatch   pgrx   pgport   pgline   cgt  ! cgt  5 Vgfilenamefscripts/scan-api.scm R  S T   S   U   V ! V  - X  5 X W Y  c Y c U  d U  p U   p gnamegscanC*R*+,-1456 789hP]44 5544 5$">"GL6gm  Jgx  Jgt  ! 4gfilenamefscripts/scan-api.scm a   b   b #  b   b  c  c   c  ! c  1 d  9 c J e   J Ch ]45O6ght  gguile  gfilenamefscripts/scan-api.scm [  \   ]  ]   _   `   ]   \    gnameg scan-Scheme!C:R*;,<56 =>?@9 hh] 44 55444 55>"G4L5$4>"G"L6gm  agx  agfilenamefscripts/scan-api.scm j   k   k #  k   k  l  l   l   l & & l  + l 4 m  @ m A n  E n  L n  a o   a Ch ]45O6ght  gsofile  gfilenamefscripts/scan-api.scm g  h   i  i   i   h    gnamegscan-C!CAR4Bi5CRD"Eh]456gx  ggroup  gfilenamefscripts/scan-api.scm s  t  t   t   t    gnameg in-group?CFRGHIJh]45456gx  gprefix  gfilenamefscripts/scan-api.scm v  w  w  w   w +  w    gnameg name-prefix?CKR E"h]456gx  gname  gfilenamefscripts/scan-api.scm y  z z   z #  z   z   z    gnamegadd-group-name!CLRMCLh~]4L5$L6Cvgx  gfilenamefscripts/scan-api.scm ~          gnamegpC Nh8]45OQ4>"GCgname  6gform  6g predicate?  6gp   6gfilenamefscripts/scan-api.scm |  }  }    $ +   6 gnamegmake-grok-procCORDLh ]4L5$L6Cygx  gfilenamefscripts/scan-api.scm        gnamegpC Nh0] OQ4>"GCgname  +gmembers  +gp  +gfilenamefscripts/scan-api.scm       + gnamegmake-members-procCPRQRRSTU?VW#OXP hxk]4545$"$"4>"GL$445 4 55" 4 56cggdef  xgname  xgmembers   xggrok   xgfilenamefscripts/scan-api.scm      (      %    # 2  6  ;  M  N  Q & X ; [ & ] & ^ & d 5 f & h  m  x   x CYZ&h ]LO44556wgfile  gfilenamefscripts/scan-api.scm           Ch(] 4 54O>"GCgfiles  &ghook  &gfilenamefscripts/scan-api.scm       & gnameg make-grouperC[R\_[hZ]L6Rgfilenamefscripts/scan-api.scm   3 %  Ch]-13CUgargs gfilenamefscripts/scan-api.scm  C`:Aab#cJd"7=Eefg h\] 44545$" 4545$ " >"GL$4 L>"G"CTgkey  }gvalue  }g prior-result   }gt   5gfilenamefscripts/scan-api.scm  " # +  #  2  ;  2  . * 2 0 ; 2 2 7 # 8 / > 8 @ / D + F / L / Q " _ " ` / | "  } Ch"ch]45456ga  gb  gfilenamefscripts/scan-api.scm   ! ( !  !  (  !     C,ijklmn8opqr*sty6hj]4 5NCbgm  gfilenamefscripts/scan-api.scm   * "   Cz{E|}"Nhj]6bgp  gfilenamefscripts/scan-api.scm -  @ 9  C~R,E"dh ]45456gx  gfilenamefscripts/scan-api.scm    (  /  (      !     C+h "-134 54 54O54 54>"G4>"G44  O5 54  >"G4 >"G4 >"G4 45$">"G4 45$">"G4 >"G4 H44 5O>"GJ>"G4 >"G4 4 $4!"4#55"$5>"G4 %>"G4 &>"G4'(>"G4 )>"G4 *>"GCgargs gguile 0 gsofile  0 ggrouper  0 ght  0 gall  v gt  gt  gi  ' S gfilenamefscripts/scan-api.scm      ) 0  9  M  a  d  n r  v  v  y  ~               -        /         !  &  '  *  .  /  4 ! 8  :  F  X  a  f  m  v  {  }  ~   $  (  -  (  (  $                                S  gnamegscan-apiCRiRCgm  ,gfilenamefscripts/scan-api.scm  = 0 C 2 D  5 D < F C G  I  R  [  g  q   q  s v y { | ;  M T   V C6PK!@F display-commentary.gonu[GOOF----LE-8-2.0 ]*4h ] gguile  gdefine-module*   gscripts gdisplay-commentary  gfilenameS fscripts/display-commentary.scm gimportsS gice-9 g documentation      gexportsS  gset-current-module   f5Display the Commentary section from a file or module. g%summary gformat f~A commentary: ~A gfile-commentary gdisplay-commentary-one gmap gsymbol->string g string-append f/ gmodule-name->filename-frag !g%search-load-path "f module ~A  #gdisplay-module-commentary $gfor-each %gstring? &g string-index 'gwith-input-from-string (gread )gmainC5h]4   54>"GRh]456gfile  gfilenamefscripts/display-commentary.scm %  & & '  &    gnamegdisplay-commentary-oneCRh@(]45" (C45"" gls  ?gls ?gls   1gacc   1gfilenamefscripts/display-commentary.scm (  ) )   *   +   -   -  $ - , ' - 0 ) -  1 - 1 *  4 *  7 * " ? *   ? gnamegmodule-name->filename-fragC R! "h8] 4455$4>"G6Cg module-name  3gt  3gfilenamefscripts/display-commentary.scm /  0  0   0  0   2   2  # 2  1 3   3 gnamegdisplay-module-commentaryC#R$%&#'(h@]45$! 4(5& 4566$6Cgref  =gfilenamefscripts/display-commentary.scm 6  7  7   8 #  8   :  ( 9  . ;  1 <  5 7  ; =   = Ch-136grefs gfilenamefscripts/display-commentary.scm 5  6   gnamegdisplay-commentaryCRi)RCgm  ,gfilenamefscripts/display-commentary.scm   . #  1 #  %  (  /  5  @    C6PK!g^d""summarize-guile-TODO.gonu[GOOF----LE-8-2.0!]}4h] g debug-enable g backtrace gguile  gdefine-module*   gscripts gsummarize-guile-TODO   gfilenameS f scripts/summarize-guile-TODO.scm gimportsS gread-text-outline   gice-9 g getopt-long    gexportsS   g autoloadsS gsrfi gsrfi-13  gstring-tokenize  gsrfi-14  gchar-set !  "g common-list #" $g remove-if-not %$ &!#% 'gset-current-module (' )' *g%include-in-guild-list +fA quaint relic of the past. ,g%summary -gset-object-property! .gput /gobject-property 0gget 1gwho 2gmap 3gstring->symbol 4gpct-done 5gstring->number 6gas-leaf 7gparent 8gfor-each 9ghang-by-the-leaves :gmake-text-outline-reader ;f=(([ ][ ])*)([-+])(D*)(R*)(X*)(([0-9]+)%)* *([^[]*)(\[(.*)\])* gbody-submatch-number ?>  @g extra-fields Agstatus BA  Cgdesign? DC  Egreview? FE  Gg extblock? HG  I4  J1  K@BDFHIJ L=?K Mg open-file Nfr Og read-TODO Pg option-ref Qginvolved Rgmemq Sgpersonal Tgreverse Ugtodo Vgstring=? Wf- Xgdone Yf+ Zgreview [g select-items \gformat ]f ~A ^f _f under : ~A~A  `g make-string af status: ~A~A~A~A~A~A item : ~A  bfD cfR dfX ef ~A% fgmake-display-item gg no-parent hg display-items ifsummarize-guile-TODO jg single-char kjw l1k mjn ngm oji pgvalue qp rQoq sjp tSsq ujt vUu wjd xXw yjr zZy {lnrtvxz |gmainC5h]4i>"G4    &5 4)>"G*R+,R-i.R/i0R01.23 45 h2] 45$-4444:555>"G"45$44 5>"G"C*gx  ygt Cgt L vgfilenamef scripts/summarize-guile-TODO.scm Q  R R  R R   T   T   U  V  % V - - V  / U  4 T  D W J W  L W L W  U Y  [ Y  \ Y  g Y   y gnamegas-leafC6R.78hw]LL6ogchild  gfilenamef scripts/summarize-guile-TODO.scm b % c 3 c '  C6hX]$'4>"GLO64>"G45MNCgtree  Tgparent  Tgfilenamef scripts/summarize-guile-TODO.scm ^   _  _  a   a  a +  a  . d % 0 b  1 f  7 f % > f  G g . P g ( R g   T gnameghangC8hn]L6fgtree  gfilenamef scripts/summarize-guile-TODO.scm h  i   Ch8]HOQ4O>"GJCgtrees  4gleaves  4ghang   1gfilenamef scripts/summarize-guile-TODO.scm \  ]   ]   ^   h   4 gnameghang-by-the-leavesC9R9:;LMNh ]4454556gfile  gfilenamef scripts/summarize-guile-TODO.scm m  o   o  p  q   o   y   y   y   o   n    gnameg read-TODOCORPQ301Rh ]45$L456Cgx  gfilenamef scripts/summarize-guile-TODO.scm   $ + $    ,  3  ,  $  CS01Th(] 45$ 45LCCgx  !gt !gfilenamef scripts/summarize-guile-TODO.scm   & - &   5  0  +  ! C8Ph ]4L5$ MNCCgpair  gfilenamef scripts/summarize-guile-TODO.scm    %     '  !     CUV0AWh]456gx  gfilenamef scripts/summarize-guile-TODO.scm   / 6 /  ?  %   CXV0AYh]456gx  gfilenamef scripts/summarize-guile-TODO.scm   / 6 /  ?  %   CZ0Ehv]6ngx  gfilenamef scripts/summarize-guile-TODO.scm   . '  CT$h+]H45$45OJK"45$45OJK"4O     >"G"!(645"4J5"#gp  gitems  gsub   gt   6gu   /gt  @ ggu  O `gsub  gitems   gfilenamef scripts/summarize-guile-TODO.scm {  |  |   } }   }  }        *  ,  7 =  @ @  I  O  [  ]  h  u       )    "  gnameg select-itemsC[R01\]^h ] 45$ 6Cgitem  gt gfilenamef scripts/summarize-guile-TODO.scm      2  '     C^hp]Chgitem  gfilenamef scripts/summarize-guile-TODO.scm     C\_`07hX]"<$444 5>"G45 "C45 "gitem  Ugparent  Bgindent   Bgfilenamef scripts/summarize-guile-TODO.scm      #  "  +  1 * 3  8 3 @  B  C " I , K " U   U Chg]C_gitem  gfilenamef scripts/summarize-guile-TODO.scm    C\a0ACb^EcGd4eh] 44545$"45$ "4 5$ "4 5$4 5"4L5> "GL6gitem  gt Y tgfilenamef scripts/summarize-guile-TODO.scm                   & & * '  -  /  3  5 & ; * <  B  D  H  J ( P , Q  W  Y  Y  b  g % k  q  u   $  Ch0]$"$"OCg show-who?  ,g show-parent?  ,gshow-who   ,g show-parents   ,gfilenamef scripts/summarize-guile-TODO.scm      , gnamegmake-display-itemCfRfP1g8h( ] 4454556gp  &gitems  &g display-item   &gfilenamef scripts/summarize-guile-TODO.scm    ) 7  )  .  <  .  )     &   & gnameg display-itemsChRi{h[OPhH'-13454444555>"GCgargs Dgp  Bgfilenamef scripts/summarize-guile-TODO.scm              " % % 5 * C - 5 . 0 0 % 2  7  D gnamegsummarize-guile-TODOC R i|RCgm - Dgfilenamef scripts/summarize-guile-TODO.scm  A A   A  C H K J L  M L T N [ O 5 Q  \  m  {        C6PK!0"" api-diff.gonu[GOOF----LE-8-2.0!]^4h] gguile  gdefine-module*   gscripts gapi-diff  gfilenameS fscripts/api-diff.scm gimportsS gice-9 g common-list     gformat    g getopt-long     gexportsS  g autoloadsS gsrfi gsrfi-13  gstring-tokenize   gset-current-module !  "  #g%include-in-guild-list $f,Show differences between two scan-api files. %g%summary &gwith-input-from-file 'gread (gread-alist-file )gset-object-property! *gput +gobject-property ,gget -gassq-ref .gmeta /g interface 0ggroups 1gmake-hash-table 2gfor-each 3g hashq-set! 4gread-api-alist-file 5g hashq-ref 6ghang-by-the-roots 7gset-difference 8gdiff? 9g diff+note! :g hash-fold ;gacons fgroups-removed: ~A  ?fgroups-added: ~A  @glength Af ~5@A ~5@A :  Bf- Cf~5@A ~5@A : ~5@A Df~5@D ~5@D : ~5@D Ef ~A  Fgsort Ggunion Hgstringstring Jgdetails Kf~A ~A:  Lgremovals Mf ~A  Ng additions Of~A: no changes  Pgerror Qf!api-diff: group-diff: bad options Rg group-diff Sg single-char TSd Ugvalue VU WJTV XW Yg option-ref Zf /dev/null [ZZ \gstring->symbol ]gmainC5h]4   5 4">"G#R$%R&'hO]6Ggfilenamefscripts/api-diff.scm 5   5    Ch}]6ugfile  gfilenamefscripts/api-diff.scm 3 4   gnamegread-alist-fileC(R)i*R+i,R(-./*0123hk]L6cggroup  gfilenamefscripts/api-diff.scm @ ' A > A )  C h|]!4545454>"G44 54 O45>"G>"GCtgfile  |galist |gmeta   |g interface   |ght  E lgfilenamefscripts/api-diff.scm :  ;  ;  <   <   <   ;   =   = $  =   ;  " >  ( >  / >  8 ?  > ?  ? ? % E ?  H @  R B ' X B 6 Z B ' _ @  q ?   | gnamegread-api-alist-fileC4R,02235h{]LL4L56sggroup  gfilenamefscripts/api-diff.scm I  K . L .  K (  J    C-0hw]LO456ogx  gfilenamefscripts/api-diff.scm H   M   M &  M   I    Ch0] 454O>"GCg interface  ,ght )gfilenamefscripts/api-diff.scm F  G G  G G   H   , gnameghang-by-the-rootsC6R7h] 45(CCga  gb  gresult  gfilenamefscripts/api-diff.scm Q  R  R   S    gnamegdiff?C8R8hpS]H45$4>"GK"45$4>"GK"J$6CKga  kgb  kg note-removals   kgnote-additions   kg note-same   kgsame?   kgt   2gt  ; _gfilenamefscripts/api-diff.scm W  X   Y  Y   Y & + Y 8 3 Z ; Z  D Z & X Z 9 e [  i [   k gnameg diff+note!C9R6:;,0<=9>hn]6fgremovals  gfilenamefscripts/api-diff.scm f   g $ g   C?ho]6gg additions  gfilenamefscripts/api-diff.scm h   i $ i   ChG]C?gfilenamefscripts/api-diff.scm j    C2-@ABC9@hj]45NCbgsubs  gfilenamefscripts/api-diff.scm x #  y 5 y %  C@hj]45NCbgadds  gfilenamefscripts/api-diff.scm z #  { 5 { %  ChG]C?gfilenamefscripts/api-diff.scm | #   CDE h /]94L54L5$ 45"$ 45"$$ ""4$"$">"G"4>"nG"g$]$O HH4O O >"G4 J J>"G""""| 6'ggroup  gold gnew   g old-count  * g new-count  > gdelta  [ g add-count  g sub-count  gfilenamefscripts/api-diff.scm k   l # l   m #  l   n )  n 2 * l  2 o ) 3 o 2 > l  F p % Q p 2 [ l  ^ q  c q $ i r ! q r / w s !  s / q  + > B F t  t u v " } " } - ~ 4 } "  $  &   CFGHIh]45456zga  gb  gfilenamefscripts/api-diff.scm   ' '     C-J-9KL2Mhj]6bgx  gfilenamefscripts/api-diff.scm 4  A 6  Ch(]4L>"G6gremovals  !gfilenamefscripts/api-diff.scm *  *  5 1  * ! *  ! CKN2Mhj]6bgx  gfilenamefscripts/api-diff.scm 4  A 6  Ch(]4L>"G6g additions  !gfilenamefscripts/api-diff.scm *  *  5 1  * ! *  ! COhZ]L6Rgfilenamefscripts/api-diff.scm *  7 ,  Ch`]4L5$"4L5$"OOO6ggroup  Ygt gold  Ygt  ( :gnew  : Ygfilenamefscripts/api-diff.scm   , (  C   , ( ( 7 C :  Y   Y CPQha-13 4544554545445545(74   >"G  O4455645  $ O 66Ygi-old gi-new goptions  gi-old   gg-old  # g g-old-names  . gi-new  7 gg-new  J g g-new-names  U gt  gfilenamefscripts/api-diff.scm ] ^   ^   _   _ !  _ %  _ 0 ! _ % # _  # ^  & `  . ^  1 a  7 ^  : b  ? b ! @ b % F b 0 H b % J b  J ^  M c  U ^  ] d  ^ e    k  d    %  gnameg group-diffCRRXY[4J<\R hx-1345454545H45$4 4 ,55JK" J@gargs vgp  vgrest  ! vgi-old  + vgi-new  6 vgoptions  9 vgt  E lgfilenamefscripts/api-diff.scm               ! !  !  $  ) % +  +  .  3 % 6  6  9  9  < B  E E  O * P * U / _ * ` $ c  e  v # v gnamegapi-diffCRi]RCgm  0gfilenamefscripts/api-diff.scm  ) 4 0 6 1  9 1 H 3 O 7 V 8  : N F  Q  W  ]      C6PK!generate-autoload.gonu[GOOF----LE-8-2.0]24h] gguile  gdefine-module*   gscripts ggenerate-autoload  gfilenameS fscripts/generate-autoload.scm gexportsS  gset-current-module     g%include-in-guild-list f)Generate #:autoload clauses for a module. g%summary gopen-input-file g eof-object? gread glength gdefmacro-public g define-public g define-module gmember g:export gappend gexport g export-syntax g autoload-info f--target !gdisplay "f;;; do not edit --- generated  #gstrftime $f%Y-%m-%d %H:%M:%S %g localtime &g current-time 'gnewline (f(define-module  )f (guile-user) *gfor-each +f :autoload  ,f  -f) .f ;;;  /f symbols in  0f modules  1gmainC5h( ]4    54>"GRR h])45"45$$(CCC"45"$a"F 45$4&'$45""""" 45$n&a"'$45"1"t$)$45"""":"6 45$&:454 5$4 5"" &" $454 5"d"""45"Egfile  gp gform   g module-name   gexports   gt  J fgt  s gfilenamefscripts/generate-autoload.scm @  A A   B   C  C  D / F  7 l  K l  K G N G  R G Y f  ` f  d e  f g  i g , m e  p h  r h  v e  w i  k  k  i  G W  W  V  X  X * V  a  a  ^  b  d  d  b  G Y  Y  V  Z  Z  V  [   ]   ]   [   G " H  ) H  - G  / I  2 I * 6 G  7 J  @ K  B L  F L & J L  J L  S N # X N + ] N # p J  s R  s R   P   S   U   U   U   S   B   B   B 9  B Q   gnameg autoload-infoCR !"#$%&'()**!+,h(]MN45MN6g module-name  $gexports  $gfilenamefscripts/generate-autoload.scm } (  ~ =  ~ *   >   ;   *  :  F " 4 $ *  $ Ch ] 45$ LLO@Cgfile  gt gfilenamefscripts/generate-autoload.scm y   z  z   } !  C-./0hJ-13 H H45$"$"4>"G4444555>"G4 >"G4 >"G4$" >"G4  O>"G4>"G4 >"G JJ6Bgargs g module-count g syms-count  gt   ,gtarget-override  , gfiles  ? gfilenamefscripts/generate-autoload.scm n o   q !  q )  q !  q  , o  4 s  7 s $ ? s 0 ? o  B t  F t K t  T u  W u [ u  \ u + _ u 6 e u + g u l u  u v  w  w w  x  x x ! x  y      ' )    )  gnameggenerate-autoloadCRi1RCgm  (gfilenamefscripts/generate-autoload.scm  : , = . >  1 >  @  n $   & C6PK!tC*^&& autofrisk.gonu[GOOF----LE-8-2.0&]|4h# ] gguile  gdefine-module*   gscripts g autofrisk  gfilenameS fscripts/autofrisk.scm gimportsS gsrfi gsrfi-1     gsrfi-8    gsrfi-13    gsrfi-14    gread-scheme-source   gfrisk    gexportsS ! "g autoloadsS #gice-9 $gpopen %#$ &gopen-input-pipe '& (%' )gset-current-module *) +) ,g%include-in-guild-list -f0Generate snippets for use in configure.ac files. .g%summary /g files-glob 0gnon-critical-external 1gnon-critical-internal 2gprograms 3g pww-varname 4/0123 5g*recognized-keys* 6gerror 7f syntax error: 8finput not a list 9gevery :glist? ;fnon-list element gquote ?gmemq @funrecognized key: Agapply Bgmap Cgfold Dgappend Egassq-ref Fgcanonical-configuration Ggfor-each Hgformat IfGUILE_MODULE_REQUIRED~A  Jg>>strong Kgobject->string Lg string-map! Mgchar-set-contains? Ngchar-set:letter+digit Og safe-name Pfprobably_wont_work Qg*pww* Rgedge-up Sg edge-down Tfhave_guile_module~A UfGUILE_MODULE_AVAILABLE(~A, ~A)  Vf"test "$~A" = no && ~A="~A $~A"~A Wf  Xg>>weak Yfguile_module~Asupport_~A ZfAC_PATH_PROG(~A, ~A)  [ftest \  \f "$~A" = "" -o \  ]f~A && ~A="~A $~A"  ^glist-ref _f war = peace `ffreedom = slavery afignorance = strength bgrandom cg >>program dg >>programs efecho '(' ~A ')' fgsymbol->string ggread hgunglob ig make-frisker jgexternal kg partition lgmember mg mod-down-ls nfAC_DEFUN([AUTOFRISK_CHECKS],[  of ~A=~S  pf qfAC_SUBST(~A) ])  rg>>checks sg[ AC_DEFUN([AUTOFRISK_SUMMARY],[ if test ! "$~A" = "" ; then p=" ***" echo "$p" echo "$p NOTE:" echo "$p The following modules probably won't work:" echo "$p $~A" echo "$p They can be installed anyway, and will work if their" echo "$p dependencies are installed later. Please see README." echo "$p" fi ])  tg >>summary uf modules.af vg file-exists? wfcould not find input file: xgwith-output-to-file yf~A.m4 zgread-scheme-source-silently {gmainC5h ]4    !"(5 4+>"G,R-.R45R6789:;<hk] 45Ccgform  gfilenamefscripts/autofrisk.scm N   N $ N   C=>?5h8]$$&C45$CNCCgform  4gkey  4gt  ! 2gfilenamefscripts/autofrisk.scm P   Q   Q  R   R   S $  S   S   T  ! S  0 V !  4 C@ABCDh8] L&$45""$CCgform  4gso-far  4gt  & 4gfilenamefscripts/autofrisk.scm [  \ 0 \ &  ] +  \ &  ^ +  ^ :  ^ + & \ "  4 Chj]OL6bgkey  gfilenamefscripts/autofrisk.scm Z   `  [    C5Ehb]L6Zgkey  gfilenamefscripts/autofrisk.scm c  d   Ch]$"4>"G45$"4>"G45$"4>"GH4 O5 J$"4 >"G4  O5OCgforms  g condition * Mg condition V ygun z g condition  gx  gbunched gfilenamefscripts/autofrisk.scm I  L K   K   K *  L   K  " M * M  2 K  7 K  ; K * = M  B K  N N V N  ^ K  c K  g K * i N ; n K  z O  } P Y P  K  K  K * K  Z  Z   gnamegcanonical-configurationCFRGHIhm]6egmodule  gfilenamefscripts/autofrisk.scm g  h  h   Chz]6rgmodules  gfilenamefscripts/autofrisk.scm f g   gnameg>>strongCJRKLMNhh]45$C_C`gc  gfilenamefscripts/autofrisk.scm m   n   n    Ch(] 454>"GCgmodule  "gvar "gfilenamefscripts/autofrisk.scm k  l l  m   " gnameg safe-nameCORPQRGRSHTOUVQW hP]454544554>"G 6gedge  Mgup Mgdown   Mgvar  # Mgfilenamefscripts/autofrisk.scm w  x  x  y   x   z   z %  z ; # z  # x  & {  + {  4 {  A |  K } - M |   M Ch{]6sg weak-edges  gfilenamefscripts/autofrisk.scm v w   gnameg>>weakCXRBHYOhw]4L56ogprog  gfilenamefscripts/autofrisk.scm         CGHZh]6wgvar  gprog  gfilenamefscripts/autofrisk.scm      CH[H\hm]6egvar  gfilenamefscripts/autofrisk.scm      C]^_`abQhx(] 4O54>"G4>"G4>"G4    4 556 gmodule  qgprogs  qgvars   qgfilenamefscripts/autofrisk.scm       )  .  3  <  T  U Y  [  ]  `  a  i q   q gnameg >>programCcRGchw]6ogform  gfilenamefscripts/autofrisk.scm   $   Ch]6wgprograms  gfilenamefscripts/autofrisk.scm   gnameg >>programsCdR&HeBfgh ] 4455456gpattern  gp  gfilenamefscripts/autofrisk.scm    '          gnamegunglobChRFDBh/01ij3Qkl9lhb]L6Zgi  gfilenamefscripts/autofrisk.scm "  CBSmh0] 4L5$CLO44556gmodule  /gt /gfilenamefscripts/autofrisk.scm     % / - /   / CHnJopXCDmh]456|gmodule  gso-far  gfilenamefscripts/autofrisk.scm   %     Cd2qh+]A4544455?454544554 54 5(" 4  O> G4>"G4>"G4 >"G445>"G445>"G 6#gforms  gcfg gfiles   gncx  ' gnci  0 greport  < gexternal  E g pww-varname  N bgweak  v gstrong  v  gfilenamefscripts/autofrisk.scm        *  /  *       !  %  '  '  *  .  0  0  3  4  <  <  ?  C  E  E  H  L  N  N  V  ] * _  c  y  ~       %             9  gnameg>>checksCrRHfsQh]456zgfilenamefscripts/autofrisk.scm      gnameg >>summaryCtRuv6wxHyrzth m]44L5>"G6egfilenamefscripts/autofrisk.scm            C h`-13("45$"4>"G45O6gargs Ygfile  Ygt  ! Dgfilenamefscripts/autofrisk.scm      ,     !  .  2  9  G  L $ P  Y  Y gnameg autofriskCRi{RCgm  0gfilenamefscripts/autofrisk.scm  6 4 @ 6 A  9 A ; C  > C  I 5 f k t  t v k   .       C6PK!iread-rfc822.gonu[GOOF----LE-8-2.0]L4h] gguile  gdefine-module*   gscripts g read-rfc822  gfilenameS fscripts/read-rfc822.scm gimportsS gice-9 gregex     grdelim     gexportsS gread-rfc822-silently  g autoloadsS gsrfi gsrfi-13  g string-join   gset-current-module   !g%include-in-guild-list "fValidate an RFC822-style file. #g%summary $g make-regexp %f^From  &g from-line-rx 'f^([^:]+):[ ]* (gheader-name-rx )f^[ ]+ *gheader-cont-rx +goption ,g eof-object? -greverse .g read-line /g regexp-exec 0gfor-each 1g unread-char 2g string->list 3g drain-message 4g match:suffix 5gstring->symbol 6gmatch:substring 7g substring 8g match:end 9f  :g string-null? ;gfrom gbody ?f  @gsuffix Agerror Bfbad component: Cg parse-message Dgformat EfFrom ~A  Ff~A: ~A  Gf ~A Hgdisplay-rfc822 Ig open-file Jg OPEN_READ KgmainC5h8 ]4   5 4 >"G!R"#R4$i%5&R4$i'5(R4$i)5*R+R,-.+/&01hb]L6Zgc  gfilenamefscripts/read-rfc822.scm A  B   C2 hC]"p45$6"45"$=45$,4O 44 55>"G6""45";gport  gline  vgacc   vgfilenamefscripts/read-rfc822.scm <  =   >  >   ?  G  ' G " / G / >  6 @  B @ C A O D  R D $ Z D  [ C  ` A n E v =  w =  ~ = * =   gnameg drain-messageC3R+4/&.-/(56789 hX])454544 5544455 5MNCygreversed-hlines  Qghlines Qgfirst   Qgm   Qgname  ( Qgdata  C Qgfilenamefscripts/read-rfc822.scm P   Q ' Q   R &  Q   S "  Q   T %  T 5 ( T % ( Q  + U % . V , 3 V = ; V , > W , ? V & A X & C U % C Q  J Y ( O Y   Q gnameg add-header!C:3*-;<=>?@AB hX] $LC$MC$MC$M$C4M5NMC 6g component  Tgt 1 Lgfilenamefscripts/read-rfc822.scm g  h  1 l  = m & C m > E m C G m & I m  P o  T o   T C h4]A$444555"HHHOQ"45$)$4>"G"45K"m4 5$4545"$4>"G"45"r45"_4 J5K OC,gport  gfrom g body-lines  # gbody  & gheaders  ) g add-header!  3 gline  < gcurrent-header  < gt  y  gfilenamefscripts/read-rfc822.scm I  J  K  K "  L /  K "  K  J  ) O  ) J  < [  = \ G \  M ] N ] ! d ^  l ^ q _ y \  a  b  b  a  d d ! e  e $ e [  [  [  f  f "  gnameg parse-messageCCRCh]6}gport  gfilenamefscripts/read-rfc822.scm q  r    gnamegread-rfc822-silentlyCR;DE0DFh]6wgheader  gfilenamefscripts/read-rfc822.scm v  w  w $ w 1  w    C=G> hX] 45$4>"G"445>"G456gparse  Tgt -gfilenamefscripts/read-rfc822.scm t  u  u  u u   u )  u 4  u ) . v  3 x 7 x  9 x > v  K y L y  P y  R y  T y   T gnamegdisplay-rfc822CHRIJHh8-1344554>"GCgargs 1gparse  /gfilenamefscripts/read-rfc822.scm { |  | %  | 0  | %  |   |   }  1 gnameg read-rfc822CRiKRCgm  0gfilenamefscripts/read-rfc822.scm  - 4 3 6 4  9 4 : 6  @ 6 $ B 6  E 6 F 7  L 7 $ N 7  Q 7 R 8  X 8 $ Z 8  ] 8 a :  < G I q  t + { 2   4 C6PK!C&C!!help.gonu[GOOF----LE-8-2.0!]p4h ] gguile  gdefine-module*   gscripts ghelp  gfilenameS fscripts/help.scm gimportsS gice-9 gformat     g documentation    gsrfi gsrfi-1  gselectS gfold g append-map    gexportsS g show-help g show-summary g show-usage gmain !  "gset-current-module #" $" %fShow a brief help message. &g%summary 'fhelp help --all help COMMAND (g %synopsis )f Show help on guild commands. With --all, show arcane incantations as well. With COMMAND, show more detailed help for a particular command.  *g%help +g file-exists? ,gfile-is-directory? -gopendir .g eof-object? /gclosedir 0greaddir 1gstring=? 2f. 3f.. 4gdirectory-files 5gor-map 6gstring-suffix? 7g string-null? 8g substring 9g string-length :gappend ;g%load-compiled-extensions gunique ?gmap @gsymbol->string Agsort Bg in-vicinity Cg %load-path Dgstringsymbol Jgresolve-module KgensureS Lgand=> Mgmodule-variable Ng variable-ref Og%include-in-guild-list Pf ~A ~23t~a  Qf ~A  R Sf For help on a specific command, try "guild help COMMAND". Report guild bugs to ~a GNU Guile home page: General help using GNU software: For complete documentation, run: info guile 'Using Guile Tools'  Tg%guile-bug-report-address Ug list-commands Vgfile-commentary Wg%search-load-path Xgmodule-filename Ygmodule-commentary Zg last-pair [g module-name \gmodule-command-name ]gcurrent-output-port ^g string-split _g string-append `f OPTION... af Usage: guild  bgnewline cf guild  df)No documentation found for command "~a".  egcurrent-module fg%mod gf--all hg if-a ji kgcurrent-error-port lgexit mgstring-prefix? nf- ofNo command named "~a". C5hx]4   !54$>"G%&R'(R)*R+,-./0123 h]!45$45$}45"`45$4>"GC4545$" 4 5$""45"CCgdir  g dir-stream  gnew  % gacc  % gt  U ngfilenamefscripts/help.scm )  * *   *   *   +   +  % ,  & .  0 . 1 0  F 2  M 3  Q 3 & U 3  U 3  c 4  g 4 & k 4  r 3  } 6  2  ,  ,  -  ,  7   gnamegdirectory-filesC4R56789h8]4L5$#45$CL 4L5456Cgext  4gfilenamefscripts/help.scm :  <  ;  @   ; " B  ) B 0 0 B  2 A   4 C:;<h]O456zgpath  gfilenamefscripts/help.scm 9 C  :    gnamegstrip-extensionsC=R>h8](C(C$645Cgl  5gfilenamefscripts/help.scm E  F   G   F   H   H   H ! F  & H + ( H # + I  , I  1 I $ 3 I  4 I   5 gnameguniqueC>R?@>A=h ] 45$CCgx  grest  gstripped  gfilenamefscripts/help.scm P   Q , Q   R   R +   C4Bhj]6bgx  gy  gfilenamefscripts/help.scm U ! U /  Ch ~]44L556vgpath  gfilenamefscripts/help.scm O   S   T  U   T   P    CCD h(] 4544O556ghead  &gshead &gfilenamefscripts/help.scm K  L  L   N   O  $ N  & M   & gnamegfind-submodulesCERFGHIJKLM&NO PQ h~]!4545$4455"$GL$"4 5$"$$   6  6CCvgname  gmodname  gmod   gsummary  7 gv  S fgfilenamefscripts/help.scm b   c   c  c   c   d   c  " e  # e  & e % , e : . e % 2 e  7 c  ? g  E h  K i  Q i 2 S i  S i  [ j  ^ j  j g p k u l  { l  m  m   CER ST h@]4>"G4O45>"G 6gall?  ;gfilenamefscripts/help.scm Y  Z   Z Z   a   n  # n  % n  * a  7 o ; o   ; gnameg list-commandsCURVWXh]44556gmod  gfilenamefscripts/help.scm x  z   z   z   y    gnamegmodule-commentaryCYR@Z[h]44556gmod  gfilenamefscripts/help.scm |  }   } "  }   }   }    gnamegmodule-command-nameC\R]^M(_\`FabHFcbh0]4L>"G4L>"GL6ygu  0gfilenamefscripts/help.scm          0   0 C hv-.,3#45445$"4455 54 >"G4>"G4 >"G  O6ngmod gport gvar  % Egusages  I gfilenamefscripts/help.scm    *     # 1 %  %  -  0  5  8 & @ & B  I  I  L  P W  `  e j  s    gnameg show-usageCR]M&FbhH-.,3#4545$4>"G6Cgmod Ggport Ggvar  " Ggfilenamefscripts/help.scm  ,  " " "  *  + 0  7 E  G gnameg show-summaryCR]M*FbY d\ hF-.,3#454>"G4>"G45$4>"G645$4>"G6  4 56>gmod gport gt  J gt  t gfilenamefscripts/help.scm  )   .  B  H  J  J  S X  _ m n  t  }   gnameg show-helpCR4ei5fRUhjfklmnJIK oh-13(6$"$6"445>"G 6(d4 5$"4  4 5 5$4>"G 64>"G 6"ugargs gname l gt  gfilenamefscripts/help.scm             & . ' ! +  0  5  :  C  P  P  S  W  X ! \ 1 _ 5 a ! e  l  l  o  s  t # }       & gnamegmainC RCgm  ,gfilenamefscripts/help.scm   . !  1 ! 3 "  6 " 8 #  ; #  ) - 9 P E V K Y m x 7 | 9      u   w C6PK!;^AA doc-snarf.gonu[GOOF----LE-8-2.0A]4h! ] gfoo gbar gfoo/bar f0.0.2 gdoc-snarf-version gguile  gdefine-module*   gscripts g doc-snarf    gfilenameS fscripts/doc-snarf.scm gimportsS gice-9 g getopt-long   gregex   g string-fun   grdelim    gexportsS   !gset-current-module "! #! $f$Snarf out documentation from a file. %g%summary &gversion 'g single-char ('v )gvalue *) +&(* ,ghelp -'h .,-* /goutput 0'o 1) 2/01 3gtexinfo 4't 534* 6glang 7'l 8671 9+.258 :gcommand-synopsis ;gdisplay gdisplay-version ?f(Usage: doc-snarf [options...] inputfile  @f6 --help, -h Show this usage information  Af3 --version, -v Show version information  Bf? --output=FILE, -o Specify output file [default=stdout]  Cf3 --texinfo, -t Format output as texinfo  Df5 --lang=[c,scheme], -l Specify the input language  Eg display-help Ff doc-snarf Gg option-ref Hgstring->symbol Igstring-downcase Jfscheme Kg snarf-file Lgmain Mgc Nf^/\*(.*) Of^ \*/ Pf ^ \* (.*) Qf ^ \*-(.*) RfNOTHING AT THIS TIME!!! SMNOPQR Tgscheme Uf^;; (.*) Vf^;;\. Wf^;;-(.*) Xf ^\(define YTUVUWX ZSY [gsupported-languages \glist-ref ]gassq-ref ^gdocstring-start _g docstring-end `gdocstring-prefix ag option-prefix bgsignature-start cg std-int-doc? dg lang-parm egmemq fgmap ggcar hgerror if.doc-snarf: input language must be c or scheme. jg write-output kgsnarf lgformat-texinfo mg format-plain ng unread-string ogread pglength qgdefine rglambda sgstring? tgfind-std-int-doc ugseparate-fields-discarding-char vg string-append wgsplit-prefixed xgopen-input-file yg make-regexp zg eof-object? {gclose-input-port |greverse }gneutral ~g regexp-exec g read-line g doc-string gmatch:substring goptions f internal:  gappend g parse-entry gentry g make-entry g entry-symbol gentry-signature gentry-docstrings g entry-options gentry-filename g entry-line g get-symbol gmake-prototype f gcall-with-input-string g read-char g join-symbols gsymbol->string f.  f  gwith-output-to-port gopen-output-file gcurrent-output-port gfor-each f  f@c snarfed from  f: f@deffn procedure  g write-line f@c  f @end deffn f Procedure:  f;;  f Snarfed from  f C5h@3v]h]$CC~gbraz  gfilenamefscripts/doc-snarf.scm 1  2  2 2    gnamegfoo/barCRR4   54#>"G$%R9:R;<=h0]4>"G4>"G6gfilenamefscripts/doc-snarf.scm `  a   a a   a  * a 5  * gnamegdisplay-versionC>R;?@ABCDhh]4>"G4>"G4>"G4>"G4>"G6gfilenamefscripts/doc-snarf.scm e  f   f f   g   g  g  ' h  + h 0 h  9 i  = j  B i  K k  O k T k  ` l b l   b gnameg display-helpCERF:G,&3HI6J>E/KhZ-134545454544 4  555$ 6$ 64545$ 6 6Rgargs goptions  g help-wanted  J gversion-wanted  J gtexinfo-wanted  J glang  J ginput  y goutput  y gfilenamefscripts/doc-snarf.scm p q   q $  q   q   q   r   r + ! r  " s  ( s . + s  , t  2 t . 5 t  6 u  9 v  < v " B v 6 D v < F v " H v  J u  J r  X w  \ x  b w  f y  g {  l { ) o {  p |  v | * y |  y {  }  ) gnameg doc-snarfC R iLRZ[R\][^_`abc hh]45$ "K$ "=$ ".$ "$ " $ "6glang  hgparm  hgfilenamefscripts/doc-snarf.scm   h   h gnameg lang-parmCdRefg[hijklm hP] 4455$"4>"G45$ " 6ginput  Pgoutput  Pgtexinfo?   Pglang   Pgt   3gfilenamefscripts/doc-snarf.scm           # (  6  F  P   P gnameg snarf-fileCKRnopqrsh)] 4>"G45$"o 45$_&T$I$= 45$*&45$ CCCCCCCC 45$@&3$&$45$C"O"K"G"C"?C!gline  g input-port  gform   gfilenamefscripts/doc-snarf.scm       "  &  -  4  8 :  =  A D  F  J M  P  T W  \  `  a  e g  j " m  q r  w z  ~               5  gnamegfind-std-int-docg documentationfUnread @var{line} from @var{input-port}, then read in the entire form and return the standard internal docstring if found. Return #f if not.CtRufvhe]L6]gline  gfilenamefscripts/doc-snarf.scm   Chh-13LO6`glines gfilenamefscripts/doc-snarf.scm     Ch] O6gstring  gprefix  gfilenamefscripts/doc-snarf.scm     gnamegsplit-prefixedCwRxyd^_`abz{|}~ctwhu ]4544554455445544554455"74 5$4 >"G  6  &[4 5$*454 5       "45        "z &m4 54 54 54 5$*454 5        "$+45 4 5        "$45$&45$ 45""$44 5 5" 45 4  5       "Z$/45 4   5       "%45        " &24 54 54 5$+45 4 5        "$45$&45$ 45""$44 5 5" 45 4  5       " $/45 4   5       "45        "C45       "m g input-file  glang  gi-p  gdocstring-start   g docstring-end  ) gdocstring-prefix  9 g option-prefix  I gsignature-start  Y gline  _ gstate _ g doc-strings _ goptions _ gentries _ glno _ gm  gm0   Zgm1   Zgm2   Zgm3   Zgd   gint-doc   goptions   gm1  } gm2  } gm3  } gd   gint-doc    goptions   ?gfilenamefscripts/doc-snarf.scm    %  2  (  2  %    %  2 % ( ' 2 ) % )  , % / 2 5 ( 7 2 9 % 9  < % ? 2 E ( G 2 I % I  L % O 2 U ( W 2 Y % Y  _  `  j  k          - 9  & * 6                      (  )   3   4  : 9   I  O  P   X  [  " e   j   z      0     )   "  )  ;  )                 "   +   /                      )   -    '   *   :  ;   C  D  ) E  - J  9 Z  ^   b  c   l !  u "  }    #  %   %  & "  &   '   %  #   0     )   "  )  ;  )           )  *   * "  * +  * /  +  , +  / -  ? *  E # F /  N / O / ) P / - Q 0  a 0  d 2  t / u 4  } 4 ~ 4 )  4 -  4 9  4      +  B    $     gnamegsnarfCkRh]Cgsymbol  g signature  g docstrings   goptions   gfilename   gline   gfilenamefscripts/doc-snarf.scm 6  7  7    gnameg make-entryCRhz] Crge  gfilenamefscripts/doc-snarf.scm 8  9    gnameg entry-symbolCRh}] Cuge  gfilenamefscripts/doc-snarf.scm :  ;    gnamegentry-signatureCRh~] Cvge  gfilenamefscripts/doc-snarf.scm <  =    gnamegentry-docstringsCRh{] Csge  gfilenamefscripts/doc-snarf.scm >  ?    gnameg entry-optionsCRh|] Ctge  gfilenamefscripts/doc-snarf.scm @  A    gnamegentry-filenameCRh] Cge  gfilenamefscripts/doc-snarf.scm B  D    gnameg entry-lineg documentationf4This docstring will not be snarfed, unfortunately...CR|pH hA]$5454545454545645 $=4455454545454564545454569g docstrings  goptions  gdef-line   gfilename   gline-no   gfilenamefscripts/doc-snarf.scm I  K  M   N   N + O  + P  2 P  3 P 3 : P  ; P  = M  > Q  F Q  J K  M R  P R % W R Y R  Z S  a S  b T  i T  j U  u V  | V  } V 2 V  V  R  X  X  X  X - Y  Y  Y 2 Y  Y  X )  gnameg parse-entryCRohP] 4>"G4>"G45$6$6Cgs-p  Lgtmp - Lgfilenamefscripts/doc-snarf.scm a   b   c  ' d  - b  2 f 6 e  < g ? h C e  I i K k   L Ch]6{gdef-line  gfilenamefscripts/doc-snarf.scm ^ _   gnamegmake-prototypeCRohH] 4>"G4>"G45$C$CCgs-p  Ggtmp - Ggfilenamefscripts/doc-snarf.scm p   q   r  ' s  - q  2 u 6 t  9 v = w A t  F z   G Ch]6wgdef-line  gfilenamefscripts/doc-snarf.scm m n   gnameg get-symbolCRvhH](C$ 456(645456gs  Cgfilenamefscripts/doc-snarf.scm ~                  "   &   +   -  0   5  ( 7   9  1 :  5 ?  C A  5 C    C gnameg join-symbolsCRhR]LL6Jgfilenamefscripts/doc-snarf.scm      Ch(]$ 45"45O6gentries  %g output-file  %gwriter   %gfilenamefscripts/doc-snarf.scm     *   # %    % gnameg write-outputCjR;=hb]6Zgs  gfilenamefscripts/doc-snarf.scm       C;h }]4>"G6ugs  gfilenamefscripts/doc-snarf.scm       !     (   Ch]4>"G445>"G4>"G4>"G445>"G4>"G445>"G4>"G4 >"G44 5>"G4>"G4  4 5>"G4 45>"G6gentry  gfilenamefscripts/doc-snarf.scm              #   ,   <   @  E   N   Q  \   e   i  n   w   z                                  %   gnamegformat-texinfoClR;=hb]6Zgs  gfilenamefscripts/doc-snarf.scm       C;h }]4>"G6ugs  gfilenamefscripts/doc-snarf.scm       !     (   Ch]4>"G445>"G4>"G445>"G44 5>"G4 >"G44 5>"G4 >"G44 5>"G4>"G6wgentry  gfilenamefscripts/doc-snarf.scm              #   ,   <   A  L   U   Z  e   n   r  w                         gnameg format-plainCmRCngm gfilenamefscripts/doc-snarf.scm 1 J  J N U  U X  W  ` 3 e U p \ ^  a   T 8   6 U 8  :  <  > @ ! B $ I & ^ (R m ) ~ +S  /  3:  "  3< C6PK!BS{ punify.gonu[GOOF----LE-8-2.0 ]%4hs] gguile  gdefine-module*   gscripts gpunify  gfilenameS fscripts/punify.scm gexportsS  gset-current-module     g%include-in-guild-list f1Strip comments and whitespace from a Scheme file. g%summary g string->list gsymbol->string gchar=? gmemq g list->string gdisplay gwrite f( g write-punily f) f  gwith-input-from-file g eof-object? gread !gcurrent-input-port "g punify-one #gfor-each $gmainC5h]4    54>"GRR h ]!"p$B44554:5$4 5$"45""$4:>"G66$("4>"G4 >"G"X( 6$"$"4 >"G4 >"G"""gform  gls  Kgt P vgfirst gls   glast-was-list?   g new-first   gfilenamefscripts/punify.scm . =  =  >   > &  >   >   ?  ! ?  % ?  ) ?  * @  6 ?  < A  A A # C A  P /  Y C  p D  v E  v /  y /  } /  / 0  0 1 1  1 2 3 4 5  5  6 # 6  8  7 ' 8  :  : ! :  ;   <   7 '  <   3  3   3 6  3 3   gnameg write-punilyCR !hP]"445$C4>"G4455"4455"gform  :gt :gfilenamefscripts/punify.scm I   K   L  L  N  + J  . J # 4 J  : O  : K  ; J  > J # D J  J K   J Chv]6ngfile  gfilenamefscripts/punify.scm G H   gnameg punify-oneC"R#"ht-136lgargs gfilenamefscripts/punify.scm Q  R   gnamegpunifyCRi$RCgm  (gfilenamefscripts/punify.scm  ( , + . ,  1 ,  .  G  Q  T    C6PK!NH use2dot.gonu[GOOF----LE-8-2.0][4h"] gguile  gdefine-module*   gscripts guse2dot  gfilenameS fscripts/use2dot.scm gimportsS gsrfi gsrfi-13    gselectS g string-join   gfrisk  g make-frisker g edge-type gedge-up g edge-down    gexportsS  g autoloadsS gice-9 g getopt-long !  "  #!" $gset-current-module %$ &$ 'f1Print a module's dependencies in graphviz format. (g%summary )g guile-user *) +g*default-module* ,gformat -f~S .gq /gmap 0f~A=~A 1gvv 2fdigraph use2dot {  3gfor-each 4f ~A;  5glabel 6fGuile Module Dependencies 7gratio 8gfill 978 :9 ;g>>header "~A" =gautoload >gstyle ?gdotted @>? Agfontsize BA  C@B Dgcomputed Egbold F>E GF Hf [~A] If, Jf;  Kg>>body Lf} Mg>>footer Ng>> Ofuse2dot Pgdefault-module Qg single-char RQm Sgvalue TS UPRT VU Wg option-ref Xgreverse Ygedges ZgmainC5h` ]4   #5 4&>"G'(R*+R,-hs]6kgs  gfilenamefscripts/use2dot.scm ;  < <   gnamegqC.R/,0hy]6qgpair  gfilenamefscripts/use2dot.scm ?   @  @  @ '  @    Chp]6hgpairs  gfilenamefscripts/use2dot.scm > ?   gnamegvvC1R,23,4hf]6^gs  gfilenamefscripts/use2dot.scm E  E # E   C15.6: h0]4>"G445 56gfilenamefscripts/use2dot.scm C  D   D D   F  F   F  # F  % F  & F  + F - E   - gnameg>>headerC;R3,<=CDGH1IJh] 44545>"G45$"$ "$%4 4 4 5 5>"G"6gedge  gkey * Ngt N ~gfilenamefscripts/use2dot.scm O   P   P  P %  P 6  P  $ Q  * Q 7 R  D Q F S  N Q  W V  \ V  ] V $ ` V 1 h V : j V $ o V  W  W   Cht]6lgedges  gfilenamefscripts/use2dot.scm M N   gnameg>>bodyCKR,Lhj]6bgfilenamefscripts/use2dot.scm Z  [ [   gnameg>>footerCMR;KMh(]4>"G4>"G6xgedges  (gfilenamefscripts/use2dot.scm ]  ^   _  ( `   ( gnameg>>CNR OVWP+NXY hP-13454545454 445 556gargs Pg parsed-args  Pg=m  " Pgscan  . Pgfiles  9 Pgfilenamefscripts/use2dot.scm b c   c )  c #  d #  c   c   f  f % " f " c  % g  ) g  . g  . c  1 h  6 h ( 7 h , 9 h  9 c  > i  A i  B i  J i  L i  N i  P i  P gnameguse2dotCRiZRCgm  0gfilenamefscripts/use2dot.scm  0 2 7  5 7 7 9  : 9 ;  >  C  M  Z S ] V b ] k   _ C6PK!p+++snarf-guile-m4-docs.gonu[GOOF----LE-8-2.0]34hS] gguile  gdefine-module*   gscripts gsnarf-guile-m4-docs  gfilenameS fscripts/snarf-guile-m4-docs.scm gimportsS gice-9 grdelim      gexportsS  gset-current-module   g%include-in-guild-list f/Snarf out texinfo documentation from .m4 files. g%summary gdisplay f@deffn {Autoconf Macro} gfor-each gstring=? f# g substring g string-length f#  !gnewline "f @end deffn #g display-texi $gcatch %$ &$ 'gprefix? (g list->string )greverse *g string->list +g massage-usage ,g open-file -fr .g eof-object? /f# Usage: 0g read-line 1fAC_DEFUN 2gmainC5h ]4   54>"GRR !h]4"&44 55$ 4 5"B"<45 $*44 55$ 4 5"""">"G6gline  |gfilenamefscripts/snarf-guile-m4-docs.scm *  +  .   . (  . ,  .   +   /  / +  0 + ' 9 + # = +  > , # B , - C , 2 N , # R +  S -  p +  | 1   | C"!hP]4>"G4>"G4>"G4>"G6glines  Ngfilenamefscripts/snarf-guile-m4-docs.scm (  )   ) )   *  ) 3  - 3 2 3  ; 4  N 4   N gnameg display-texiC#R&hr]L4L 4L556jgfilenamefscripts/snarf-guile-m4-docs.scm 7   8  8 #  8   8    Chg-13C_gargs gfilenamefscripts/snarf-guile-m4-docs.scm 7  Ch]O6gline  gsub  gfilenamefscripts/snarf-guile-m4-docs.scm 6  7    gnamegprefix?C'R()*hp1]"Y(4455C($")$",$ ""45")gline  ogline  _gacc   _gkey  " Tgfilenamefscripts/snarf-guile-m4-docs.scm :  ;  <  =   =   =   =   >  " ?  " ?  Q A  W ?  _ >  _ ;  ` ;  g ; - o ;   o gnameg massage-usageC+R,-.'/0+1#) h-1345"45$C45$4544 55"4 5$'4 4 5>"G45""45"|$%4 5$45"U""45"= gargs gp  gline   gacc   gt  gfilenamefscripts/snarf-guile-m4-docs.scm D E  E   E "  E  E   G   H H  , I  2 I  4 I  8 I 9 F  @ J  C J - M J  U J  V K  \ K  ^ K  b I c L  f L  q L  z F  M  F  Q  I N  N ( N  N  F  O  O  G  F  G ) gnamegsnarf-guile-m4-docsCRi2RCgm  ,gfilenamefscripts/snarf-guile-m4-docs.scm  ! 0 % 2 &  5 &  (  6  : D S   C6PK!:&Y Y lint.gonu[GOOF----LE-8-2.0A ]I4h] gguile  gdefine-module*   gscripts glint  gfilenameS fscripts/lint.scm gimportsS gice-9 g common-list     gformat     gexportsS  gset-current-module   g%include-in-guild-list f1Check for bugs and style errors in a Scheme file. g%summary gscan-file-for-module-name guniq gscan-file-for-free-variables gresolve-module fResolved module: ~S  !gcatch "geval #f!Unresolved free variables in ~A:  $g write-char %gwrite &gnewline 'f#No unresolved free variables in ~A  (gwith-input-from-file )g eof-object? *gread +g define-module ,gappend -gdetect-free-variables .gmemq /gdefine-generic 0gquote 1g quasiquote 2glet 3gletrec 4gmap 5gcar 6glet* 7gand-let* 8gdefine 9g define-public :g define-macro ;glambda g define-method ?gdefine* @g define-class Agdetect-free-variables-noncar Bgcase Cgunquote Dgunquote-splicing Egelse Fg=> Ggfor-each HgmainC5h0]4   54>"GRR !"hS]LL6Kgfilenamefscripts/lint.scm x   y  y   C#$%&hh-13M$4L>"G"4 >"G4L>"G4>"GNCgargs bgfilenamefscripts/lint.scm z   {   |   }   |  )   ;  @  E  N  `  b C' h])45445545H4>"G"8("64O O>"G""J$  6C}gfilename  g module-name  g free-vars   gmodule  ! g all-resolved?  ! g free-vars  > vgfilenamefscripts/lint.scm n  o  p  p   p   o   q  ! q  & s  + s  2 s  > t  D u  I w  p  v  v t      gnameglintCR()*+hP]"945$C" 45"$&C""45"gx  ?gfilenamefscripts/lint.scm          "  "  %  )  ,  . ! 2  5  ?  @  J   J Ch]6gfilename  gfilenamefscripts/lint.scm   gnamegscan-file-for-module-nameCR(),*-h@]")45$@4545"45"gx  /gfvlists  /gfilenamefscripts/lint.scm            " 8 $  '  / /  0  5 % =   = Ch]6gfilename  gfilenamefscripts/lint.scm   gnamegscan-file-for-free-variablesCR.+/0123,45-hu]L$L"M6mgbinding  gfilenamefscripts/lint.scm "  ;  ;  $   C-hd]L6\gbodyform  gfilenamefscripts/lint.scm " $  C67-hd]M6\gbodyform  gfilenamefscripts/lint.scm    C-89:;<-hd]L6\gbodyform  gfilenamefscripts/lint.scm    C=-hd]L6\gbodyform  gfilenamefscripts/lint.scm    C>?-hd]L6\gbodyform  gfilenamefscripts/lint.scm      C@Ah]$"M6zg slot/option  gfilenamefscripts/lint.scm     <  8   <      CB-hi]M6agcase  gfilenamefscripts/lint.scm     1    CCDEFA%hh]H$4J5$CC$;$"!$"$"$C$"$r$"4J4  5544  O5?44  O5?6 $"$I(4 O5@4J54 J56$"$"$:$JKJ6JKJ6$"$U"-("/$""J"4 O5@$.4J54J54 O5@$"$f"=("@$!$"""J"4 O5@$4 O5@$4J54 O5@ $"!!$""$"#$ $J64J54$J56Cgx  fglocals  fgkey  , dgletrec?  glocals-for-let-body  glocals   gargs   glocals-for-lambda-body   glocals-for-receive-body  + Nglocals  i gargs  i glocals-for-method-body    gfilenamefscripts/lint.scm      ! ! % )  ,  , b l }    . ( ; " "   (  ' 6 ? 6 '   "     "               "  ' 5 * / /  0  4 / 7 7 < C > / B 5 H / J  L  U t  v  z } %      )  3  ?  )    %      )     *  ,  3  ,  ?  9  9  3  3  *  ;  *           ! + ( : + + + 0  5 , ;  <  H  L  N  W i * o  , x  3 |  ,   J   C   ?   C   C   9   9   3   3  *  ;  *                                *                I " * M " P $  T $ 0 X $  Y %  ^ % 7 b %  d $  e '   f gnamegdetect-free-variablesC-R.FA,-hXU] $45$CC$.$ 645456CMgx  Uglocals  Ugkey  ( Sgfilenamefscripts/lint.scm )  - -  .  .  .   . ! ! 0 % -  ( 1  ( 1 8 3 * < 3 ? 5  C 5 0 G 5  H 6  M 6 7 Q 6  S 5  T 8   U gnamegdetect-free-variables-noncarCARGhs-136kgfiles gfilenamefscripts/lint.scm :  ;   gnamegmainCHRCgm  ,gfilenamefscripts/lint.scm  f 0 k 2 l  5 l  n     ) . :   0 C6PK!TTlist.gonu[GOOF----LE-8-2.0<]@4h] gguile  gdefine-module*   gscripts glist  gfilenameS fscripts/list.scm gimportsS gsrfi gsrfi-1      gexportsS g list-scripts  gset-current-module   g%include-in-guild-list fAn alias for "help". g%summary g file-exists? gfile-is-directory? gopendir g eof-object? gclosedir greaddir gstring=? !f. "f.. #gdirectory-files $gor-map %gstring-suffix? &g string-null? 'g substring (g string-length )gappend *g%load-compiled-extensions +g%load-extensions ,gstrip-extensions -gunique .gmap /gsymbol->string 0gsort 1g append-map 2gfold 3g in-vicinity 4g %load-path 5gstring<= ?<=C5h8 ]4   54>"GRR !" h]!45$45$}45"`45$4>"GC4545$" 4 5$""45"CCgdir  g dir-stream  gnew  % gacc  % gt  U ngfilenamefscripts/list.scm #  $ $   $   $   %   %  % &  & (  0 ( 1 *  F ,  M -  Q - & U -  U -  c .  g . & k .  r -  } 0  ,  &  &  '  &  1   gnamegdirectory-filesC#R$%&'(h8]4L5$#45$CL 4L5456Cgext  4gfilenamefscripts/list.scm 4  6  5  :   5 " <  ) < 0 0 <  2 ;   4 C)*+h]O456zgpath  gfilenamefscripts/list.scm 3 =  4    gnamegstrip-extensionsC,R-h8](C(C$645Cgl  5gfilenamefscripts/list.scm ?  @   A   @   B   B   B ! @  & B + ( B # + C  , C  1 C $ 3 C  4 C   5 gnameguniqueC-R./-012,h ] 45$CCgx  grest  gstripped  gfilenamefscripts/list.scm J   K , K   L   L +   C#3hj]6bgx  gy  gfilenamefscripts/list.scm O ! O /  Ch ~]44L556vgpath  gfilenamefscripts/list.scm I   M   N  O   N   J    C45 h(] 4544O556ghead  &gshead &gfilenamefscripts/list.scm E  F  F   H   I  $ H  & G   & gnamegfind-submodulesC6R789hc]6[gx  gfilenamefscripts/list.scm T  V  V   C6:h-13456gargs gfilenamefscripts/list.scm S  W  W   W  T   gnameg list-scriptsCR?hp-13@hgargs gfilenamefscripts/list.scm Y  Z   gnamegmainC=RCgm  ,gfilenamefscripts/list.scm   0  2  5  # % 3 H ? N E S 3 Y   5 C6PK!N`##read-scheme-source.gonu[GOOF----LE-8-2.0"]N4hA] gguile  gdefine-module*   gscripts gread-scheme-source  gfilenameS fscripts/read-scheme-source.scm gimportsS gice-9 grdelim      gexportsS gread-scheme-source-silently gquoted? gclump  gset-current-module   g%include-in-guild-list f/Print a parsed representation of a Scheme file. g%summary g:type gvariable g define-module glength gdefine !galias "glambda #gstring? $g procedure %g :signature &g :std-int-doc 'g annotate! (gquote )gfilename *g make-regexp +f^#! ,f^!# -f ^[ ]*(;+) .f^[ ]*$ /gopen-input-file 0g eof-object? 1g regexp-exec 2ghash-bang-comment 3g:line 4g :line-count 5g :text-list 6greverse 7g read-line 8g whitespace 9g:text :gcomment ;g:leading-semicolons g port-line ?gappend @gfollowing-form-properties Agprocess Bgfor-each Cgwrite Dgnewline Egerror Ff bad list! Ggstring->symbol Hg substring Igsymbol->string Jgassq-ref Kgleading-semicolons Lgtext MgmainC5h]4   54>"GRR !"#$%& h]"6$"&6""B 45$0&#$$6"""" 45$& "$$z 45$e&U45$@4 >"G4 >"G 6"""""$c$U4 >"G4 >"G 45$45$  6CC"""""fgform  gnote!  gfilenamefscripts/read-scheme-source.scm c      d   d   d     " "  &  (  * . d  5 z  < z  @ y B {  E {  I y L |  N |  R y U }  X }  \ y ` ~  b ~  d ~ t d  w e  ~ e  d f  f  d q  q  n r  r  n s  s  s  s  n t  t t  n u  u  u  u  n v v  v  v w w  w " w 4 w . w  w  x   x %  x   x $ d  ' g  ) g  - d 0 h  3 h  7 d 8 i < i  > i  C i L j P j  S j  Y j d k  k k  o k p l  u l  y l  } k  m   m #  m a   gnameg annotate!C'R()*+,-./0123456789:;<=>'?h-134M5NCgargs gfilenamefscripts/read-scheme-source.scm / 7  1  gnamegprop+C@h`i]b4>"G4545454545"$4 5  $ C4 5$"p4  5  $" 4  5 $84   4 54  5>"/G"(45    "45  "|".4 5$"4>"G"4 5  $44     >"G"4>"G45 45H H 4  O>"GJ   J   $"4>"GJ K  4  J  >"G4 >"G    4545" C4545"agfile  ^gnb!  ^g hash-bang-rx  A ^g bang-hash-rx  A ^gall-comment-rx  A ^gall-whitespace-rx  A ^gp  A ^gn  O Ggline  O Ggt \ Egline x gtext x gt  gt 8 .gm1 M Ygform  +gcount  (gprops  gprops  %gt  gfilenamefscripts/read-scheme-source.scm         # # %  &  * # ,  -  1 % 3  4  8 ( :  ; A  O  U  V \  h  t x  y        2 .  - . -       $ $         #  0  8 A  E  M + M ! R & U / V # [  h  u      $  !    /  !  #          '           /  6  7 % E F G  H  O  P , ^ \  ^ gnamegprocessCARBAht]MNClge  gfilenamefscripts/read-scheme-source.scm   4 *  Chn]LO6fgfile  gfilenamefscripts/read-scheme-source.scm      C6h0-13H4O>"GJ6gfiles +gres +gfilenamefscripts/read-scheme-source.scm    +  + gnamegread-scheme-source-silentlyg documentationf6See commentary in module (scripts read-scheme-source).CRBACDht]4>"G6lge  gfilenamefscripts/read-scheme-source.scm   (  2   Chn]6fgfile  gfilenamefscripts/read-scheme-source.scm   Ch-136gfiles gfilenamefscripts/read-scheme-source.scm    gnamegread-scheme-sourceg documentationf6See commentary in module (scripts read-scheme-source).CR(EFGHIhB]"$ 45$&${ 45$l&a"Q(C$"4>"G4445 55""CCCCCC:gsym  gform  ginside  $ gls  G galist  G gfirst  S gfilenamefscripts/read-scheme-source.scm            #  $  )  - /  6  : ?  C G  M  S ! S  X  \  a  e ! j  u  w # z $ } / $ # #     2 )  gnamegquoted?CR6@82:JKL ht]Y"g(6$"45$"45$"45$"|45$"(45"G 4 5  $I4 5  $4  5"45"45"454 5"E""lgforms  {gforms  mgacc   mgpass-this-one-through?   mgform   mgt  mg inner-forms  8glevel  8gtext  8g inner-form 8gt 8g new-level  gfilenamefscripts/read-scheme-source.scm            % # 0  1  5  9  = @  E # P  Q  U  Y  ] `  m  n  r  v  z }         < 0 * $  0    '  0  '   3  4  3  ,  2  .  9  ?  @  ?  9   2  <  0  *  $ # < * 0 - * 8 $ 8  ; / < ) B 9 D ) E . K > M . P ( Z  ]   b  ( m   m  p { R  { gnamegclumpCRiMRCgm  ,gfilenamefscripts/read-scheme-source.scm  V 0 ] 2 ^  5 ^  c   F ] w ~     C6PK!9||disassemble.gonu[GOOF----LE-8-2.0d]#4h] gguile  gdefine-module*   gscripts g disassemble  gfilenameS fscripts/disassemble.scm gimportsS gsystem gvm gobjcode     glanguage gassembly  gprefixS gasm:   gexportsS  gset-current-module   f Disassemble a compiled .go file. g%summary gfor-each gasm:disassemble !g load-objcode "gmainC5hz]4   54>"GR !hm]456egfile  gfilenamefscripts/disassemble.scm $  %  %   Ch-136wgfiles gfilenamefscripts/disassemble.scm #  $   gnameg disassembleCRi"RCrgm  ,gfilenamefscripts/disassemble.scm   . !  1 ! r # y (   { C6PK!PU'U' compile.gonu[GOOF----LE-8-2.0=']4h" ] gguile  gdefine-module*   gscripts gcompile  gfilenameS fscripts/compile.scm gimportsS gsystem gbase    gselectS g compile-file   gtarget     gmessage     gsrfi gsrfi-1   gsrfi-13   gsrfi-37 !  "! #gice-9 $gformat %#$ &% '"& (gexportsS ) *gset-current-module +* ,* -fCompile a file. .g%summary /gcurrent-error-port 0ferror: ~{~a~}~% 1gexit 2gfail 3gsrfi-37:option 4!3 5!3 6fhelp 7h6 8g alist-cons 9ghelp? :fversion ;: L= ?g assoc-ref @g load-path Afoutput BoA Cg output-file Df.`-o' option cannot be specified more than once Efwarn FWE Ggstring=? Hgshow-warning-help Igwarnings Jgstring->symbol Kg alist-delete Lfoptimize MOL Ng optimize? Offrom PfO Qgfrom Rf2`--from' option cannot be specified more than once Sfto TtS Ugto Vf0`--to' option cannot be specified more than once Wftarget XTW Yf4`--target' option cannot be specified more than once Zg%options [g args-fold \f~A: unrecognized option ]g input-files ^] _@ `gunsupported-warning aI` b^_a cg parse-args dfcompile (GNU Guile) ~A~% egversion ffCopyright (C) 2009, 2011 Free Software Foundation, Inc. License LGPLv3+: GNU LGPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.~% gf$The available warning types are:~%~% hgfor-each if ~22A ~A~% jf`~A' kg lk mk ngsrfi-9 on pgthrow-bad-struct qop rop sgwarning-type-name tgwarning-type-description ug%warning-types vf~% wgwarningsS xgOS ygscheme zgobjcode {g %host-type |fUsage: compile [OPTION] FILE... Compile each Guile source file FILE into a Guile object. -h, --help print this help message -L, --load-path=DIR add DIR to the front of the module load path -o, --output=OFILE write output to OFILE -W, --warn=WARNING emit warnings of type WARNING; use `--warn=help' for a list of available warnings -f, --from=LANG specify a source language other than `scheme' -t, --to=LANG specify a target language other than `objcode' -T, --target=TRIPLET produce bytecode for host TRIPLET Note that auto-compilation will be turned off. Report bugs to <~A>.~% }g%guile-bug-report-address ~gappend g %load-path g%load-should-auto-compile f"`-o' option can only be specified  fwhen compiling a single file g sigaction gSIGINT finterrupted by the user f wrote `~A'  g*current-warning-prefix* f g with-target g output-fileS gfromS gtoS goptsS gmainC5hK]4   '()54,>"G-.R$/01h(-13445>"G 6gmessages 'gfilenamefscripts/compile.scm + ,  ,  ,   ,  ' -  ' gnamegfailC2R5789h]6gopt  gname  garg   gresult   gfilenamefscripts/compile.scm 2   3  3   C5;<1h]4>"G 6gopt  gname  garg   gresult   gfilenamefscripts/compile.scm 5   6   7    C5>?@8h ] 456gopt  gname  garg   gresult   g load-path  gfilenamefscripts/compile.scm :   ; # ; 5 ; # ;   <  < +  <    C5B?C2D8h ]45$66gopt  gname  garg   gresult   gfilenamefscripts/compile.scm ?   @  @ ( @   @   A   A   B "  B    C5FG6H1?I8JK hH-] 45$4>"G 645454 56%gopt  Hgname  Hgarg   Hgresult   Hgwarnings  - Hgfilenamefscripts/compile.scm E   F  F $ F   F   H  $ I  % J & + J 8 - J & - J  3 K $ 4 L * = L $ > M $ B M 2 F M $ H K   H C5M8Nh]6gopt  gname  garg   gresult   gfilenamefscripts/compile.scm P   Q  Q   C5P?Q2R8Jh(]45$6456gopt  $gname  $garg   $gresult   $gfilenamefscripts/compile.scm S   T  T ( T   T   U   U   V "  V ( $ V   $ C5T?U2V8Jh(]45$6456gopt  $gname  $garg   $gresult   $gfilenamefscripts/compile.scm X   Y  Y ( Y   Y   Z   Z   [ "  [ & $ [   $ C5X?2Y8h ]45$66gopt  gname  garg   gresult   gfilenamefscripts/compile.scm ]   ^  ^ ( ^   ^   _   _   ` "  `    C ZR[Z$/\1h ]445>"G 6gopt  gname  garg   gresult   gfilenamefscripts/compile.scm f  g   g  g ,  g  h   C?]8h ] 456gfile  gresult  g input-files  gfilenamefscripts/compile.scm i  j " j 4 j " j   k   k *  k    Cbh]6gargs  gfilenamefscripts/compile.scm b  o  e    gnameg parse-argsg documentationfQParse argument list @var{args} and return an alist with all the relevant options.CcR$defh(]445>"G6gfilenamefscripts/compile.scm s  t   t t (  t   u ! u   ! gnameg show-versionC"G4>"G6gfilenamefscripts/compile.scm z  {   { {   |  . 0   0 gnamegshow-warning-helpCHRc?9wINxQyUz{]C@$|}1~22hn-136fgargs gfilenamefscripts/compile.scm      Ch$hP]LLLLL6 Hgfilenamefscripts/compile.scm      Ch(~]Y4LLLLLO5Z6vgfile  &gfilenamefscripts/compile.scm    @   &   & C hp-13 45454545$ "45$" 4 5$" 4 5$" 454545 $"$*4>"G4 >"G"4 5  $0("$4>"G""4>"GO6gargs ngoptions  nghelp?   ngo  + Hg compile-opts  H ngt  S fgfrom  f ngt  q gto  ngt  gtarget  ng input-files  ng output-file  ng load-path ngfilenamefscripts/compile.scm       -      # & & 9 ( & + # +  . 4 3 6 :  ? H  K  Q 1 S  S  c 8 f  i  o 1 q  q  6   1     -    -    -                  #  $  %  )  *  .  0  5  F  n H n gnamegcompileCRiRCCgm  ,gfilenamefscripts/compile.scm   . (  1 (  +  1   1   4   4   9   9   >   >   D   D   O  J O  N R  r R  v W  W  \  \  1  / b y s P z      C6PK! runner.pycnu[ Yc@@sdZddlmZddlmZddlZddlZddlZddlZddlm Z ddl m Z m Z ddl mZdZd Zd Zd Zd ZdS( s raven.scripts.runner ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. i(tabsolute_import(tprint_functionN(t OptionParser(tClientt get_version(tjsoncC@sbytj|}Wn2tk rGtd||ftjdnXt|j|j|dS(Ns2Invalid JSON was used for option %s. Received: %si( Rtloadst ValueErrortprinttsystexittsetattrtvaluestdest(toptiontopt_strtvaluetparser((sE/opt/alt/python27/lib/python2.7/site-packages/raven/scripts/runner.pyt store_jsons  cC@sttdrtjSdS(Nt getloadavg(thasattrtosRtNone(((sE/opt/alt/python27/lib/python2.7/site-packages/raven/scripts/runner.pyt get_loadavg s cC@s<yddl}Wntk r$dSX|jtjdS(Ni(tpwdt ImportErrorRtgetpwuidRtgeteuid(R((sE/opt/alt/python27/lib/python2.7/site-packages/raven/scripts/runner.pytget_uid&s  cC@sxtjjdx4dD],}tjjd|t|j|fqWtjjd|j}|jstjjdtjd n|jstjjd tjd n|jd id d 6dd6idd6dd6d6}tjjdtjj |j ddd |dt j dt d|jdiditd6td6}tjjd|fdS( NsClient configuration: tbase_urltprojectt public_keyt secret_keys %-15s: %s s s'Error: DSN configuration is not valid! is)Error: Client reports as being disabled! tdatasraven.scripts.runnertculprits raven.testtloggertGETtmethodshttp://example.comturltrequestsSending a test message... tmessages5This is a test message generated using ``raven test``tleveltstackttagstextratusertloadavgsEvent ID was %r (RRRR (R tstdouttwritetgetattrtremotet is_activeR t is_enabledtgettflushtcaptureMessagetloggingtINFOtTrueRR(tclienttoptionstkt remote_configR!tident((sE/opt/alt/python27/lib/python2.7/site-packages/raven/scripts/runner.pytsend_test_message.s: *        c C@s{tjd}|jtjtdt}|jddddtdddd d d |jd dddtdddd d d |j\}}dj |d pt j j d}|st dt dtjd nt dt d|t t|ddg}t||jtjd|jjrgtjjdtjd ntjjddS(Ns sentry.errorstversions--datatactiontcallbackttypetstringtnargsiR R!s--tagsR+t t SENTRY_DSNs!Error: No configuration detected!sVYou must either pass a DSN to the command, or set the SENTRY_DSN environment variable.sUsing DSN configuration:t include_pathstraveniserror! s success! (R8t getLoggertsetLeveltDEBUGRRt add_optionRt parse_argstjoinRtenvironR5RR R RR@t__dict__ttimetsleeptstatetdid_failR/R0(trootRtoptstargstdsnR;((sE/opt/alt/python27/lib/python2.7/site-packages/raven/scripts/runner.pytmainXs.%     (t__doc__t __future__RRR8RR RStoptparseRRJRRtraven.utils.jsonRRRRR@R[(((sE/opt/alt/python27/lib/python2.7/site-packages/raven/scripts/runner.pyts       *PK!vS __init__.pycnu[ Yc@@sdZddlmZdS(s raven.scripts ~~~~~~~~~~~~~ :copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. i(tabsolute_importN(t__doc__t __future__R(((sG/opt/alt/python27/lib/python2.7/site-packages/raven/scripts/__init__.pytsPK! __init__.pynu[""" raven.scripts ~~~~~~~~~~~~~ :copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import PK! runner.pynu[""" raven.scripts.runner ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from __future__ import print_function import logging import os import sys import time from optparse import OptionParser from raven import Client, get_version from raven.utils.json import json def store_json(option, opt_str, value, parser): try: value = json.loads(value) except ValueError: print("Invalid JSON was used for option %s. Received: %s" % (opt_str, value)) sys.exit(1) setattr(parser.values, option.dest, value) def get_loadavg(): if hasattr(os, 'getloadavg'): return os.getloadavg() return None def get_uid(): try: import pwd except ImportError: return None return pwd.getpwuid(os.geteuid())[0] def send_test_message(client, options): sys.stdout.write("Client configuration:\n") for k in ('base_url', 'project', 'public_key', 'secret_key'): sys.stdout.write(' %-15s: %s\n' % (k, getattr(client.remote, k))) sys.stdout.write('\n') remote_config = client.remote if not remote_config.is_active(): sys.stdout.write("Error: DSN configuration is not valid!\n") sys.exit(1) if not client.is_enabled(): sys.stdout.write('Error: Client reports as being disabled!\n') sys.exit(1) data = options.get('data', { 'culprit': 'raven.scripts.runner', 'logger': 'raven.test', 'request': { 'method': 'GET', 'url': 'http://example.com', } }) sys.stdout.write('Sending a test message... ') sys.stdout.flush() ident = client.captureMessage( message='This is a test message generated using ``raven test``', data=data, level=logging.INFO, stack=True, tags=options.get('tags', {}), extra={ 'user': get_uid(), 'loadavg': get_loadavg(), }, ) sys.stdout.write('Event ID was %r\n' % (ident,)) def main(): root = logging.getLogger('sentry.errors') root.setLevel(logging.DEBUG) # if len(root.handlers) == 0: # root.addHandler(logging.StreamHandler()) parser = OptionParser(version=get_version()) parser.add_option("--data", action="callback", callback=store_json, type="string", nargs=1, dest="data") parser.add_option("--tags", action="callback", callback=store_json, type="string", nargs=1, dest="tags") (opts, args) = parser.parse_args() dsn = ' '.join(args[1:]) or os.environ.get('SENTRY_DSN') if not dsn: print("Error: No configuration detected!") print("You must either pass a DSN to the command, or set the SENTRY_DSN environment variable.") sys.exit(1) print("Using DSN configuration:") print(" ", dsn) print() client = Client(dsn, include_paths=['raven']) send_test_message(client, opts.__dict__) # TODO(dcramer): correctly support async models time.sleep(3) if client.state.did_fail(): sys.stdout.write('error!\n') sys.exit(1) sys.stdout.write('success!\n') PK!nO=XCXCjcryption/jquery.jcryption.jsnu[PK!j5j5Crealtime_stats.jsnu[PK! 5Pychart.umd.min.jsnu[PK! @^@^jquery-3.6.1.min.jsnu[PK!ԻA'' general.jsnu[PK!>3-S-Schart.umd.js.mapnu[PK!MM klsruby_runner.rbnuȯPK!C-obeer.pynuȯPK!G qmboxconvert.pyonu[PK!*R  ~pp.pycnu[PK!Lbeer.pycnu[PK!    ڊlpwatch.pynuȯPK!K )markov.pynuȯPK!Lgbeer.pyonu[PK!8^pp.pynuȯPK!MHYZZ yprimes.pynuȯPK! from.pyonu[PK!Ir 3makedir.pynuȯPK!*R  jpp.pyonu[PK!hq update.pyonu[PK!й markov.pyonu[PK!) - - lpwatch.pyonu[PK! Bfind-uname.pyonu[PK!LC C >unbirthday.pynuȯPK!VB queens.pycnu[PK!zv READMEnu[PK!cA-D script.pycnu[PK!from.pycnu[PK!Xi #queens.pynuȯPK!hq !update.pycnu[PK!ټgll,fact.pynuȯPK!0eqfix.pynuȯPK! BIfind-uname.pycnu[PK!1:t t Omboxconvert.pynuȯPK!Gx# r\makedir.pycnu[PK!Gx# _makedir.pyonu[PK!@Iwwbpi.pynuȯPK!0yܺ Lfunbirthday.pyonu[PK!`(Drfact.pycnu[PK!R~ wpi.pycnu[PK!0yܺ zunbirthday.pycnu[PK!aPOO ҆morse.pyonu[PK!G Zmboxconvert.pycnu[PK!]"> Nfind-uname.pynuȯPK!u=iiBfrom.pynuȯPK!`(fact.pyonu[PK!qD eqfix.pyonu[PK!qD eqfix.pycnu[PK!(N Oupdate.pynuȯPK!) - - Elpwatch.pycnu[PK!# primes.pyonu[PK!T`morse.pynuȯPK!R~pi.pyonu[PK!aPOO amorse.pycnu[PK!# primes.pycnu[PK!й markov.pycnu[PK!cA-D *script.pyonu[PK!VB /queens.pyonu[PK!; ;script.pynuȯPK!X ?install.shnuȯPK!RT++Ugen-dev-ignores.jsnu[PK!VDWpublish-tag.jsnu[PK! Xrelease.shnu[PK!y} "[relocate.shnuȯPK!+ FF]maketestnuȯPK!CSxedev-dep-updatenuȯPK!% fdep-updatenuȯPK!!R gchangelog.jsnu[PK!umsindex-build.jsnuȯPK!LKzupdate-authors.shnuȯPK!RWN {gen-changelognuȯPK!a; }doc-build.shnuȯPK!P clean-old.shnuȯPK! vvv byteyears.pycnu[PK!((TT =eptags.pyonu[PK!ppˣcleanfuture.pyonu[PK!C; fixheader.pyonu[PK!r%~mailerdaemon.pynuȯPK!GiA[  checkpyc.pycnu[PK!Fcff pickle2db.pynuȯPK!R pysource.pycnu[PK! k rgrep.pynuȯPK!+ pysource.pynuȯPK!yIo"win_add2path.pycnu[PK!j3%q )+patchcheck.pynuȯPK!oHq]] eIclassfix.pycnu[PK! ]Yhotshotmain.pynuȯPK! `ptags.pycnu[PK!// euntabify.pyonu[PK!l:E *lgoogle.pyonu[PK!hX X |osvneol.pycnu[PK!RA {byext.pycnu[PK!&l copytime.pyonu[PK! Րlll.pyonu[PK!-Ő nm2def.pycnu[PK!Dx x linktree.pynuȯPK!X> 7fixcid.pyonu[PK!n\6))find_recursionlimit.pycnu[PK!@wGGhotshotmain.pycnu[PK! redemo.pyonu[PK!=~ww gprof2html.pynuȯPK!((h2py.pyonu[PK!mx~[[ mkreal.pynuȯPK!Fw|!!ucleanfuture.pynuȯPK!((4>h2py.pycnu[PK!:W--Ofindlinksto.pynuȯPK!H9 Scheckpip.pyonu[PK!) OXuntabify.pynuȯPK!c3`` I]which.pycnu[PK!QZ ctexcheck.pycnu[PK!x քmethfix.pyonu[PK! vvv .byteyears.pyonu[PK!N66 fixdiv.pycnu[PK!8>}EE 4objgraph.pyonu[PK!]o#combinerefs.pyonu[PK!jv sgoogle.pynuȯPK!-Ő nm2def.pyonu[PK!G_o##}patchcheck.pyonu[PK!Bppc'lfcr.pyonu[PK! G  +findnocoding.pynuȯPK!d8fOO B6dutree.pynuȯPK!oHq]] <classfix.pyonu[PK!l8cMsetup.pynu[PK!TFm @Ologmerge.pycnu[PK!!0ee Wcbyteyears.pynuȯPK!yIoiwin_add2path.pyonu[PK!S; Mrfindnocoding.pycnu[PK!{{serve.pynuȯPK!3R== serve.pyonu[PK!ܽ\k7cleanfuture.pycnu[PK!1 Xmkreal.pycnu[PK!.rff Ntreesync.pycnu[PK!A_xxci.pycnu[PK!1VTTwin_add2path.pynu[PK!GT lredemo.pynuȯPK!C; Efixheader.pycnu[PK!1"v Apathfix.pyonu[PK!= z pdeps.pycnu[PK!)`% Gfixheader.pynuȯPK!A b(findlinksto.pycnu[PK!ީ$YY  rgrep.pyonu[PK!YV(analyze_dxp.pyonu[PK!T^U;lll.pynuȯPK!qq>suff.pyonu[PK!͗[ 1Bpickle2db.pycnu[PK!h^^YQwhich.pynuȯPK! TWreindent-rst.pycnu[PK! R R Zdiff.pyonu[PK!ī ctexi2html.pynuȯPK! tnm2def.pynuȯPK!:OrG%% [~reindent.pycnu[PK!Q<` 4db2pickle.pyonu[PK! ZQ Q md5sum.pynuȯPK!!溙,, reindent.pynuȯPK!8e e xmd5sum.pycnu[PK!l:E google.pycnu[PK!A_ixxci.pyonu[PK!A bRfindlinksto.pyonu[PK!QZ " texcheck.pyonu[PK!Ɨ .treesync.pynuȯPK!h>11Dcheckappend.pynuȯPK!dvWWparseentities.pynuȯPK! TN^reindent-rst.pyonu[PK!H9 o`checkpip.pycnu[PK!S; dfindnocoding.pyonu[PK!w/=L qfixnotice.pyonu[PK!%d iobjgraph.pynuȯPK!͗[ %pickle2db.pyonu[PK! Mlll.pycnu[PK!hxmm2analyze_dxp.pynuȯPK!!=e ݺndiff.pycnu[PK!// )untabify.pycnu[PK!3R== serve.pycnu[PK!)ML{E{E  texi2html.pycnu[PK!1"v pathfix.pycnu[PK! R R +diff.pycnu[PK!tO 5db2pickle.pynuȯPK!n0& Cfixnotice.pynuȯPK!cOndiff.pynuȯPK!}}^fixps.pynuȯPK!H8``bpdeps.pynuȯPK!7[hh?rbyext.pynuȯPK!)ML{E{E ߁texi2html.pyonu[PK!&l copytime.pycnu[PK!55 |fixdiv.pyonu[PK!sss |cvsfiles.pyonu[PK!O + xxci.pynuȯPK!FK Odutree.pyonu[PK!@@ ?classfix.pynuȯPK!/ 5pathfix.pynuȯPK!FK Fdutree.pycnu[PK!BppOlfcr.pycnu[PK!quSsuff.pycnu[PK! 5Wredemo.pycnu[PK!sss kcvsfiles.pycnu[PK!TFm tlogmerge.pyonu[PK!($($ texcheck.pynu[PK!((TT eptags.pycnu[PK!CxWWcrlf.pyonu[PK!r[u 6find_recursionlimit.pynuȯPK!]KgAA h2py.pynuȯPK! gprof2html.pycnu[PK!p ifdef.pycnu[PK!1 mkreal.pyonu[PK!Rparseentities.pyonu[PK!H66  fixdiv.pynuȯPK!Q<` X6 db2pickle.pycnu[PK!8e e >D md5sum.pyonu[PK!|$$ O setup.pycnu[PK! :R gprof2html.pyonu[PK!|$$ ][ setup.pyonu[PK!ީ$YY ] rgrep.pycnu[PK!n\6))Le find_recursionlimit.pyonu[PK! [(L{ mailerdaemon.pyonu[PK!p  ifdef.pyonu[PK!~Xҡ combinerefs.pycnu[PK! [(L mailerdaemon.pycnu[PK!/  checkpyc.pynuȯPK!  ptags.pyonu[PK!=  pdeps.pyonu[PK!@wGGO hotshotmain.pyonu[PK!R parseentities.pycnu[PK!RTv%v% 3 reindent.pyonu[PK!8>}EE !objgraph.pycnu[PK! tCC f3!pindent.pynuȯPK!߉mjjv!lfcr.pynuȯPK!X> Sy!fixcid.pycnu[PK!YV8!analyze_dxp.pycnu[PK!RA !byext.pyonu[PK!GiA[ !checkpyc.pyonu[PK!!=e !ndiff.pyonu[PK!ECJ %!linktree.pycnu[PK!U6 J!svneol.pyonu[PK!'-'- !pindent.pycnu[PK!Ӕ& "eptags.pynuȯPK!x "methfix.pycnu[PK!K+"checkappend.pyonu[PK!5>"reindent-rst.pynuȯPK! #?"diff.pynuȯPK!n6r r >H"svneol.pynuȯPK!Xj S"fixps.pycnu[PK!G_o##W"patchcheck.pycnu[PK!▘E {"finddiv.pycnu[PK!w/=L "fixnotice.pycnu[PK!ۣ. Ֆ"logmerge.pynuȯPK!▘E ׬"finddiv.pyonu[PK!+Q"ptags.pynuȯPK!.rff "treesync.pyonu[PK!= "copytime.pynuȯPK!c3`` f"which.pyonu[PK!'-'- "pindent.pyonu[PK!CxWWa #crlf.pycnu[PK!ECJ #linktree.pyonu[PK!$O0mm#suff.pynuȯPK!y~ ' ' #fixcid.pynuȯPK! ܥ B#checkpip.pynuȯPK!ae -F#cvsfiles.pynuȯPK!R bM#pysource.pyonu[PK!SrG]#ifdef.pynuȯPK!`''bbl#crlf.pynuȯPK!n#checkappend.pycnu[PK!Xj #fixps.pyonu[PK!tw!Y#combinerefs.pynuȯPK!K< O#finddiv.pynuȯPK!:zVV ^#methfix.pynuȯPK!F8kI#I##common/Activate.ps1nu[PK!?\z#common/activatenu[PK!@+f#posix/activate.cshnu[PK!PM#posix/activate.fishnu[PK!sJo 1#update-dist-tags.jsnu[PK!kEuLL N#docs-build.jsnu[PK!\5.#prnuȯPK!))$frisk.gonu[PK!X)l9$read-text-outline.gonu[PK!"m#G#GU$snarf-check-and-output-texi.gonu[PK!XZSk)k) `$scan-api.gonu[PK!@F $display-commentary.gonu[PK!g^d""$summarize-guile-TODO.gonu[PK!0"" A$api-diff.gonu[PK!%generate-autoload.gonu[PK!tC*^&& %%autofrisk.gonu[PK!iL%read-rfc822.gonu[PK!C&C!!`%help.gonu[PK!;^AA ~%doc-snarf.gonu[PK!BS{ z%punify.gonu[PK!NH %use2dot.gonu[PK!p+++%snarf-guile-m4-docs.gonu[PK!:&Y Y %lint.gonu[PK!TT &list.gonu[PK!N`##6&read-scheme-source.gonu[PK!9||@&disassemble.gonu[PK!PU'U' =E&compile.gonu[PK! l&runner.pycnu[PK!vS }&__init__.pycnu[PK! &__init__.pynu[PK! &runner.pynu[PK((IW_&