How to use max method in localstack

Best Python code snippet using localstack_python

smartSteps.js

Source:smartSteps.js Github

copy

Full Screen

1/**2 * echarts 值轴分段刻度计算方法3 *4 * @desc echarts基于Canvas,纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据统计图表。5 * @author Kener (@Kener-林峰, kener.linfeng@gmail.com)6 * @author xieshiwei (谢世威, i6ma@i6ma.com)7 *8 */9/**10 * 最值、跨度、步长取近似值11 * 注意:不适用于高精度需求,或者很多位有效数字的情况!!!12 * @function smartSteps13 * @param {Number} min 最小值14 * @param {Number} max 最大值15 * @param {Number} [section] 段数只能是 [0, 99] 的整数,段数为 0 或者不指定段数时,将自动调整段数16 * @param {Object} [opts] 其它扩展参数17 * @param {Array} opts.steps 自定义步长备选值,如 [10, 12, 15, 20, 25, 30, 40, 50, 60, 80] ,但必须 => [10, 99]18 * @return {Object} {min: 新最小值, max: 新最大值, secs: 分段数, step: 每段长, fix: 小数保留位数, pnts: [分段结果]}19 */20define(function() {21var mySteps = [10, 20, 25, 50];22var mySections = [4, 5, 6];23var custOpts;24var custSteps;25var custSecs;26var minLocked;27var maxLocked;28var MT = Math;29var MATH_ROUND = MT.round;30var MATH_FLOOR = MT.floor;31var MATH_CEIL = MT.ceil;32var MATH_ABS = MT.abs;33function MATH_LOG(n) {return MT.log(MATH_ABS(n)) / MT.LN10;}34function MATH_POW(n) {return MT.pow(10, n);}35function MATH_ISINT(n) {return n === MATH_FLOOR(n);}36function smartSteps(min, max, section, opts) {37 // 拿公共变量来接收 opts.steps 这个参数,就不用带着参数层层传递了,注意在函数的最终出口处释放这个值38 custOpts = opts || {};39 custSteps = custOpts.steps || mySteps;40 custSecs = custOpts.secs || mySections;41 section = MATH_ROUND(+section || 0) % 99; // 段数限定在 [0, 99] ,0 则自适应42 min = +min || 0;43 max = +max || 0;44 minLocked = maxLocked = 0;45 if ('min' in custOpts) {46 min = +custOpts.min || 0;47 minLocked = 1;48 }49 if ('max' in custOpts) {50 max = +custOpts.max || 0;51 maxLocked = 1;52 }53 if (min > max) {max = [min, min = max][0];} // 最值交换54 var span = max - min;55 if (minLocked && maxLocked) {56 return bothLocked(min, max, section); // 两个最值同时被锁定,注意差值为 0 的情况57 }58 if (span < (section || 5)) { // 跨度值小于要分的段数,步长将会小于 159 if (MATH_ISINT(min) && MATH_ISINT(max)) { // 步长小于 1 同时两个最值都是整数,特别处理60 return forInteger(min, max, section); // 也要考虑差值为 0 的情况61 }62 else if (span === 0) { // 非整数且跨度为 0 的情况63 return forSpan0(min, max, section);64 }65 }66 return coreCalc(min, max, section); // 非特殊情况的计算,须确保 min < max67}68/**69 * 构造返回值,处理小数精度等问题70 * @param {Number} newMin 最小值71 * @param {Number} newMax 最大值72 * @param {Number} section 分段数73 * @param {Number} [expon] 计算量级74 * @return {Object} 同 smartSteps75 */76function makeResult(newMin, newMax, section, expon) {77 expon = expon || 0; // 这是中间计算量级,受步长增长、特别是最值锁定的影响,可能会小于基准量级,因为整数部分被过度放大78 var expStep = expNum((newMax - newMin) / section, -1);79 var expMin = expNum(newMin, -1, 1); // 锁定的最值有效数位可能很多,需要全精度保留80 var expMax = expNum(newMax, -1);81 var minExp = MT.min(expStep.e, expMin.e, expMax.e); // 这个值实际上就是各值整数部分尾部多余的 0 的个数82 if (expMin.c === 0) { // 0 可以有任意多个尾083 minExp = MT.min(expStep.e, expMax.e);84 } else if (expMax.c === 0) {85 minExp = MT.min(expStep.e, expMin.e);86 }87 expFixTo(expStep, {c: 0, e: minExp});88 expFixTo(expMin, expStep, 1);89 expFixTo(expMax, expStep);90 expon += minExp; // 最终的基准量级,在这个量级下,各值刚好能表示成整数91 newMin = expMin.c;92 newMax = expMax.c;93 var step = (newMax - newMin) / section;94 var zoom = MATH_POW(expon);95 var fixTo = 0;96 var points = [];97 for (var i = section + 1; i--;) { // 因为点数比段数多 198 points[i] = (newMin + step * i) * zoom; // 如果不涉及小数问题,这里就直接使用数值型99 }100 if (expon < 0) {101 fixTo = decimals(zoom); // 前面已经去掉了各值尾部多余的 0 ,所以 zoom 的小数位就是最终的 fix 位数102 step = +(step * zoom).toFixed(fixTo); // toFixed 处理长尾小数问题,如:0.2 * 0.1 = 0.020000000000000004103 newMin = +(newMin * zoom).toFixed(fixTo);104 newMax = +(newMax * zoom).toFixed(fixTo);105 for (var i = points.length; i--;) {106 points[i] = points[i].toFixed(fixTo); // 为保证小数点对齐,统一转为字符型107 +points[i] === 0 && (points[i] = '0'); // 0.000 不好看108 }109 }110 else {111 newMin *= zoom;112 newMax *= zoom;113 step *= zoom;114 }115 custSecs = 0;116 custSteps = 0;117 custOpts = 0;118 // 这些公共变量可能持用了对用户参数的引用,这里是函数的最终出口,释放引用119 return {120 min: newMin, // 新最小值121 max: newMax, // 新最大值122 secs: section, // 分段数123 step: step, // 每段长124 fix: fixTo, // 小数保留位数,0 则为整数125 exp: expon, // 基准量级,并非原值所在的量级,而是说在这个量级下,各值能表示成整数126 pnts: points // 分段结果,整数都是数值型,小数时为了对齐小数点,都是字符型,但其中 0 不带小数点,即没有 "0.000"127 };128}129/**130 * 量级计数法 表示数值,不适用于很大或者很小的数,0 更不行131 * @param {Number} num 原数132 * @param {Number} [digit = 2] 精度位数,必须 => [1, 9]133 * @param {Boolean} [byFloor = 0] 默认为 0 表示近似值不小于原值,置 1 表示近似值不大于原值134 * @return {Object} {c: c, e: e} c e 都是整数,c * 10 ^ e 即为原值的近似数135 * @description 返回值应该更详细一点:{c: c, e: e, d: d, n: n} ,其中 d 是 c 的位数,n = c * 10 ^ e ,不过目前好像不太有用136 */137function expNum(num, digit, byFloor) {138 digit = MATH_ROUND(digit % 10) || 2;139 if (digit < 0) { // 全精度位数140 if (MATH_ISINT(num)) { // 整数的全精度位数,要去掉尾 0 ,但 0 也是整数,要专门留一位精度141 digit = ('' + MATH_ABS(num)).replace(/0+$/, '').length || 1;142 }143 else { // 小数的全精度位数,要去掉首 0144 num = num.toFixed(15).replace(/0+$/, ''); // toFixed 处理长尾小数145 digit = num.replace('.', '').replace(/^[-0]+/, '').length;146 num = +num; // '' + 0.0000001 会得到 '1e-7'147 }148 }149 var expon = MATH_FLOOR(MATH_LOG(num)) - digit + 1;150 var cNum = +(num * MATH_POW(-expon)).toFixed(15) || 0; // toFixed 处理长尾小数问题151 cNum = byFloor ? MATH_FLOOR(cNum) : MATH_CEIL(cNum); // 向上取整可能发生进位,使精度位数增加 1152 !cNum && (expon = 0);153 if (('' + MATH_ABS(cNum)).length > digit) { // 整数位数判断,字符串法比对数法快近一倍154 expon += 1;155 cNum /= 10;156 }157 return {158 c: cNum,159 e: expon160 };161}162/**163 * 将前者的指数对齐到后者,如果前者量级较小,就是强制加大指数,值误差可能严重放大,甚至值变为 0164 */165function expFixTo(expnum1, expnum2, byFloor) {166 var deltaExp = expnum2.e - expnum1.e;167 if (deltaExp) {168 expnum1.e += deltaExp; // 指数减小时,只需将整数部分相应放大169 expnum1.c *= MATH_POW(-deltaExp); // 指数增加时,整数部分将缩小,就涉及 floor ceil 取整和变 0 问题170 expnum1.c = byFloor ? MATH_FLOOR(expnum1.c) : MATH_CEIL(expnum1.c);171 }172}173/**174 * 将两个量级数的指数对齐到较小者175 */176function expFixMin(expnum1, expnum2, byFloor) {177 if (expnum1.e < expnum2.e) {178 expFixTo(expnum2, expnum1, byFloor);179 }180 else {181 expFixTo(expnum1, expnum2, byFloor);182 }183}184/**185 * 基于量级计数法,对原值的整数部分取近似,不适用于负数和 0186 * @param {Number} num 原值187 * @param {Array} [rounds] 在取近似时,提供预置选项,近似到 rounds 中的某项188 * @return {Object} expNum 2 位精度的量级计数法对象,不小于原值189 */190function getCeil(num, rounds) {191 rounds = rounds || mySteps;192 num = expNum(num); // 2 位精度量级计数法193 var cNum = num.c;194 var i = 0;195 while (cNum > rounds[i]) { // 在预置的近似数中,找到不小于目标 cNum 的项196 i++;197 }198 if (!rounds[i]) { // 如果没找到合适的预置项,一定是目标值大于全部的预置项199 cNum /= 10; // 将目标值缩小 10 倍,重找一次定能命中200 num.e += 1;201 i = 0;202 while (cNum > rounds[i]) {203 i++;204 }205 }206 num.c = rounds[i];207 return num;208}209/**210 * 基于量级计数法的计算,必须 min < max211 */212function coreCalc(min, max, section) {213 var step;214 var secs = section || +custSecs.slice(-1);215 var expStep = getCeil((max - min) / secs, custSteps); // 这是可能的最小步长,以它的量级作为后续计算的基准量级,以保证整数计算特性216 var expSpan = expNum(max - min); // 2 位精度的最值跨度,过高的精度意味着有效数位更多217 var expMin = expNum(min, -1, 1); // 最小值向下近似,以涵盖原最小值218 var expMax = expNum(max, -1); // 最大值向上近似,参数 -1 表示保留全精度,因为要注意 min = 10000001, max = 10000002 等情况219 expFixTo(expSpan, expStep); // 指数对齐220 expFixTo(expMin, expStep, 1); // 经过指数对齐,原最大值、最小值都有可能变为 0221 expFixTo(expMax, expStep);222 if (!section) {223 secs = look4sections(expMin, expMax);224 }225 else {226 step = look4step(expMin, expMax, secs);227 }228 // 如果原最值都是整数,尽量让输出值也保持整数,但原最值跨 0 的则不调整229 if (MATH_ISINT(min) && MATH_ISINT(max) && min * max >= 0) {230 if (max - min < secs) { // 再次出现跨度小于段数231 return forInteger(min, max, secs);232 }233 secs = tryForInt(min, max, section, expMin, expMax, secs);234 }235 var arrMM = cross0(min, max, expMin.c, expMax.c);236 expMin.c = arrMM[0];237 expMax.c = arrMM[1];238 if (minLocked || maxLocked) {239 singleLocked(min, max, expMin, expMax);240 }241 return makeResult(expMin.c, expMax.c, secs, expMax.e);242}243/**244 * 在预置的可选段数中,找出一个合适的值,让跨度误差尽量小245 */246function look4sections(expMin, expMax) {247 var section;248 var tmpStep, tmpMin, tmpMax;249 var reference = [];250 for (var i = custSecs.length; i--;) { // 逐步减小段数,步长就会渐大251 section = custSecs[i];252 tmpStep = getCeil((expMax.c - expMin.c) / section, custSteps);253 tmpStep = tmpStep.c * MATH_POW(tmpStep.e); // 步长都用常规整数参与计算254 tmpMin = MATH_FLOOR(expMin.c / tmpStep) * tmpStep;255 tmpMax = MATH_CEIL(expMax.c / tmpStep) * tmpStep;256 reference[i] = {257 min: tmpMin,258 max: tmpMax,259 step: tmpStep,260 span: tmpMax - tmpMin // 步长的误差被 段数 成倍放大,可能会给跨度造成更大的误差,使最后的段数大于预置的最大值261 };262 }263 reference.sort(function (a, b) {264 var delta = a.span - b.span; // 分段调整之后的跨度,一定不小于原跨度,所以越小越好265 if (delta === 0) {266 delta = a.step - b.step; // 跨度相同时,步长小者胜出267 }268 return delta;269 });270 reference = reference[0];271 section = reference.span / reference.step;272 expMin.c = reference.min;273 expMax.c = reference.max;274 return section < 3 ? section * 2 : section; // 如果最终步长比最小步长大得多,段数就可能变得很小275}276/**277 * 指定段数,在预置的可选步长中,找出一个合适的值,让 步长 * 段数 积刚好涵盖原最大值与最小值278 */279function look4step(expMin, expMax, secs) {280 var span;281 var tmpMax;282 var tmpMin = expMax.c;283 var tmpStep = (expMax.c - expMin.c) / secs - 1;284 while (tmpMin > expMin.c) {285 tmpStep = getCeil(tmpStep + 1, custSteps);286 tmpStep = tmpStep.c * MATH_POW(tmpStep.e);287 span = tmpStep * secs;288 tmpMax = MATH_CEIL(expMax.c / tmpStep) * tmpStep;289 tmpMin = tmpMax - span; // 优先保证 max 端的误差最小,试看原 min 值能否被覆盖到290 }291 var deltaMin = expMin.c - tmpMin; // 上面的计算可能会让 min 端的误差更大,下面尝试均衡误差292 var deltaMax = tmpMax - expMax.c;293 var deltaDelta = deltaMin - deltaMax;294 if (deltaDelta > tmpStep * 1.1) { // 当 min 端的误差比 max 端大很多时,考虑将 tmpMin tmpMax 同时上移295 deltaDelta = MATH_ROUND(deltaDelta / tmpStep / 2) * tmpStep;296 tmpMin += deltaDelta;297 tmpMax += deltaDelta;298 }299 expMin.c = tmpMin;300 expMax.c = tmpMax;301 return tmpStep;302}303/**304 * 原最值都是整数时,尝试让输出也保持整数305 */306function tryForInt(min, max, section, expMin, expMax, secs) {307 var span = expMax.c - expMin.c;308 var step = span / secs * MATH_POW(expMax.e);309 if (!MATH_ISINT(step)) { // 原最值都是整数,但计算步长可能出现小数,如 2.5310 step = MATH_FLOOR(step); // 步长总是要尽量小,以减小跨度误差,所以 2.5 可能被调整为 2 或者 3311 span = step * secs;312 if (span < max - min) {313 step += 1;314 span = step * secs;315 if (!section && (step * (secs - 1) >= (max - min))) {316 secs -= 1;317 span = step * secs;318 }319 }320 if (span >= max - min) {321 var delta = span - (max - min); // 误差均衡322 expMin.c = MATH_ROUND(min - delta / 2);323 expMax.c = MATH_ROUND(max + delta / 2);324 expMin.e = 0;325 expMax.e = 0;326 }327 }328 return secs;329}330/**331 * 整数情况下,跨度小于段数的处理332 */333function forInteger(min, max, section) {334 section = section || 5;335 if (minLocked) {336 max = min + section; // min max 没有写错,因为 min locked 所以 max 在 min 上浮动337 }338 else if (maxLocked) {339 min = max - section;340 }341 else {342 var delta = section - (max - min); // 没有端点锁定时,向上下延展跨度343 var newMin = MATH_ROUND(min - delta / 2);344 var newMax = MATH_ROUND(max + delta / 2);345 var arrMM = cross0(min, max, newMin, newMax); // 避免跨 0346 min = arrMM[0];347 max = arrMM[1];348 }349 return makeResult(min, max, section);350}351/**352 * 非整数情况下,跨度为 0 的处理353 */354function forSpan0(min, max, section) {355 section = section || 5;356 // delta 一定不为 0 ,因为 min === max === 0 的情况会进入 forInteger 分支357 var delta = MT.min(MATH_ABS(max / section), section) / 2.1;358 if (minLocked) {359 max = min + delta; // min max 没有写错,因为 min locked 所以 max 在 min 上浮动360 }361 else if (maxLocked) {362 min = max - delta;363 }364 else { // 以最值为中心,上下各延展一小段365 min = min - delta;366 max = max + delta;367 }368 return coreCalc(min, max, section);369}370/**371 * 当原始最值都在 0 的同侧时,让输出也保持在 0 的同侧372 */373function cross0(min, max, newMin, newMax) {374 if (min >= 0 && newMin < 0) {375 newMax -= newMin;376 newMin = 0;377 }378 else if (max <= 0 && newMax > 0) {379 newMin -= newMax;380 newMax = 0;381 }382 return [newMin, newMax];383}384/**385 * 取一个数的小数位数386 * @param {Number} num 原数值387 * @return {Number} decimals 整数则返回 0 ,小数则返回小数点后的位数388 */389function decimals(num) {390 num = (+num).toFixed(15).split('.'); // String(0.0000001) 会得到 '1e-7'391 return num.pop().replace(/0+$/, '').length;392}393/**394 * 单个最值锁定处理,只是在原计算的基础上,锁定一个,平移另一个395 */396function singleLocked(min, max, emin, emax) {397 if (minLocked) {398 var expMin = expNum(min, 4, 1); // 4 位精度向下近似399 if (emin.e - expMin.e > 6) { // 如果锁定值的量级远小于基准量级,认为锁定失败,强置为 0400 expMin = {c: 0, e: emin.e};401 }402 expFixMin(emin, expMin); // 将指数与量级较小者对齐403 expFixMin(emax, expMin);404 emax.c += expMin.c - emin.c; // 最大值平移405 emin.c = expMin.c; // 最小值锁定406 }407 else if (maxLocked) {408 var expMax = expNum(max, 4); // 4 位精度向上近似409 if (emax.e - expMax.e > 6) { // 如果锁定值的量级远小于基准量级,认为锁定失败,强置为 0410 expMax = {c: 0, e: emax.e};411 }412 expFixMin(emin, expMax); // 将指数与量级较小者对齐413 expFixMin(emax, expMax);414 emin.c += expMax.c - emax.c; // 最小值平移415 emax.c = expMax.c; // 最大值锁定416 }417}418/**419 * 最小值和最大值同时被锁定的情况在这里,其它地方只考虑单边最值锁定420 * @param {Number} min 锁定的最小值421 * @param {Number} max 锁定的最大值422 * @param {Number} [section] 段数423 * @return {Object} 同 smartSteps424 */425function bothLocked(min, max, section) {426 var trySecs = section ? [section] : custSecs;427 var span = max - min;428 if (span === 0) { // 最大最小值都锁定到同一个值上,认为锁定失败429 max = expNum(max, 3); // 3 位精度向上近似430 section = trySecs[0];431 max.c = MATH_ROUND(max.c + section / 2);432 return makeResult(max.c - section, max.c, section, max.e);433 }434 if (MATH_ABS(max / span) < 1e-6) { // 如果锁定值远小于跨度,也认为锁定失败,强置为 0435 max = 0;436 }437 if (MATH_ABS(min / span) < 1e-6) {438 min = 0;439 }440 var step, deltaSpan, score;441 var scoreS = [[5, 10], [10, 2], [50, 10], [100, 2]];442 var reference = [];443 var debugLog = [];444 var expSpan = expNum((max - min), 3); // 3 位精度向上近似445 var expMin = expNum(min, -1, 1);446 var expMax = expNum(max, -1);447 expFixTo(expMin, expSpan, 1);448 expFixTo(expMax, expSpan);449 span = expMax.c - expMin.c;450 expSpan.c = span;451 452 for (var i = trySecs.length; i--;) {453 section = trySecs[i];454 step = MATH_CEIL(span / section);455 deltaSpan = step * section - span;456 score = (deltaSpan + 3) * 3; // 误差越大得分越高457 score += (section - trySecs[0] + 2) * 2; // 分段越多得分越高458 if (section % 5 === 0) { // 段数为 5 可以减分459 score -= 10;460 }461 for (var j = scoreS.length; j--;) { // 好的步长是最重要的减分项462 if (step % scoreS[j][0] === 0) {463 score /= scoreS[j][1];464 }465 }466 debugLog[i] = [section, step, deltaSpan, score].join();467 reference[i] = {468 secs: section,469 step: step,470 delta: deltaSpan,471 score: score472 };473 }474 //console.log(debugLog);475 reference.sort(function (a, b) {return a.score - b.score;});476 reference = reference[0];477 expMin.c = MATH_ROUND(expMin.c - reference.delta / 2);478 expMax.c = MATH_ROUND(expMax.c + reference.delta / 2);479 return makeResult(expMin.c, expMax.c, reference.secs, expSpan.e);480}481return smartSteps;...

Full Screen

Full Screen

Constants.py

Source:Constants.py Github

copy

Full Screen

1MAX_NAMELEN = 16 # 设备登录用户名长度2MAX_RIGHT = 32 # 设备支持的权限(1~12表示本地权限,13~32表示远程权限)3NAME_LEN = 32 # 用户名长度4PASSWD_LEN = 16 # 密码长度5SERIALNO_LEN = 48 # 序列号长度6MACADDR_LEN = 6 # MAC地址长度7MAX_ETHERNET = 2 # 设备可配以太网络8MAX_NETWORK_CARD = 4 # 设备可配最大网卡数目9MAX_BOND_NUM = 2 # 设备可配BONDING网卡数10PATHNAME_LEN = 128 # 路径长度11MAX_TIMESEGMENT_V30 = 8 # V3.0以上版本支持的设备的最大时间段数12MAX_TIMESEGMENT = 4 # V3.0以下版本支持的设备的最大时间段数13MAX_SHELTERNUM = 4 # V3.0以下版本支持的设备的最大遮挡区域数14MAX_DAYS = 7 # 每周的天数15PHONENUMBER_LEN = 32 # PPPoE拨号号码最大长度16MAX_DISK_NUM = 128 # 设备支持的最大硬盘数(扩展)17MAX_DISKNUM_V30 = 33 # V3.0以上版本支持的设备的最大硬盘数,最多33个硬盘(包括16个内置SATA硬盘、1个eSATA硬盘和16个NFS盘)18MAX_DISKNUM = 16 # V3.0以下版本支持的设备的最大硬盘数19MAX_DISKNUM_V10 = 8 # 1.2版本之前版本20MAX_WINDOW_V40 = 64 # 设备最大支持的本地显示播放窗口数(扩展)21MAX_WINDOW_V30 = 32 # V3.0以上版本支持的设备的本地显示最大播放窗口数22MAX_WINDOW = 16 # V3.0以下版本支持的设备的本地显示最大播放窗口数23MAX_VGA_V30 = 4 # V3.0以上版本支持的设备的最大可接VGA数24MAX_VGA = 1 # V3.0以下版本支持的设备的最大可接VGA数25MAX_USERNUM_V30 = 32 # V3.0以上版本支持的设备的最大用户数26MAX_USERNUM = 16 # V3.0以下版本支持的设备的最大用户数27MAX_EXCEPTIONNUM_V30 = 32 # V3.0以上版本支持的设备的最大异常处理数28MAX_EXCEPTIONNUM = 16 # V3.0以下版本支持的设备的最大异常处理数29MAX_LINK = 6 # V3.0以下版本支持的设备的单通道最大视频流连接数30MAX_LINK_V30 = 128 # V3.0以上版本支持的设备的单通道最大视频流连接数31MAX_DECPOOLNUM = 4 # 单路解码器每个解码通道最大可循环解码数32MAX_DECNUM = 4 # 单路解码器的最大解码通道数(实际只有一个,其他三个保留)33MAX_TRANSPARENTNUM = 2 # 单路解码器可配置最大透明通道数34MAX_CYCLE_CHAN = 16 # 单路解码器最大轮巡通道数35MAX_CYCLE_CHAN_V30 = 64 # 最大轮巡通道数(扩展)36MAX_DIRNAME_LENGTH = 80 # 最大目录长度37MAX_CUSTOM_DIR = 64 # 自定义目录最大长度38MAX_WINDOWS = 16 # 最大窗口数39MAX_WINDOWS_V41 = 16 # 最大窗口数(v4.1版本SDK)40MAX_STRINGNUM_V30 = 8 # V3.0以上版本支持的设备的最大OSD字符行数41MAX_STRINGNUM = 4 # V3.0以下版本支持的设备的最大OSD字符行数42MAX_AUXOUT = 4 # V3.0以下版本支持的设备的最大辅助输出数43MAX_HD_GROUP = 16 # V3.0以上版本支持的设备的最大硬盘组数44MAX_NFS_DISK = 8 # V3.0以下版本支持的设备的最大NFS硬盘数45IW_ESSID_MAX_SIZE = 32 # WIFI的SSID号长度46IW_ENCODING_TOKEN_MAX = 32 # WIFI密钥最大字节数47MAX_SERIAL_NUM = 64 # 最多支持的透明通道路数48MAX_DDNS_NUMS = 10 # V3.0以上版本支持的设备最大可配DDNS数49MAX_DOMAIN_NAME = 64 # 最大域名长度50MAXPROGRESS = 100 # 回放时的最大百分率51MAX_SERIALNUM = 2 # 设备支持的串口数:1-232,2-48552CARDNUM_LEN = 20 # 卡号长度53MAX_VIDEOOUT_V30 = 4 # V3.0以上版本支持的设备的视频输出数54MAX_VIDEOOUT = 2 # V3.0以下版本支持的设备的视频输出数55MAX_EMAIL_ADDR_LEN = 48 # 最大EMAIL地址长度56MAX_EMAIL_PWD_LEN = 32 # 最大EMAIL密码长度57MAX_PRESET_V30 = 256 # V3.0以上版本支持的设备支持的云台预置点数58MAX_TRACK_V30 = 256 # V3.0以上版本支持的设备支持的云台轨迹数59MAX_CRUISE_V30 = 256 # V3.0以上版本支持的设备支持的云台巡航数60MAX_PRESET = 128 # V3.0以下版本支持的设备支持的云台预置点数61MAX_TRACK = 128 # V3.0以下版本支持的设备支持的云台轨迹数62MAX_CRUISE = 128 # V3.0以下版本支持的设备支持的云台巡航数63CRUISE_MAX_PRESET_NUMS = 32 # 一条巡航最多的巡航点64MAX_PTZCRUISE_POINT_NUM = 32 # 最大支持巡航点个数65MAX_SERIAL_PORT = 8 # V3.0以上版本支持的设备支持232串口数66MAX_PREVIEW_MODE = 8 # 设备支持最大预览模式数目67MAX_MATRIXOUT = 16 # 最大模拟矩阵输出个数68LOG_INFO_LEN = 11840 # 日志附加信息长度69DESC_LEN = 16 # 云台描述字符串长度70DESC_LEN_64 = 64 # 描述字符串长度71PTZ_PROTOCOL_NUM = 200 # V3.0以上版本支持的设备最大支持的云台协议数72MAX_AUDIO = 1 # V3.0以下版本支持的设备的语音对讲通道数73MAX_AUDIO_V30 = 2 # V3.0以上版本支持的设备的语音对讲通道数74MAX_CHANNUM = 16 # V3.0以下版本支持的设备的最大通道数75MAX_ALARMIN = 16 # V3.0以下版本支持的设备的最大报警输入数76MAX_ALARMOUT = 4 # V3.0以下版本支持的设备的最大报警输出数77MAX_ANALOG_CHANNUM = 32 # 最大32个模拟通道78MAX_ANALOG_ALARMOUT = 32 # 最大32路模拟报警输出79MAX_ANALOG_ALARMIN = 32 # 最大32路模拟报警输入80MAX_IP_DEVICE = 32 # 允许接入的最大IP设备数81MAX_IP_DEVICE_V40 = 64 # 允许接入的最大IP设备数82MAX_IP_CHANNEL = 32 # 允许加入的最多IP通道数83MAX_IP_ALARMIN = 128 # 允许加入的最多报警输入数84MAX_IP_ALARMOUT = 64 # 允许加入的最多报警输出数85MAX_IP_ALARMOUT_V40 = 4096 # 允许加入的最多报警输出数(扩展)86MAX_CHANNUM_V30 = 64 # (MAX_ANALOG_CHANNUM87MAX_CHANNUM_V40 = 512 # 最大通道个数88MAX_ALARMOUT_V30 = 96 # (MAX_ANALOG_ALARMOUT89MAX_ALARMOUT_V40 = 4128 # (MAX_IP_ALARMOUT_V4090MAX_ALARMIN_V30 = 160 # (MAX_ANALOG_ALARMIN91MAX_MULTI_AREA_NUM = 24 # 最大移动侦测区域个数92MAX_RULE_NUM = 8 # 最大规则条数93MAX_RULE_NUM_4 = 4 # 最大规则数94MAX_TIMESEGMENT_2 = 2 # 最大时间段数95VCA_MAX_POLYGON_POINT_NUM = 10 # 检测区域最多支持10个点的多边形96MAX_TARGET_NUM = 30 # 最大目标个数97MAX_VCA_CHAN = 16 # 最大智能通道数98IW_ESSID_MAX_SIZE = 32 # SSID的长度99WIFI_WEP_MAX_KEY_COUNT = 4 # 最大密钥个数100WIFI_WEP_MAX_KEY_LENGTH = 33 # 最大密钥长度101WIFI_WPA_PSK_MAX_KEY_LENGTH = 63 # 加密字符的最大长度102WIFI_WPA_PSK_MIN_KEY_LENGTH = 8 # 加密字符的最小长度103WIFI_MAX_AP_COUNT = 20 # 无线AP的最大个数104NET_DVR_MAX_DISPREGION = 16 # 每个显示通道最多可以显示的窗口105MAX_DECODECHANNUM = 32 # 多路解码器最大解码通道数106MAX_DISPCHANNUM = 24 # 多路解码器最大显示通道数107MAX_NET_DISK = 16 # 最大网络硬盘数108MAX_ATM_PROTOCOL_NUM = 256 # ATM最大协议数109ATM_PROTOCOL_SORT = 4 # ATM协议段数110ATM_DESC_LEN = 32 # ATM描述字符串长度111MAX_ACTION_TYPE = 12 # ATM自定义协议叠加交易行为最大行为个数112SEARCH_EVENT_INFO_LEN = 300 # 事件信息长度113MAX_MASK_REGION_NUM = 4 # 最大屏蔽区域个数114MAX_CALIB_PT = 6 # 最大标定点个数115MAX_RECT_NUM = 6 # 最大矩形框个数116MAX_RESOLUTIONNUM = 64 # 支持的最大分辨率数目117MAX_LOOPPLANNUM = 16 # 最大计划切换组数118DECODE_TIMESEGMENT = 4 # 计划解码每天时间段数119MAX_RECORD_FILE_NUM = 20 # 一次操作文件(120DESC_LEN_32 = 32 # 描述字长度121MAX_NODE_NUM = 256 # 节点个数122MAX_ABILITYTYPE_NUM = 12 # 最大能力项123IPC_PROTOCOL_NUM = 50 # IPC协议最大个数124MAX_SADP_NUM = 256 # 搜索到设备最大数目125SOFTWARE_VERSION_LEN = 48 # 软件版本号长度126MAX_REDAREA_NUM = 6 # 最大红绿灯区域个数127MAX_LANERECT_NUM = 5 # 最大车牌识别区域数128MAX_LICENSE_LEN = 16 # 车牌号最大长度129MAX_FORTIFY_NUM = 10 # 最大布防个数130MAX_INTERVAL_NUM = 4 # 最大时间间隔个数131MAX_CHJC_NUM = 3 # 最大车辆省份简称字符个数132MAX_VL_NUM = 5 # 最大虚拟线圈个数133MAX_DRIVECHAN_NUM = 16 # 最大车道数134MAX_COIL_NUM = 3 # 最大线圈个数135MAX_IOSPEED_GROUP_NUM = 4 # IO测速组个数136MAX_IOOUT_NUM = 4 # 最大IO输出口个数137MAX_IOIN_NUM = 8 # 最大IO输入口个数138MAX_IOIN_NUMEX = 10 # 最大IO输入口个数(扩展)139MAX_ITC_LANE_NUM = 6 # 最大车道个数140MAX_LIGHT_NUM = 6 # 最大交通灯数141MAX_VIDEO_DETECT_LIGHT_NUM = 12 # 最大视频检测信号灯个数142MAX_VIDEO_INTERVAL_NUM = 2 # 最大抓拍间隔数143PICNAME_MAXITEM = 2 # 图片命令最多元素个数144MAX_LANEAREA_NUM = 2 # 单车道最大区域个数145MAX_ICR_NUM = 8 # 抓拍机红外滤光片预置点数146MAX_PARKNO_LEN = 16 # 车位编号长度147MAX_CUSTOMDIR_LEN = 32 # 自定义目录长度148MAX_ITC_EXCEPTIONOUT = 32 # 抓拍机最大报警输出个数149MAX_ITS_SCENE_NUM = 16 # 最大场景数量150MAX_SCENE_TIMESEG_NUM = 16 # 最大场景时间段数量151DEVICE_ID_LEN = 48 # 设备编号长度152MONITORSITE_ID_LEN = 48 # 监测点编号长度153MAX_SCH_TASKS_NUM = 10 # 定时任务最大个数154ITC_MAX_POLYGON_POINT_NUM = 20 # 检测区域最多支持20个点的多边形155MAX_ITC_SERIALCHECK_NUM = 8 # 串口校验类型个数156MAX_LINE_SEG_NUM = 8 # 最大样本线个数157MAX_SAMPLE_NUM = 5 # 最大样本个数158MAX_SAMPLE_NUM_EX = 7 # 样本标定个数扩展159MAX_SIGNALLIGHT_NUM = 6 # 最大信号灯个数160SUPPORT_PD_NUM = 16 # 最大支持的物理磁盘个数161SUPPORT_ARRAY_NUM = 8 # 最大支持的阵列个数162SUPPORT_VD_NUM = 128 # 最大支持的虚拟磁盘个数163LABEL_NAME_LEN = 40 # 录像标签名称的长度164LABEL_IDENTIFY_LEN = 64 # 标签标识的长度165MAX_DEL_LABEL_IDENTIFY = 20 # 删除的最大标签标识个数166MAX_PIC_EVENT_NUM = 32 # 事件抓图的事件类型个数167MAX_ALARMIN_CAPTURE = 16 # 事件抓图报警输入个数168CARDNUM_LEN_V30 = 40 # 卡号的长度169PICTURE_NAME_LEN = 64 # 图片名称的长度170MAX_RECORD_PICTURE_NUM = 50 # 最大备份图片张数171CALIB_PT_NUM = 4 # 智能交通事件标定个数172MAX_REGION_NUM = 8 # 区域列表最大数目173MAX_LANE_NUM = 8 # 最大车道数目174MAX_AID_RULE = 8 # 最大事件规则数目175MAX_TPS_RULE = 8 # 最大参数规则数目176INQUEST_MESSAGE_LEN = 44 # 审讯重点标记信息长度177INQUEST_MAX_ROOM_NUM = 2 # 最大审讯室个数178MAX_RESUME_SEGMENT = 2 # 支持同时恢复的片段数目179MAX_ALARMHOST_SUBSYSTEM = 32 # 网络报警主机子系统个数180MAX_ALARMHOST_ALARMIN_NUM = 512 # 网络报警主机最大报警输入口数181MAX_ALARMHOST_ALARMOUT_NUM = 512 # 网络报警主机最大报警输出口数182ALARMHOST_MAX_AUDIOOUT_NUM = 32 # 网络报警主机最大语音输出数183ALARMHOST_MAX_ELECTROLOCK_NUM = 32 # 网络报警主机最大电锁数184ALARMHOST_MAX_MOBILEGATE_NUM = 32 # 网络报警主机最大移动门数185ALARMHOST_MAX_SIREN_NUM = 8 # 网络报警主机最大警号数目186MAX_DEVICE_PROTO_NUM = 256 # 网络报警主机协议类型个数187MAX_DEVICE_TYPE_NUM = 256 # 网络报警主机设备类型个数188MAX_CENTERNUM = 4 # 网络报警主机支持的最大中心个数189MAX_PHONE_NUM = 32 # 拨号号码长度190MAX_CONTENT_LEN = 512 # LED屏显内容最大长度191LED_TIMER_NUM = 3 # LED开关机时间组数192TIME_SEGMENT_A_DAY = 48 # 时间段个数,一天24小时,半小时一个段193MAX_SUPPORT_RES = 32 # 最多支持的分辨率类型个数194MAX_DISPNUM_V41 = 32 # 最大显示通道个数195MAX_BIGSCREENNUM = 100 # 最多大屏拼接子屏数196MAX_WIN_COUNT = 224 # 大屏支持最大的开窗个数197MAX_WINDOWSMODE = 12 # 最多支持的画面分割类型个数198MAX_HUMAN_BIRTHDATE_LEN = 10 # 最大出生年月长度199MAX_HUMAN_PICTURE_NUM = 10 # 最大图片数200MAX_FACE_PIC_LEN = 6144 # 最大人脸图片数据长度201MAX_OSDCHAR_NUM = 256 # 虚拟LED字符数202STREAM_ID_LEN = 32 # 流ID标识长度203MAX_AUX_ALARM_NUM = 8 # 最大辅助报警个数204MAX_WIRELESS_ALARM_NUM = 8 # 最大无线报警个数205MAX_PRO_PATH = 256 # 最大协议路径长度206DEVICEID_LEN = 32 # 设备ID号长度207DVCS_DEVICEID_LEN = 16 # 设备ID标识符长度208MAX_ROIDETECT_NUM = 8 # ROI检测区域个数209MAX_CABINET_COUNT = 8 # 最大机柜个数210ITS_MAX_DEVICE_NUM = 32 # 最大设备个数211MAX_ALERTLINE_NUM = 8 # 最大警戒线条数212MAX_INTRUSIONREGION_NUM = 8 # 最大区域个数213MAX_PARKING_NUM = 4 # 一个通道最大车位个数214MAX_PARKING_STATUS = 8 # 车位状态个数215MAX_ID_LEN = 48 # 编号最大长度216MAX_ALARMREASON_LEN = 32 # 报警类型描述最大长度217MAX_SERVERID_LEN = 64 # 最大服务器ID的长度218MAX_SERVERDOMAIN_LEN = 128 # 服务器域名最大长度219MAX_AUTHENTICATEID_LEN = 64 # 认证ID最大长度220MAX_AUTHENTICATEPASSWD_LEN = 32 # 认证密码最大长度221MAX_SERVERNAME_LEN = 64 # 最大服务器用户名222MAX_COMPRESSIONID_LEN = 64 # 编码ID的最大长度223MAX_SIPSERVER_ADDRESS_LEN = 128 # SIP服务器地址支持域名和IP地址224MATRIX_MAX_OUTPUT_NUM = 256 # 矩阵最大输出通道个数225CLOUD_NAME_LEN = 48 # 云存储服务器用户名长度226CLOUD_PASSWD_LEN = 48 # 云存储服务器密码长度227MAX_URL_LEN = 240 # URL最大长度228MAX_OPERATE_INDEX_LEN = 32 # 操作数最大长度229MAX_FACE_PIC_NUM = 30 # 人脸子图最大个数230CHAN_NO_LEN = 24 # 通道编号最大长度231# ************** 回调函数类型 begin ***************/232COMM_ALARM = 0x1100233COMM_TRADEINFO = 0x1500234COMM_ALARM_V30 = 0x4000235COMM_ALARM_V40 = 0x4007236COMM_ALARM_RULE = 0x1102237COMM_ALARM_PDC = 0x1103238COMM_UPLOAD_PLATE_RESULT = 0x2800239COMM_ITS_PLATE_RESULT = 0x3050240COMM_IPCCFG = 0x4001241COMM_ITS_PARK_VEHICLE = 0x3056242COMM_ALARM_TFS = 0x1113243COMM_ALARM_TPS_V41 = 0x1114244COMM_ALARM_AID_V41 = 0x1115245COMM_UPLOAD_FACESNAP_RESULT = 0x1112246COMM_SNAP_MATCH_ALARM = 0x2902247COMM_ALARM_ACS = 0x5002248COMM_ID_INFO_ALARM = 0x5200249COMM_VCA_ALARM = 0x4993250COMM_PASSNUM_INFO_ALARM = 0x5201251COMM_ISAPI_ALARM = 0x6009252COMM_ALARM_TPS_STATISTICS = 0x3082253ACS_CARD_NO_LEN = 32 # 门禁卡号长度254MAX_GROUP_NUM_128 = 128 # 最大群组数255MAX_DOOR_NUM_256 = 256 # 最大门数256CARD_PASSWORD_LEN = 8 # 卡密码长度257MAX_CARD_READER_NUM = 64 # 最大读卡器数258MAX_DOOR_CODE_LEN = 8 # 房间代码长度259MAX_LOCK_CODE_LEN = 8 # 锁代码长度260MAX_CARD_RIGHT_PLAN_NUM = 4 # 卡权限最大计划个数261MAX_ID_NUM_LEN = 32 # 最大身份证号长度262MAX_ID_NAME_LEN = 128 # 最大姓名长度263MAX_ID_ADDR_LEN = 280 # 最大住址长度264MAX_ID_ISSUING_AUTHORITY_LEN = 128 # 最大签发机关长度265MAX_CARD_READER_NUM_512 = 512 # 最大读卡器数266ERROR_MSG_LEN = 32 # 下发错误信息267MAX_FACE_NUM = 2 # 最大人脸数268MAX_FINGER_PRINT_LEN = 768 # 最大指纹长度269# ****************优化接口结构体定义开始*************270NET_DVR_GET_CARD = 2560271NET_DVR_SET_CARD = 2561272NET_DVR_SET_FACE = 2567273NET_DVR_DEL_CARD = 2562274NET_SDK_CONFIG_STATUS_SUCCESS = 1000275NET_SDK_CONFIG_STATUS_NEEDWAIT = 1001276NET_SDK_CONFIG_STATUS_FINISH = 1002277NET_SDK_CONFIG_STATUS_FAILED = 1003278NET_SDK_CONFIG_STATUS_EXCEPTION = 1004279# ****************优化接口结构体定义结束*************280NET_SDK_GET_NEXT_STATUS_SUCCESS = 1000 # 成功读取到数据,处理完本次数据后需要再次调用NET_DVR_GetNextRemoteConfig获取下一条数据281NET_SDK_GET_NETX_STATUS_NEED_WAIT = 1001 # 需等待设备发送数据,继续调用NET_DVR_GetNextRemoteConfig282NET_SDK_GET_NEXT_STATUS_FINISH = 1002 # 数据全部取完,可调用NET_DVR_StopRemoteConfig结束长连接...

Full Screen

Full Screen

IN.py

Source:IN.py Github

copy

Full Screen

1# Generated by h2py from /usr/include/netinet/in.h2_NETINET_IN_H = 13# Included from features.h4_FEATURES_H = 15__USE_ANSI = 16__FAVOR_BSD = 17_ISOC99_SOURCE = 18_POSIX_SOURCE = 19_POSIX_C_SOURCE = 19950610_XOPEN_SOURCE = 60011_XOPEN_SOURCE_EXTENDED = 112_LARGEFILE64_SOURCE = 113_BSD_SOURCE = 114_SVID_SOURCE = 115_BSD_SOURCE = 116_SVID_SOURCE = 117__USE_ISOC99 = 118_POSIX_SOURCE = 119_POSIX_C_SOURCE = 220_POSIX_C_SOURCE = 19950621__USE_POSIX = 122__USE_POSIX2 = 123__USE_POSIX199309 = 124__USE_POSIX199506 = 125__USE_XOPEN = 126__USE_XOPEN_EXTENDED = 127__USE_UNIX98 = 128_LARGEFILE_SOURCE = 129__USE_XOPEN2K = 130__USE_ISOC99 = 131__USE_XOPEN_EXTENDED = 132__USE_LARGEFILE = 133__USE_LARGEFILE64 = 134__USE_FILE_OFFSET64 = 135__USE_MISC = 136__USE_BSD = 137__USE_SVID = 138__USE_GNU = 139__USE_REENTRANT = 140__STDC_IEC_559__ = 141__STDC_IEC_559_COMPLEX__ = 142__STDC_ISO_10646__ = 20000943__GNU_LIBRARY__ = 644__GLIBC__ = 245__GLIBC_MINOR__ = 246# Included from sys/cdefs.h47_SYS_CDEFS_H = 148def __PMT(args): return args49def __P(args): return args50def __PMT(args): return args51def __STRING(x): return #x52__flexarr = []53__flexarr = [0]54__flexarr = []55__flexarr = [1]56def __ASMNAME(cname): return __ASMNAME2 (__USER_LABEL_PREFIX__, cname)57def __attribute__(xyz): return58def __attribute_format_arg__(x): return __attribute__ ((__format_arg__ (x)))59def __attribute_format_arg__(x): return60__USE_LARGEFILE = 161__USE_LARGEFILE64 = 162__USE_EXTERN_INLINES = 163# Included from gnu/stubs.h64# Included from stdint.h65_STDINT_H = 166# Included from bits/wchar.h67_BITS_WCHAR_H = 168__WCHAR_MIN = (-2147483647 - 1)69__WCHAR_MAX = (2147483647)70# Included from bits/wordsize.h71__WORDSIZE = 3272def __INT64_C(c): return c ## L73def __UINT64_C(c): return c ## UL74def __INT64_C(c): return c ## LL75def __UINT64_C(c): return c ## ULL76INT8_MIN = (-128)77INT16_MIN = (-32767-1)78INT32_MIN = (-2147483647-1)79INT64_MIN = (-__INT64_C(9223372036854775807)-1)80INT8_MAX = (127)81INT16_MAX = (32767)82INT32_MAX = (2147483647)83INT64_MAX = (__INT64_C(9223372036854775807))84UINT8_MAX = (255)85UINT16_MAX = (65535)86UINT64_MAX = (__UINT64_C(18446744073709551615))87INT_LEAST8_MIN = (-128)88INT_LEAST16_MIN = (-32767-1)89INT_LEAST32_MIN = (-2147483647-1)90INT_LEAST64_MIN = (-__INT64_C(9223372036854775807)-1)91INT_LEAST8_MAX = (127)92INT_LEAST16_MAX = (32767)93INT_LEAST32_MAX = (2147483647)94INT_LEAST64_MAX = (__INT64_C(9223372036854775807))95UINT_LEAST8_MAX = (255)96UINT_LEAST16_MAX = (65535)97UINT_LEAST64_MAX = (__UINT64_C(18446744073709551615))98INT_FAST8_MIN = (-128)99INT_FAST16_MIN = (-9223372036854775807-1)100INT_FAST32_MIN = (-9223372036854775807-1)101INT_FAST16_MIN = (-2147483647-1)102INT_FAST32_MIN = (-2147483647-1)103INT_FAST64_MIN = (-__INT64_C(9223372036854775807)-1)104INT_FAST8_MAX = (127)105INT_FAST16_MAX = (9223372036854775807)106INT_FAST32_MAX = (9223372036854775807)107INT_FAST16_MAX = (2147483647)108INT_FAST32_MAX = (2147483647)109INT_FAST64_MAX = (__INT64_C(9223372036854775807))110UINT_FAST8_MAX = (255)111UINT_FAST64_MAX = (__UINT64_C(18446744073709551615))112INTPTR_MIN = (-9223372036854775807-1)113INTPTR_MAX = (9223372036854775807)114INTPTR_MIN = (-2147483647-1)115INTPTR_MAX = (2147483647)116INTMAX_MIN = (-__INT64_C(9223372036854775807)-1)117INTMAX_MAX = (__INT64_C(9223372036854775807))118UINTMAX_MAX = (__UINT64_C(18446744073709551615))119PTRDIFF_MIN = (-9223372036854775807-1)120PTRDIFF_MAX = (9223372036854775807)121PTRDIFF_MIN = (-2147483647-1)122PTRDIFF_MAX = (2147483647)123SIG_ATOMIC_MIN = (-2147483647-1)124SIG_ATOMIC_MAX = (2147483647)125WCHAR_MIN = __WCHAR_MIN126WCHAR_MAX = __WCHAR_MAX127def INT8_C(c): return c128def INT16_C(c): return c129def INT32_C(c): return c130def INT64_C(c): return c ## L131def INT64_C(c): return c ## LL132def UINT8_C(c): return c ## U133def UINT16_C(c): return c ## U134def UINT32_C(c): return c ## U135def UINT64_C(c): return c ## UL136def UINT64_C(c): return c ## ULL137def INTMAX_C(c): return c ## L138def UINTMAX_C(c): return c ## UL139def INTMAX_C(c): return c ## LL140def UINTMAX_C(c): return c ## ULL141# Included from bits/types.h142_BITS_TYPES_H = 1143__FD_SETSIZE = 1024144# Included from bits/pthreadtypes.h145_BITS_PTHREADTYPES_H = 1146# Included from bits/sched.h147SCHED_OTHER = 0148SCHED_FIFO = 1149SCHED_RR = 2150CSIGNAL = 0x000000ff151CLONE_VM = 0x00000100152CLONE_FS = 0x00000200153CLONE_FILES = 0x00000400154CLONE_SIGHAND = 0x00000800155CLONE_PID = 0x00001000156CLONE_PTRACE = 0x00002000157CLONE_VFORK = 0x00004000158__defined_schedparam = 1159def IN_CLASSA(a): return ((((in_addr_t)(a)) & (-2147483648)) == 0)160IN_CLASSA_NET = (-16777216)161IN_CLASSA_NSHIFT = 24162IN_CLASSA_HOST = ((-1) & ~IN_CLASSA_NET)163IN_CLASSA_MAX = 128164def IN_CLASSB(a): return ((((in_addr_t)(a)) & (-1073741824)) == (-2147483648))165IN_CLASSB_NET = (-65536)166IN_CLASSB_NSHIFT = 16167IN_CLASSB_HOST = ((-1) & ~IN_CLASSB_NET)168IN_CLASSB_MAX = 65536169def IN_CLASSC(a): return ((((in_addr_t)(a)) & (-536870912)) == (-1073741824))170IN_CLASSC_NET = (-256)171IN_CLASSC_NSHIFT = 8172IN_CLASSC_HOST = ((-1) & ~IN_CLASSC_NET)173def IN_CLASSD(a): return ((((in_addr_t)(a)) & (-268435456)) == (-536870912))174def IN_MULTICAST(a): return IN_CLASSD(a)175def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & (-536870912)) == (-536870912))176def IN_BADCLASS(a): return ((((in_addr_t)(a)) & (-268435456)) == (-268435456))177IN_LOOPBACKNET = 127178INET_ADDRSTRLEN = 16179INET6_ADDRSTRLEN = 46180# Included from bits/socket.h181# Included from limits.h182_LIBC_LIMITS_H_ = 1183MB_LEN_MAX = 16184_LIMITS_H = 1185CHAR_BIT = 8186SCHAR_MIN = (-128)187SCHAR_MAX = 127188UCHAR_MAX = 255189CHAR_MIN = 0190CHAR_MAX = UCHAR_MAX191CHAR_MIN = SCHAR_MIN192CHAR_MAX = SCHAR_MAX193SHRT_MIN = (-32768)194SHRT_MAX = 32767195USHRT_MAX = 65535196INT_MAX = 2147483647197LONG_MAX = 9223372036854775807198LONG_MAX = 2147483647199LONG_MIN = (-LONG_MAX - 1)200# Included from bits/posix1_lim.h201_BITS_POSIX1_LIM_H = 1202_POSIX_AIO_LISTIO_MAX = 2203_POSIX_AIO_MAX = 1204_POSIX_ARG_MAX = 4096205_POSIX_CHILD_MAX = 6206_POSIX_DELAYTIMER_MAX = 32207_POSIX_LINK_MAX = 8208_POSIX_MAX_CANON = 255209_POSIX_MAX_INPUT = 255210_POSIX_MQ_OPEN_MAX = 8211_POSIX_MQ_PRIO_MAX = 32212_POSIX_NGROUPS_MAX = 0213_POSIX_OPEN_MAX = 16214_POSIX_FD_SETSIZE = _POSIX_OPEN_MAX215_POSIX_NAME_MAX = 14216_POSIX_PATH_MAX = 256217_POSIX_PIPE_BUF = 512218_POSIX_RTSIG_MAX = 8219_POSIX_SEM_NSEMS_MAX = 256220_POSIX_SEM_VALUE_MAX = 32767221_POSIX_SIGQUEUE_MAX = 32222_POSIX_SSIZE_MAX = 32767223_POSIX_STREAM_MAX = 8224_POSIX_TZNAME_MAX = 6225_POSIX_QLIMIT = 1226_POSIX_HIWAT = _POSIX_PIPE_BUF227_POSIX_UIO_MAXIOV = 16228_POSIX_TTY_NAME_MAX = 9229_POSIX_TIMER_MAX = 32230_POSIX_LOGIN_NAME_MAX = 9231_POSIX_CLOCKRES_MIN = 20000000232# Included from bits/local_lim.h233# Included from linux/limits.h234NR_OPEN = 1024235NGROUPS_MAX = 32236ARG_MAX = 131072237CHILD_MAX = 999238OPEN_MAX = 256239LINK_MAX = 127240MAX_CANON = 255241MAX_INPUT = 255242NAME_MAX = 255243PATH_MAX = 4096244PIPE_BUF = 4096245RTSIG_MAX = 32246_POSIX_THREAD_KEYS_MAX = 128247PTHREAD_KEYS_MAX = 1024248_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4249PTHREAD_DESTRUCTOR_ITERATIONS = _POSIX_THREAD_DESTRUCTOR_ITERATIONS250_POSIX_THREAD_THREADS_MAX = 64251PTHREAD_THREADS_MAX = 1024252AIO_PRIO_DELTA_MAX = 20253PTHREAD_STACK_MIN = 16384254TIMER_MAX = 256255SSIZE_MAX = LONG_MAX256NGROUPS_MAX = _POSIX_NGROUPS_MAX257# Included from bits/posix2_lim.h258_BITS_POSIX2_LIM_H = 1259_POSIX2_BC_BASE_MAX = 99260_POSIX2_BC_DIM_MAX = 2048261_POSIX2_BC_SCALE_MAX = 99262_POSIX2_BC_STRING_MAX = 1000263_POSIX2_COLL_WEIGHTS_MAX = 2264_POSIX2_EXPR_NEST_MAX = 32265_POSIX2_LINE_MAX = 2048266_POSIX2_RE_DUP_MAX = 255267_POSIX2_CHARCLASS_NAME_MAX = 14268BC_BASE_MAX = _POSIX2_BC_BASE_MAX269BC_DIM_MAX = _POSIX2_BC_DIM_MAX270BC_SCALE_MAX = _POSIX2_BC_SCALE_MAX271BC_STRING_MAX = _POSIX2_BC_STRING_MAX272COLL_WEIGHTS_MAX = 255273EXPR_NEST_MAX = _POSIX2_EXPR_NEST_MAX274LINE_MAX = _POSIX2_LINE_MAX275CHARCLASS_NAME_MAX = 2048276RE_DUP_MAX = (0x7fff)277# Included from bits/xopen_lim.h278_XOPEN_LIM_H = 1279# Included from bits/stdio_lim.h280L_tmpnam = 20281TMP_MAX = 238328282FILENAME_MAX = 4096283L_ctermid = 9284L_cuserid = 9285FOPEN_MAX = 16286IOV_MAX = 1024287_XOPEN_IOV_MAX = _POSIX_UIO_MAXIOV288NL_ARGMAX = _POSIX_ARG_MAX289NL_LANGMAX = _POSIX2_LINE_MAX290NL_MSGMAX = INT_MAX291NL_NMAX = INT_MAX292NL_SETMAX = INT_MAX293NL_TEXTMAX = INT_MAX294NZERO = 20295WORD_BIT = 16296WORD_BIT = 32297WORD_BIT = 64298WORD_BIT = 16299WORD_BIT = 32300WORD_BIT = 64301WORD_BIT = 32302LONG_BIT = 32303LONG_BIT = 64304LONG_BIT = 32305LONG_BIT = 64306LONG_BIT = 64307LONG_BIT = 32308from TYPES import *309PF_UNSPEC = 0310PF_LOCAL = 1311PF_UNIX = PF_LOCAL312PF_FILE = PF_LOCAL313PF_INET = 2314PF_AX25 = 3315PF_IPX = 4316PF_APPLETALK = 5317PF_NETROM = 6318PF_BRIDGE = 7319PF_ATMPVC = 8320PF_X25 = 9321PF_INET6 = 10322PF_ROSE = 11323PF_DECnet = 12324PF_NETBEUI = 13325PF_SECURITY = 14326PF_KEY = 15327PF_NETLINK = 16328PF_ROUTE = PF_NETLINK329PF_PACKET = 17330PF_ASH = 18331PF_ECONET = 19332PF_ATMSVC = 20333PF_SNA = 22334PF_IRDA = 23335PF_PPPOX = 24336PF_WANPIPE = 25337PF_BLUETOOTH = 31338PF_MAX = 32339AF_UNSPEC = PF_UNSPEC340AF_LOCAL = PF_LOCAL341AF_UNIX = PF_UNIX342AF_FILE = PF_FILE343AF_INET = PF_INET344AF_AX25 = PF_AX25345AF_IPX = PF_IPX346AF_APPLETALK = PF_APPLETALK347AF_NETROM = PF_NETROM348AF_BRIDGE = PF_BRIDGE349AF_ATMPVC = PF_ATMPVC350AF_X25 = PF_X25351AF_INET6 = PF_INET6352AF_ROSE = PF_ROSE353AF_DECnet = PF_DECnet354AF_NETBEUI = PF_NETBEUI355AF_SECURITY = PF_SECURITY356AF_KEY = PF_KEY357AF_NETLINK = PF_NETLINK358AF_ROUTE = PF_ROUTE359AF_PACKET = PF_PACKET360AF_ASH = PF_ASH361AF_ECONET = PF_ECONET362AF_ATMSVC = PF_ATMSVC363AF_SNA = PF_SNA364AF_IRDA = PF_IRDA365AF_PPPOX = PF_PPPOX366AF_WANPIPE = PF_WANPIPE367AF_BLUETOOTH = PF_BLUETOOTH368AF_MAX = PF_MAX369SOL_RAW = 255370SOL_DECNET = 261371SOL_X25 = 262372SOL_PACKET = 263373SOL_ATM = 264374SOL_AAL = 265375SOL_IRDA = 266376SOMAXCONN = 128377# Included from bits/sockaddr.h378_BITS_SOCKADDR_H = 1379def __SOCKADDR_COMMON(sa_prefix): return \380_SS_SIZE = 128381def CMSG_FIRSTHDR(mhdr): return \382# Included from asm/socket.h383# Included from asm/sockios.h384FIOSETOWN = 0x8901385SIOCSPGRP = 0x8902386FIOGETOWN = 0x8903387SIOCGPGRP = 0x8904388SIOCATMARK = 0x8905389SIOCGSTAMP = 0x8906390SOL_SOCKET = 1391SO_DEBUG = 1392SO_REUSEADDR = 2393SO_TYPE = 3394SO_ERROR = 4395SO_DONTROUTE = 5396SO_BROADCAST = 6397SO_SNDBUF = 7398SO_RCVBUF = 8399SO_KEEPALIVE = 9400SO_OOBINLINE = 10401SO_NO_CHECK = 11402SO_PRIORITY = 12403SO_LINGER = 13404SO_BSDCOMPAT = 14405SO_PASSCRED = 16406SO_PEERCRED = 17407SO_RCVLOWAT = 18408SO_SNDLOWAT = 19409SO_RCVTIMEO = 20410SO_SNDTIMEO = 21411SO_SECURITY_AUTHENTICATION = 22412SO_SECURITY_ENCRYPTION_TRANSPORT = 23413SO_SECURITY_ENCRYPTION_NETWORK = 24414SO_BINDTODEVICE = 25415SO_ATTACH_FILTER = 26416SO_DETACH_FILTER = 27417SO_PEERNAME = 28418SO_TIMESTAMP = 29419SCM_TIMESTAMP = SO_TIMESTAMP420SO_ACCEPTCONN = 30421SOCK_STREAM = 1422SOCK_DGRAM = 2423SOCK_RAW = 3424SOCK_RDM = 4425SOCK_SEQPACKET = 5426SOCK_PACKET = 10427SOCK_MAX = (SOCK_PACKET+1)428# Included from bits/in.h429IP_TOS = 1430IP_TTL = 2431IP_HDRINCL = 3432IP_OPTIONS = 4433IP_ROUTER_ALERT = 5434IP_RECVOPTS = 6435IP_RETOPTS = 7436IP_PKTINFO = 8437IP_PKTOPTIONS = 9438IP_PMTUDISC = 10439IP_MTU_DISCOVER = 10440IP_RECVERR = 11441IP_RECVTTL = 12442IP_RECVTOS = 13443IP_MULTICAST_IF = 32444IP_MULTICAST_TTL = 33445IP_MULTICAST_LOOP = 34446IP_ADD_MEMBERSHIP = 35447IP_DROP_MEMBERSHIP = 36448IP_RECVRETOPTS = IP_RETOPTS449IP_PMTUDISC_DONT = 0450IP_PMTUDISC_WANT = 1451IP_PMTUDISC_DO = 2452SOL_IP = 0453IP_DEFAULT_MULTICAST_TTL = 1454IP_DEFAULT_MULTICAST_LOOP = 1455IP_MAX_MEMBERSHIPS = 20456IPV6_ADDRFORM = 1457IPV6_PKTINFO = 2458IPV6_HOPOPTS = 3459IPV6_DSTOPTS = 4460IPV6_RTHDR = 5461IPV6_PKTOPTIONS = 6462IPV6_CHECKSUM = 7463IPV6_HOPLIMIT = 8464IPV6_NEXTHOP = 9465IPV6_AUTHHDR = 10466IPV6_UNICAST_HOPS = 16467IPV6_MULTICAST_IF = 17468IPV6_MULTICAST_HOPS = 18469IPV6_MULTICAST_LOOP = 19470IPV6_JOIN_GROUP = 20471IPV6_LEAVE_GROUP = 21472IPV6_ROUTER_ALERT = 22473IPV6_MTU_DISCOVER = 23474IPV6_MTU = 24475IPV6_RECVERR = 25476IPV6_RXHOPOPTS = IPV6_HOPOPTS477IPV6_RXDSTOPTS = IPV6_DSTOPTS478IPV6_ADD_MEMBERSHIP = IPV6_JOIN_GROUP479IPV6_DROP_MEMBERSHIP = IPV6_LEAVE_GROUP480IPV6_PMTUDISC_DONT = 0481IPV6_PMTUDISC_WANT = 1482IPV6_PMTUDISC_DO = 2483SOL_IPV6 = 41484SOL_ICMPV6 = 58485IPV6_RTHDR_LOOSE = 0486IPV6_RTHDR_STRICT = 1487IPV6_RTHDR_TYPE_0 = 0488# Included from endian.h489_ENDIAN_H = 1490__LITTLE_ENDIAN = 1234491__BIG_ENDIAN = 4321492__PDP_ENDIAN = 3412493# Included from bits/endian.h494__BYTE_ORDER = __LITTLE_ENDIAN495__FLOAT_WORD_ORDER = __BYTE_ORDER496LITTLE_ENDIAN = __LITTLE_ENDIAN497BIG_ENDIAN = __BIG_ENDIAN498PDP_ENDIAN = __PDP_ENDIAN499BYTE_ORDER = __BYTE_ORDER500# Included from bits/byteswap.h501_BITS_BYTESWAP_H = 1502def __bswap_constant_16(x): return \503def __bswap_16(x): return \504def __bswap_16(x): return __bswap_constant_16 (x)505def __bswap_constant_32(x): return \506def __bswap_32(x): return \507def __bswap_32(x): return \508def __bswap_32(x): return __bswap_constant_32 (x)509def __bswap_constant_64(x): return \510def __bswap_64(x): return \511def ntohl(x): return (x)512def ntohs(x): return (x)513def htonl(x): return (x)514def htons(x): return (x)515def ntohl(x): return __bswap_32 (x)516def ntohs(x): return __bswap_16 (x)517def htonl(x): return __bswap_32 (x)518def htons(x): return __bswap_16 (x)519def IN6_IS_ADDR_UNSPECIFIED(a): return \520def IN6_IS_ADDR_LOOPBACK(a): return \521def IN6_IS_ADDR_LINKLOCAL(a): return \522def IN6_IS_ADDR_SITELOCAL(a): return \523def IN6_IS_ADDR_V4MAPPED(a): return \524def IN6_IS_ADDR_V4COMPAT(a): return \525def IN6_IS_ADDR_MC_NODELOCAL(a): return \526def IN6_IS_ADDR_MC_LINKLOCAL(a): return \527def IN6_IS_ADDR_MC_SITELOCAL(a): return \528def IN6_IS_ADDR_MC_ORGLOCAL(a): return \...

Full Screen

Full Screen

World.js

Source:World.js Github

copy

Full Screen

1import * as util from './utils.js'2// class World defines the coordinate system for the model.3// It will be upgraded with methods converting from other4// transforms like GIS and DataSets.5// const defaultZ = (maxX, maxY) => Math.max(maxX, maxY)6/**7 * @private8 * @typedef {Object} WorldOptions9 * @property {number} minX Max world patch x integer value10 * @property {number} minY Max world patch y integer value11 * @property {number} minZ Max world patch z integer value12 * @property {number} maxX Min world patch x integer value13 * @property {number} maxY Min world patch y integer value14 * @property {number} maxZ Min world patch z integer value15 */16/**17 * @description18 * Class World defines the coordinate system for the model.19 * It has transforms for multiple coordinate systems.20 *21 * The world is defined by an object with 6 properties:22 *23 * WorldOptions = {24 * minX: integer,25 * maxX: integer,26 * minY: integer,27 * maxY: integer,28 * minZ: integer,29 * maxZ: integer,30 * }31 */32export default class World {33 maxX = 1634 maxY = 1635 maxZ = 1636 minX = -1637 minY = -1638 minZ = -1639 /**40 * Create a new World object given an Object with optional41 * minX, maxX, minY, maxY, minZ, maxZ overriding class properties.42 * @param {World|WorldOptions|Object} options Object with overrides for class properties43 */44 constructor(options = {}) {45 Object.assign(this, options) // set the option override values46 this.setWorld() // convert these to rest of world parameters47 }48 /**49 * Return a default options object, origin at center.50 *51 * @param {number} [maxX=16] Integer max X value52 * @param {number} [maxY=maxX] Integer max Y value53 * @param {number} [maxZ=Math.max(maxX, maxY)] Integer max Z value54 * @returns {WorldOptions}55 */56 static defaultOptions(maxX = 16, maxY = maxX, maxZ = Math.max(maxX, maxY)) {57 return {58 minX: -maxX,59 maxX: maxX,60 minY: -maxY,61 maxY: maxY,62 minZ: -maxZ,63 maxZ: maxZ,64 }65 }66 /**67 * Factory to create a default World instance.68 *69 * @param {number} [maxX=16] Integer max X value70 * @param {number} [maxY=maxX] Integer max Y value71 * @param {number} [maxZ=Math.max(maxX, maxY)] Integer max Z value72 * @returns {World}73 */74 static defaultWorld(maxX = 16, maxY = maxX, maxZ = maxX) {75 return new World(World.defaultOptions(maxX, maxY, maxZ))76 }77 // ======================78 setWorld() {79 // Complete properties derived from minX/Y, maxX/Y (patchSize === 1)80 let { minX, maxX, minY, maxY, minZ, maxZ } = this81 util.forLoop({ minX, maxX, minY, maxY, minZ, maxZ }, (val, key) => {82 if (!Number.isInteger(val))83 throw Error(`${key}:${val} must be an integer`)84 })85 this.numX = this.width = maxX - minX + 186 this.numY = this.height = maxY - minY + 187 // if (maxZ == null) maxZ = this.maxZ = Math.max(this.width, this.height)88 this.numZ = this.depth = maxZ - minZ + 189 this.minXcor = minX - 0.590 this.maxXcor = maxX + 0.591 this.minYcor = minY - 0.592 this.maxYcor = maxY + 0.593 this.minZcor = minZ - 0.594 this.maxZcor = maxZ + 0.595 // The midpoints of the world, in world coords.96 this.centerX = (minX + maxX) / 297 this.centerY = (minY + maxY) / 298 this.centerZ = (minZ + maxZ) / 299 this.numPatches = this.numX * this.numY100 }101 /**...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful