社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

Python数据科学实践 | 函数与模块

狗熊会 • 5 年前 • 545 次点击  
(function () { var ajaxWhiteList = { 1: { reg: /^https?:\/\/mp\.weixin\.qq\.com\/mp\/appmsg_like/, times: 0 }, 2: { reg: /^https?:\/\/mp\.weixin\.qq\.com\/mp\/appmsg_comment((\?|&)[^=]*?=[^&]*?)*?(\?|&)action=likecomment/, times: 0 }, 3: { reg: /^https?:\/\/mp\.weixin\.qq\.com\/mp\/appmsg_comment((\?|&)[^=]*?=[^&]*?)*?(\?|&)action=addcomment/, times: 0 }, 4: { reg: /^https?:\/\/mp\.weixin\.qq\.com\/mp\/authorreward/, times: 0 } }; if (!performance || !performance.getEntries) return; var hasReported = false; var reportResLoadTime = function () { if (hasReported) return; var notSupport = false; var ajaxEntries = []; var entries = performance.getEntries().map(function (entry) { if (typeof entry !== 'object') { notSupport = true; } else if (entry.entryType === undefined) { notSupport = true; } else if ( entry.entryType !== 'navigation' && entry.entryType !== 'resource' ) { return null; } else if (entry.initiatorType === undefined) { notSupport = true; } else if (entry.initiatorType === 'xmlhttprequest') { if (entry.name === undefined || entry.duration === undefined) { notSupport = true; } else { for (var scene in ajaxWhiteList) { if (Object.prototype.hasOwnProperty.call(ajaxWhiteList, scene)) { var ajaxItem = ajaxWhiteList[scene]; if (ajaxItem.times < 10 && ajaxItem.reg.test(entry.name)) { ajaxEntries.push({ scene: scene, protocol: entry.nextHopProtocol, is_https: isHttps(entry), time: entry.duration }); ajaxItem.times++; } } } } return null; } return entry; }); if (notSupport || ajaxEntries.length === 0) return; var data = { stat_list: ajaxEntries }; var img = new Image(); img.src = 'https://mp.weixin.qq.com/mp/timereport?data=' + JSON.stringify(data); hasReported = true; }; window.addEventListener('beforeunload', reportResLoadTime, false); window.addEventListener('unload', reportResLoadTime, false); function isHttps(entry) { if (/^https/.test(entry.name)) return 1; else return 0; } })();
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/37524
 
545 次点击