什么叫传统文化| 白带像豆腐渣用什么药| 液基薄层细胞学检查是什么| math是什么意思| 女人梦见狼是什么预兆| 十二月是什么星座| toryburch什么牌子| 中国国酒是什么| 脑炎是什么病严重吗| 肝血管瘤是什么原因引起的| 争议是什么意思| 梨子什么季节成熟| 尺寸是什么意思| 为什么喝绞股蓝会死亡| mark是什么牌子| 养老金什么时候补发| 三姓家奴是什么意思| 肾主骨是什么意思| 驻马店有什么大学| 腿上有白点是什么原因| 下焦湿热吃什么中成药| 属龙的五行属性是什么| 为什么狗不能吃巧克力| 麻是什么原因| 肠胃镜挂什么科| 导诊是干什么的| 义齿是什么| 72年属什么生肖| 睡眠不好挂什么科门诊| 手关节疼痛挂什么科| 未见卵黄囊是什么意思| 下午1点到3点是什么时辰| 珍珠婚是什么意思| 吃什么升血小板最快最好| 痔瘘和痔疮有什么区别| 牛河是什么| 喝最烈的酒下一句是什么| 什么是美尼尔氏综合症| 腰扭伤吃什么药| 疱疹不能吃什么食物| 今年17岁属什么| 灌肠是什么感觉| 什么是过敏体质| 男戴观音女戴佛有什么讲究| 耿耿于怀什么意思| 疱疹是一种什么病| 什么的眉毛| 头皮屑多是什么原因怎么去除| 近亲结婚生的孩子会得什么病| 乳腺结节和乳腺增生有什么区别| 子宫粘连是什么原因造成的| 消化道出血有什么症状| 铁石心肠是什么意思| uc是什么| 存在是什么| 辅料是什么意思| 什么叫做光合作用| 胃窦是什么| mr是什么检查项目| 饿死是什么感觉| 搪瓷杯为什么被淘汰了| 胎芽是什么意思| 为什么医生都穿洞洞鞋| 尿道炎用什么药| 粑粑黑色是什么原因| 1986年属什么生肖| 司法警察是做什么的| 柏读什么| 世界上最难的数学题是什么| 完美收官是什么意思| 满月脸是什么意思| 减肥去医院挂什么科| 最难写的字是什么| 检察院是干什么的| 石头五行属什么| bang是什么意思| 乔迁送什么花| 什么是极光| 救世主是什么意思| 海市蜃楼为什么可怕| 凝血五项是检查什么病| 脸上长斑是什么原因| 小儿风寒感冒吃什么药最好| 泰山在什么地方| 3月5日是什么纪念日| 1994年属什么生肖| 为什么养猫就没有蟑螂| 晚上9点到11点是什么时辰| 吲达帕胺片是什么药| 包子有什么馅的| 117是什么意思| 月经期间吃西瓜有什么影响| 晨起嘴苦是什么原因| 减肥医院挂什么科| 疱疹是什么原因引起| 看睾丸去医院挂什么科| 右肺下叶纤维化灶是什么意思| 丁丁是什么意思| 冠脉ct能检查出什么| 2月25日什么星座| 不孕不育有什么症状女| 什么是黄油| 377是什么| 唐玄宗为什么叫唐明皇| haccp是什么认证| 医技是什么专业| 月亮为什么是红色的| 梦见好多死人是什么征兆| 舌头涩是什么原因| 验血肝功能看什么指标| 右束支传导阻滞是什么意思| 公鸡的尾巴像什么| 什么入伏| 嘴巴里起泡是什么原因| 头发掉的厉害是什么原因| 乩童是什么意思| 当兵什么兵种最好| 3月19是什么星座| c肽测定是什么意思| 什么的风| 雪里红是什么菜| 慢性胆囊炎是什么原因引起的| cpu是什么意思| 眩晕症是什么原因引起的| 1921年是什么年| 香蕉对身体有什么好处| 先父遗传是什么意思| 3月什么星座| 木瓜是什么季节的水果| 一什么正什么| 苏州市长什么级别| 和女生聊什么话题| 血常规24项能查出什么病| cho是什么| 人参果长什么样| 白内障是什么原因引起的| 天性是什么意思| 去医院检查是否怀孕挂什么科| 怀孕六个月出血是什么原因| 什么头什么耳| 排长是什么级别| 绝育是什么意思| 什么是叶酸| 经常性头疼是什么原因| 妈妈是什么| 边界欠清是什么意思| 老上火是什么原因造成的| nit是什么意思| 中央组织部部长什么级别| 南非叶主治什么病| 一家之主是什么意思| 不可漂白是什么意思| 蛀虫指什么生肖| 刘姥姥和贾府什么关系| 卯戌相合发生什么| 牙齿突然酸痛什么原因| 玉是什么结构的字| 血糖高饮食需要注意什么| 险象环生是什么意思| 咳嗽吐黄痰吃什么药| 打狗看主人打虎看什么答案| 52什么意思| 日光性皮炎用什么药膏最有效| 一个三点水一个除念什么| 梦见和死去的人说话是什么意思| 牙齿松动吃什么药最好| 什么的桃花| 颈椎病用什么药最好| 苯对人体有什么危害| 胸内科主要看什么病| 金粉是什么| 油价什么时候调整| 尿路感染是什么原因| 十一月十九是什么星座| 嘴皮发白是什么原因| 睡不着吃什么药| 尾椎骨疼是什么原因| 美人鱼2什么时候上映| 826是什么星座| 黄连水有什么作用与功效| 湿气太重吃什么药最好| 吃什么对肠道好| 神经炎是什么症状| 葡萄都有什么品种| 支气管炎吃什么药效果最好| 蛇跟什么生肖最配| 哈密瓜不能和什么一起吃| 梦见飞机是什么意思| 生理需要是什么意思| 什么是白领| 孩子腿疼是什么原因| 孩子是ab型父母是什么血型| 舌头变肥大什么原因| 复杂性囊肿是什么意思| 反映是什么意思| 药流后可以吃什么水果| 荷花指什么生肖| 发狂是什么意思| 喜欢一个人是什么感觉| 女生安全期是什么时候| ifyou什么意思| 梦见邻居是什么意思| 苦瓜泡水喝有什么好处| 什么是黑色素瘤| 煨是什么意思| 七月初七是什么星座| 血沉偏高说明什么| 腿上的肉疼是什么原因| 什么叫猥亵| 真如是什么意思| 许久是什么意思| 颌下淋巴结肿大吃什么药| 哺乳期吃避孕药对孩子有什么影响| 蟑螂屎长什么样| 兔跟什么生肖配对最好| 五十年婚姻是什么婚| ml什么单位| 盗汗是什么| 汾酒是什么香型| 经常流鼻血是什么病的前兆| 小哥哥是什么意思| 肌肉酸痛挂什么科| 反酸烧心吃什么药| 电离辐射是指什么| 番薯是什么时候传入中国的| 老人头晕挂什么科| 梁子是什么意思| 脚趾麻是什么原因| 二次报销需要什么条件| 低密度脂蛋白是什么| 猪肝色是什么颜色| 乙肝看什么指标| 追龙什么意思| 六十岁叫什么之年| evian是什么品牌| 螺旋杆菌吃什么药| 封神榜是什么意思| 什么是嗜睡| 鹅蛋不能和什么一起吃| 天刑是什么意思| 肝风内动是什么原因造成的| 减肥要注意什么| cba是什么| 赤色是什么颜色| 武夷山岩茶属于什么茶| 身上长小红痣是什么原因| 子子念什么| 小处男是什么意思| 四两拨千斤是什么意思| 额窦炎吃什么药效果好| 什么叫梅核气| 鼻涕是绿色的是什么原因| 一月来两次月经是什么原因| 人艰不拆是什么意思| 小腿发麻是什么原因| 什么是分子| 预防脑出血吃什么药| zzegna是什么牌子价格| 痔疮吃什么药好得快| 孕妇吃山竹对胎儿有什么好处| 虎配什么生肖最好| 诊疗是什么意思| 铃字五行属什么| 空鼻症是什么症状| 百度Jump to content

毒害数万名学生眼睛的“真凶”找到了 背后利益链惊人

From Wikisource
百度 要按照党的十九大提出的新时代党的建设总要求,紧紧围绕服务中心、建设队伍两大任务,用习近平新时代中国特色社会主义思想武装党员干部头脑,指导督促中央和国家机关各单位党组(党委),以党的政治建设为统领,全面推进政治建设、思想建设、组织建设、作风建设、纪律建设,把制度建设贯穿其中,深入推进反腐败斗争,不断提高党的建设质量,切实把党的领导贯彻落实到各项工作中。

Documentation for this module may be created at Module:TableTools/doc

------------------------------------------------------------------------------------
--                                   TableTools                                   --
--                                                                                --
-- This module includes a number of functions for dealing with Lua tables.        --
-- It is a meta-module, meant to be called from other Lua modules, and should not --
-- be called directly from #invoke.                                               --
------------------------------------------------------------------------------------

local libraryUtil = require('libraryUtil')

local p = {}

-- Define often-used variables and functions.
local floor = math.floor
local infinity = math.huge
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti

------------------------------------------------------------------------------------
-- isPositiveInteger
--
-- This function returns true if the given value is a positive integer, and false
-- if not. Although it doesn't operate on tables, it is included here as it is
-- useful for determining whether a given table key is in the array part or the
-- hash part of a table.
------------------------------------------------------------------------------------
function p.isPositiveInteger(v)
	return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity
end

------------------------------------------------------------------------------------
-- isNan
--
-- This function returns true if the given number is a NaN value, and false if
-- not. Although it doesn't operate on tables, it is included here as it is useful
-- for determining whether a value can be a valid table key. Lua will generate an
-- error if a NaN is used as a table key.
------------------------------------------------------------------------------------
function p.isNan(v)
	return type(v) == 'number' and v ~= v
end

------------------------------------------------------------------------------------
-- shallowClone
--
-- This returns a clone of a table. The value returned is a new table, but all
-- subtables and functions are shared. Metamethods are respected, but the returned
-- table will have no metatable of its own.
------------------------------------------------------------------------------------
function p.shallowClone(t)
	checkType('shallowClone', 1, t, 'table')
	local ret = {}
	for k, v in pairs(t) do
		ret[k] = v
	end
	return ret
end

------------------------------------------------------------------------------------
-- removeDuplicates
--
-- This removes duplicate values from an array. Non-positive-integer keys are
-- ignored. The earliest value is kept, and all subsequent duplicate values are
-- removed, but otherwise the array order is unchanged.
------------------------------------------------------------------------------------
function p.removeDuplicates(arr)
	checkType('removeDuplicates', 1, arr, 'table')
	local isNan = p.isNan
	local ret, exists = {}, {}
	for _, v in ipairs(arr) do
		if isNan(v) then
			-- NaNs can't be table keys, and they are also unique, so we don't need to check existence.
			ret[#ret + 1] = v
		else
			if not exists[v] then
				ret[#ret + 1] = v
				exists[v] = true
			end
		end
	end
	return ret
end

------------------------------------------------------------------------------------
-- numKeys
--
-- This takes a table and returns an array containing the numbers of any numerical
-- keys that have non-nil values, sorted in numerical order.
------------------------------------------------------------------------------------
function p.numKeys(t)
	checkType('numKeys', 1, t, 'table')
	local isPositiveInteger = p.isPositiveInteger
	local nums = {}
	for k in pairs(t) do
		if isPositiveInteger(k) then
			nums[#nums + 1] = k
		end
	end
	table.sort(nums)
	return nums
end

------------------------------------------------------------------------------------
-- affixNums
--
-- This takes a table and returns an array containing the numbers of keys with the
-- specified prefix and suffix. For example, for the table
-- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return
-- {1, 3, 6}.
------------------------------------------------------------------------------------
function p.affixNums(t, prefix, suffix)
	checkType('affixNums', 1, t, 'table')
	checkType('affixNums', 2, prefix, 'string', true)
	checkType('affixNums', 3, suffix, 'string', true)

	local function cleanPattern(s)
		-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
		return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1')
	end

	prefix = prefix or ''
	suffix = suffix or ''
	prefix = cleanPattern(prefix)
	suffix = cleanPattern(suffix)
	local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'

	local nums = {}
	for k in pairs(t) do
		if type(k) == 'string' then
			local num = mw.ustring.match(k, pattern)
			if num then
				nums[#nums + 1] = tonumber(num)
			end
		end
	end
	table.sort(nums)
	return nums
end

------------------------------------------------------------------------------------
-- numData
--
-- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table
-- of subtables in the format
-- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}.
-- Keys that don't end with an integer are stored in a subtable named "other". The
-- compress option compresses the table so that it can be iterated over with
-- ipairs.
------------------------------------------------------------------------------------
function p.numData(t, compress)
	checkType('numData', 1, t, 'table')
	checkType('numData', 2, compress, 'boolean', true)
	local ret = {}
	for k, v in pairs(t) do
		local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$')
		if num then
			num = tonumber(num)
			local subtable = ret[num] or {}
			if prefix == '' then
				-- Positional parameters match the blank string; put them at the start of the subtable instead.
				prefix = 1
			end
			subtable[prefix] = v
			ret[num] = subtable
		else
			local subtable = ret.other or {}
			subtable[k] = v
			ret.other = subtable
		end
	end
	if compress then
		local other = ret.other
		ret = p.compressSparseArray(ret)
		ret.other = other
	end
	return ret
end

------------------------------------------------------------------------------------
-- compressSparseArray
--
-- This takes an array with one or more nil values, and removes the nil values
-- while preserving the order, so that the array can be safely traversed with
-- ipairs.
------------------------------------------------------------------------------------
function p.compressSparseArray(t)
	checkType('compressSparseArray', 1, t, 'table')
	local ret = {}
	local nums = p.numKeys(t)
	for _, num in ipairs(nums) do
		ret[#ret + 1] = t[num]
	end
	return ret
end

------------------------------------------------------------------------------------
-- sparseIpairs
--
-- This is an iterator for sparse arrays. It can be used like ipairs, but can
-- handle nil values.
------------------------------------------------------------------------------------
function p.sparseIpairs(t)
	checkType('sparseIpairs', 1, t, 'table')
	local nums = p.numKeys(t)
	local i = 0
	local lim = #nums
	return function ()
		i = i + 1
		if i <= lim then
			local key = nums[i]
			return key, t[key]
		else
			return nil, nil
		end
	end
end

------------------------------------------------------------------------------------
-- size
--
-- This returns the size of a key/value pair table. It will also work on arrays,
-- but for arrays it is more efficient to use the # operator.
------------------------------------------------------------------------------------
function p.size(t)
	checkType('size', 1, t, 'table')
	local i = 0
	for _ in pairs(t) do
		i = i + 1
	end
	return i
end

local function defaultKeySort(item1, item2)
	-- "number" < "string", so numbers will be sorted before strings.
	local type1, type2 = type(item1), type(item2)
	if type1 ~= type2 then
		return type1 < type2
	elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then
		return tostring(item1) < tostring(item2)
	else
		return item1 < item2
	end
end
------------------------------------------------------------------------------------
-- keysToList
--
-- Returns an array of the keys in a table, sorted using either a default
-- comparison function or a custom keySort function.
------------------------------------------------------------------------------------
function p.keysToList(t, keySort, checked)
	if not checked then
		checkType('keysToList', 1, t, 'table')
		checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'})
	end

	local arr = {}
	local index = 1
	for k in pairs(t) do
		arr[index] = k
		index = index + 1
	end

	if keySort ~= false then
		keySort = type(keySort) == 'function' and keySort or defaultKeySort
		table.sort(arr, keySort)
	end

	return arr
end

------------------------------------------------------------------------------------
-- sortedPairs
--
-- Iterates through a table, with the keys sorted using the keysToList function.
-- If there are only numerical keys, sparseIpairs is probably more efficient.
------------------------------------------------------------------------------------
function p.sortedPairs(t, keySort)
	checkType('sortedPairs', 1, t, 'table')
	checkType('sortedPairs', 2, keySort, 'function', true)

	local arr = p.keysToList(t, keySort, true)

	local i = 0
	return function ()
		i = i + 1
		local key = arr[i]
		if key ~= nil then
			return key, t[key]
		else
			return nil, nil
		end
	end
end

------------------------------------------------------------------------------------
-- isArray
--
-- Returns true if the given value is a table and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArray(v)
	if type(v) ~= 'table' then
		return false
	end
	local i = 0
	for _ in pairs(v) do
		i = i + 1
		if v[i] == nil then
			return false
		end
	end
	return true
end

------------------------------------------------------------------------------------
-- isArrayLike
--
-- Returns true if the given value is iterable and all keys are consecutive
-- integers starting at 1.
------------------------------------------------------------------------------------
function p.isArrayLike(v)
	if not pcall(pairs, v) then
		return false
	end
	local i = 0
	for _ in pairs(v) do
		i = i + 1
		if v[i] == nil then
			return false
		end
	end
	return true
end

------------------------------------------------------------------------------------
-- invert
--
-- Transposes the keys and values in an array. For example, {"a", "b", "c"} ->
-- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to
-- the index of the last duplicate) and NaN values are ignored.
------------------------------------------------------------------------------------
function p.invert(arr)
	checkType("invert", 1, arr, "table")
	local isNan = p.isNan
	local map = {}
	for i, v in ipairs(arr) do
		if not isNan(v) then
			map[v] = i
		end
	end

	return map
end

------------------------------------------------------------------------------------
-- listToSet
--
-- Creates a set from the array part of the table. Indexing the set by any of the
-- values of the array returns true. For example, {"a", "b", "c"} ->
-- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them
-- never equal to any value (including other NaNs or even themselves).
------------------------------------------------------------------------------------
function p.listToSet(arr)
	checkType("listToSet", 1, arr, "table")
	local isNan = p.isNan
	local set = {}
	for _, v in ipairs(arr) do
		if not isNan(v) then
			set[v] = true
		end
	end

	return set
end

------------------------------------------------------------------------------------
-- deepCopy
--
-- Recursive deep copy function. Preserves identities of subtables.
------------------------------------------------------------------------------------
local function _deepCopy(orig, includeMetatable, already_seen)
	-- Stores copies of tables indexed by the original table.
	already_seen = already_seen or {}

	local copy = already_seen[orig]
	if copy ~= nil then
		return copy
	end

	if type(orig) == 'table' then
		copy = {}
		for orig_key, orig_value in pairs(orig) do
			copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen)
		end
		already_seen[orig] = copy

		if includeMetatable then
			local mt = getmetatable(orig)
			if mt ~= nil then
				local mt_copy = _deepCopy(mt, includeMetatable, already_seen)
				setmetatable(copy, mt_copy)
				already_seen[mt] = mt_copy
			end
		end
	else -- number, string, boolean, etc
		copy = orig
	end
	return copy
end

function p.deepCopy(orig, noMetatable, already_seen)
	checkType("deepCopy", 3, already_seen, "table", true)
	return _deepCopy(orig, not noMetatable, already_seen)
end

------------------------------------------------------------------------------------
-- sparseConcat
--
-- Concatenates all values in the table that are indexed by a number, in order.
-- sparseConcat{a, nil, c, d}  =>  "acd"
-- sparseConcat{nil, b, c, d}  =>  "bcd"
------------------------------------------------------------------------------------
function p.sparseConcat(t, sep, i, j)
	local arr = {}

	local arr_i = 0
	for _, v in p.sparseIpairs(t) do
		arr_i = arr_i + 1
		arr[arr_i] = v
	end

	return table.concat(arr, sep, i, j)
end

------------------------------------------------------------------------------------
-- length
--
-- Finds the length of an array, or of a quasi-array with keys such as "data1",
-- "data2", etc., using an exponential search algorithm. It is similar to the
-- operator #, but may return a different value when there are gaps in the array
-- portion of the table. Intended to be used on data loaded with mw.loadData. For
-- other tables, use #.
-- Note: #frame.args in frame object always be set to 0, regardless of  the number
-- of unnamed template parameters, so use this function for frame.args.
------------------------------------------------------------------------------------
function p.length(t, prefix)
	-- requiring module inline so that [[Module:Exponential search]] which is
	-- only needed by this one function doesn't get millions of transclusions
	local expSearch = require("Module:Exponential search")
	checkType('length', 1, t, 'table')
	checkType('length', 2, prefix, 'string', true)
	return expSearch(function (i)
		local key
		if prefix then
			key = prefix .. tostring(i)
		else
			key = i
		end
		return t[key] ~= nil
	end) or 0
end

------------------------------------------------------------------------------------
-- inArray
--
-- Returns true if valueToFind is a member of the array, and false otherwise.
------------------------------------------------------------------------------------
function p.inArray(arr, valueToFind)
	checkType("inArray", 1, arr, "table")
	-- if valueToFind is nil, error?

	for _, v in ipairs(arr) do
		if v == valueToFind then
			return true
		end
	end
	return false
end

return p
心动过速吃什么药最好 游离甲状腺素偏低是什么意思 桑葚是什么季节的 梦见亲人去世是什么意思 非洲说什么语言
鬓角长痘痘是什么原因 p.a.是什么意思 借条和欠条有什么区别 细菌性阴道炎用什么药效果最好 小肠气是什么病
婴儿大便有泡沫是什么原因 备孕是什么意思 hpv51阳性是什么意思 头什么脚什么 09年的牛是什么命
独角仙吃什么食物 右乳钙化灶是什么意思 弦子为什么嫁给李茂 吃蒲公英有什么好处 wonderful什么意思
骨盆前倾挂什么科hcv7jop4ns8r.cn 沙雕是什么意思gysmod.com 血清高是什么原因hcv8jop9ns2r.cn 儿童c反应蛋白高说明什么hcv8jop8ns7r.cn 支气管扩张吃什么药bjhyzcsm.com
大脚趾发黑是什么原因weuuu.com 食蚁兽是什么动物hcv7jop5ns1r.cn 90年属于什么生肖hcv7jop6ns2r.cn 脑震荡挂什么科hcv9jop6ns6r.cn 稽留流产是什么意思hcv9jop0ns5r.cn
羊奶不能和什么一起吃hlguo.com 一什么千什么hcv7jop5ns3r.cn 尿路感染用什么药好96micro.com 孕酮低对胎儿有什么影响hcv8jop7ns1r.cn 风湿和类风湿有什么区别hcv9jop5ns3r.cn
城五行属什么xianpinbao.com 女人的第二张脸是什么hcv8jop0ns6r.cn 白天看见蛇有什么预兆bfb118.com 白洞是什么东西hcv8jop2ns6r.cn 眼睛下面有痣代表什么tiangongnft.com
百度