• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.add_pgiter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.add_pgiter函数的典型用法代码示例。如果您正苦于以下问题:Python add_pgiter函数的具体用法?Python add_pgiter怎么用?Python add_pgiter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了add_pgiter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: parse_configuration

def parse_configuration(page, data, offset, parent):
	(length, off) = rdata(data, offset, '<I')
	length = int(length)
	data = data[off - 4:off + length]
	confiter = add_pgiter(page, 'Configuration', 'zbr', 'configuration', data, parent)
	add_pgiter(page, 'Local configuration', 'zbr', 'config_local', data[4:], confiter)
	return off + length
开发者ID:renyxa,项目名称:re-lab,代码行数:7,代码来源:zbr.py


示例2: parse_palette

def parse_palette(page, data, offset, parent):
	(length, off) = rdata(data, offset, '<I')
	length = int(length)
	data = data[off - 4:off + length]
	palette_iter = add_pgiter(page, 'Color Palette', 'zbr', 'color_palette', data, parent)
	add_pgiter(page, 'Palette', 'zbr', 'palette', data[4:], palette_iter)
	return off + length
开发者ID:renyxa,项目名称:re-lab,代码行数:7,代码来源:zbr.py


示例3: handle_tile_row

def handle_tile_row(parser, page, data, parent):
	data = parser.tile_row_data
	offsets = sorted(parser.tile_row_offsets.keys())
	for (start, end) in zip(offsets, offsets[1:] + [len(data)]):
		add_pgiter(page, 'Column %d' % parser.tile_row_offsets[start], 'iwa', 'iwa_tile_row', data[start:end], parser.tile_row_iter)
	parser.tile_row_data = ''
	parser.tile_row_offsets = {}
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:iwa.py


示例4: parse_configuration

	def parse_configuration(self, off):
		(length, off) = rdata(self.data, off, '<I')
		length = int(length)
		data = self.data[off - 4:off + length]
		confiter = add_pgiter(self.page, 'Configuration', 'zbr', 'configuration', data, self.fileiter)
		add_pgiter(self.page, 'Local configuration', 'zbr', 'config_local', data[4:], confiter)
		return off + length
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:zbr.py


示例5: read_thumbnail

	def read_thumbnail(self):
		start = self.header_size + self.metadata_size
		end = start + self.thumbnail_size
		typ = "Unknown"
		if lrf_thumbnail_types.has_key(self.thumbnail_type):
			typ = lrf_thumbnail_types[self.thumbnail_type]
		add_pgiter(self.page, 'Thumbnail (%s)' % typ, 'lrf', 0, self.data[start:end], self.parent)
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:lrf.py


示例6: parse_text_frame

	def parse_text_frame(self, data, parent):
		off = self._parse_object(data, 0, parent)
		off = self._parse_object(data, off, parent)
		off = self._parse_object(data, off, parent)
		add_pgiter(self.page, 'Bounding box', 'zmf', 'zmf2_bbox', data[off:off + 0x20], parent)
		off += 0x20
		(count, off) = rdata(data, off, '<I')

		chars = []
		chars_len = 0
		i = 0
		while i < int(count):
			(length, off) = rdata(data, off, '<I')
			i += 1
			chars.append(data[off - 4:off + int(length)])
			chars_len += 4 + int(length)
			off += int(length)

		charsiter = add_pgiter(self.page, 'Characters', 'zmf', 0, data[off:off + chars_len], parent)
		i = 0
		while i != len(chars):
			add_pgiter(self.page, 'Character %d' % (i + 1), 'zmf', 'zmf2_character', chars[i], charsiter)
			i += 1

		return off
开发者ID:cherry-wb,项目名称:re-lab,代码行数:25,代码来源:zmf.py


示例7: read_stream

	def read_stream(self, data, parent):
		callback = 0
		if self.stream_states[-1].stream_flags == 0x100:
			callback = 'compressed_stream'
		strmiter = add_pgiter(self.page, 'Stream', 'lrf', callback, data, parent)
		# data = self.decrypt_stream(self.data[start:start + length])
		# add_pgiter(self.page, '[Unobfuscated]', 'lrf', 0, data, strmiter)

		content = data
		content_name = 'Content'
		# TODO: This is speculative. I think that actually the lower
		# byte contains type (e.g., image types, ToC, tags) and only the
		# higher byte is flags (or flag). It seems that 0x1 means
		# 'compressed'.
		if self.stream_states[-1].stream_flags == 0x100:
			(uncompressed_size, off) = rdata(data, 0, '<I')
			try:
				content = zlib.decompress(data[off:])
				content_name = 'Uncompressed content'
				assert len(content) == uncompressed_size
			except zlib.error:
				pass
		callback = 0
		if self.stream_states[-1].stream_flags == 0x51:
			callback = 'toc'
		cntiter = add_pgiter(self.page, content_name, 'lrf', callback, content, strmiter)
		self.stream_level += 1
		if len(content) > 1 and ord(content[1]) == 0xf5:
			self.read_object_tags(content, cntiter)
		self.stream_level -= 1
		self.stream_states[-1].stream_read = True
开发者ID:AlexP11223,项目名称:re-lab,代码行数:31,代码来源:lrf.py


示例8: parse_data_record

	def parse_data_record(self, n, data, parent):
		(para, off) = rdata(data, 2, '>H')
		off += 2
		(typ, off) = rdata(data, off, 'B')
		typ_str = None
		if int(typ) < len(plucker_type):
			typ_str = ' (%s)' % plucker_type[int(typ)]
		reciter = add_pgiter(self.page, 'Record %d%s' % (n, typ_str), 'pdb', 'plucker_record', data, parent)

		if typ == 0 or typ == 1:
			# read para headers
			off = 8
			paraiter = add_pgiter(self.page, 'Paragraphs', 'pdb', 0, data[off:off + 4 * int(para)], reciter)
			for i in range(int(para)):
				(size, off) = rdata(data, off, '>H')
				(attrs, off) = rdata(data, off, '>H')
				add_pgiter(self.page, 'Paragraph %d' % i, 'pdb', 'plucker_para', data[off - 4:off], paraiter)

			text = data[off:len(data)]

			if typ == 0:
				add_pgiter(self.page, 'Text', 'pdb', 0, text, reciter)
			elif typ == 1:
				if self.version == 1:
					uncompressed = lz77_decompress(text)
					add_pgiter(self.page, 'Text', 'pdb', 0, uncompressed, reciter)
				elif self.version == 2:
					uncompressed = zlib.decompress(text)
					add_pgiter(self.page, 'Text', 'pdb', 0, uncompressed, reciter)
开发者ID:AlexP11223,项目名称:re-lab,代码行数:29,代码来源:pdb.py


示例9: parse_preview

def parse_preview(page, data, offset, parent):
	off = offset
	previter = add_pgiter(page, 'Preview bitmap', 'zbr', 0, data[off:off + 5264], parent)
	add_pgiter(page, 'DIB palette', 'zbr', 'palette', data[off:off + 64], previter)
	off += 64
	dibiter = add_pgiter(page, 'DIB data', 'zbr', 0, data[off:off + 5200], previter)
	return off + 5200
开发者ID:renyxa,项目名称:re-lab,代码行数:7,代码来源:zbr.py


示例10: parse_palette

	def parse_palette(self, off):
		(length, off) = rdata(self.data, off, '<I')
		length = int(length)
		data = self.data[off - 4:off + length]
		palette_iter = add_pgiter(self.page, 'Color Palette', 'zbr', 'color_palette', data, self.fileiter)
		add_pgiter(self.page, 'Palette', 'zbr', 'palette', data[4:], palette_iter)
		return off + length
开发者ID:AlexP11223,项目名称:re-lab,代码行数:7,代码来源:zbr.py


示例11: parse_color

	def parse_color(self, data, parent):
		(length, off) = rdata(data, 0xd, '<I')
		name_str = 'Color'
		if length > 1:
			(name, off) = rdata(data, off, '%ds' % (int(length) - 1))
			name_str += ' (%s)' % unicode(name, 'cp1250')
		add_pgiter(self.page, name_str, 'zmf', 'zmf2_color', data, parent)
		return len(data)
开发者ID:cherry-wb,项目名称:re-lab,代码行数:8,代码来源:zmf.py


示例12: parse_table

	def parse_table(self, data, parent):
		off = self._parse_object(data, 0, parent)
		off = self._parse_object(data, off, parent)
		off = self._parse_object(data, off, parent)
		add_pgiter(self.page, 'Bounding box', 'zmf', 'zmf2_bbox', data[off:off + 0x20], parent)
		off += 0x20
		add_pgiter(self.page, 'Def', 'zmf', 'zmf2_table', data[off:], parent)
		return off
开发者ID:cherry-wb,项目名称:re-lab,代码行数:8,代码来源:zmf.py


示例13: handle_footnotes

def handle_footnotes(page, data, parent, parser=None):
	(count, off) = rdata(data, 0, '<I')
	entry_size = 24 # FIXME: a guess
	off += 8
	for i in range(0, count):
		add_pgiter(page, 'Footnote %d' % i, 'wt602', '', data[off:off + entry_size], parent)
		off += entry_size
	if off < len(data):
		add_pgiter(page, 'Trailer', 'wt602', '', data[off:], parent)
开发者ID:rgwan,项目名称:re-lab,代码行数:9,代码来源:wt602.py


示例14: parse_header

	def parse_header(self):
		(offset, off) = rdata(self.data, 0x20, '<I')
		(preview, off) = rdata(self.data, off, '<I')
		if int(preview) != 0:
			self.preview_offset = int(preview) - int(offset)
			assert self.preview_offset == 0x20 # this is what I see in all files
		data = self.data[0:int(offset)]
		add_pgiter(self.page, 'Header', 'zmf', 'zmf4_header', data, self.parent)
		return offset
开发者ID:cherry-wb,项目名称:re-lab,代码行数:9,代码来源:zmf.py


示例15: handle_styles

def handle_styles(page, data, parent, parser = None):
	(hdrsize, off) = rdata(data, 0, '<I')
	count = hdrsize / 0x20
	off = 0x10
	hdriter = add_pgiter(page, 'Names', 'wt602', 0, data[:hdrsize + 0x10], parent)
	for i in range(0, count):
		add_pgiter(page, 'Style %d' % i, 'wt602', 'style_header', data[off:off + 0x20], hdriter)
		off += 0x20
	add_pgiter(page, 'Definitions', 'wt602', 0, data[hdrsize + 0x10:], parent)
开发者ID:rgwan,项目名称:re-lab,代码行数:9,代码来源:wt602.py


示例16: parse_index_record

	def parse_index_record(self, data, parent):
		off = 0
		(self.version, off) = rdata(data, off, '>H')
		(self.record_count, off) = rdata(data, off, '>H')
		(self.text_length, off) = rdata(data, off, '>I')
		(self.record_size, off) = rdata(data, off, '>H')
		off += 8
		(self.compression, off) = rdata(data, off, 'B')
		add_pgiter(self.page, 'Index', 'pdb', 'ztxt_index', data, parent)
开发者ID:AlexP11223,项目名称:re-lab,代码行数:9,代码来源:pdb.py


示例17: parse_header

	def parse_header(self):
		(count, off) = rdata(self.data, 76, '>H')
		hdriter = add_pgiter(self.page, 'Header', 'pdb', 'pdb_header', self.data[0:76 + 4 * count], self.parent)
		offiter = add_pgiter(self.page, 'Offset table', 'pdb', 0, self.data[76:76 + 4 * count], hdriter)

		for i in range(0, count):
			add_pgiter(self.page, 'Offset %d' % i, 'pdb', 'pdb_offset', self.data[off:off + 8], offiter)
			(record, off) = rdata(self.data, off, '>I')
			off += 4
			self.records.append(record)
开发者ID:AlexP11223,项目名称:re-lab,代码行数:10,代码来源:pdb.py


示例18: handle_fonts

def handle_fonts(page, data, parent, parser = None):
	(count, off) = rdata(data, 0, '<I')
	for i in range(0, count):
		start = off
		off += 2
		# read font name
		while off < len(data) and data[off] != '\0':
			off += 1
		# read zeros to the next record
		while off < len(data) and data[off] == '\0':
			off += 1
		add_pgiter(page, 'Font %d' % i, 'wt602', 'font', data[start:off], parent)
开发者ID:rgwan,项目名称:re-lab,代码行数:12,代码来源:wt602.py


示例19: handle_strings

def handle_strings(page, data, parent, parser = None):
	(hdrsize, off) = rdata(data, 0, '<I')
	off = 0x10
	hdriter = add_pgiter(page, 'Definitions', 'wt602', 0, data[:hdrsize + 0x10], parent)
	i = 0
	while off < hdrsize + 0x10:
		start = off
		(length, off) = rdata(data, off + 4, '<H')
		off = start + length
		add_pgiter(page, 'String %d' % i, 'wt602', 'string_header', data[start:off], hdriter)
		i += 1
	add_pgiter(page, '???', 'wt602', 0, data[hdrsize + 0x10:], parent)
开发者ID:weluc,项目名称:re-lab,代码行数:12,代码来源:wt602.py


示例20: zmf2_open

def zmf2_open(page, data, parent, fname):
	file_map = {
		'BitmapDB.zmf': ZMF2Parser.parse_bitmap_db_doc,
		'TextStyles.zmf': ZMF2Parser.parse_text_styles_doc,
		'Callisto_doc.zmf': ZMF2Parser.parse_doc,
		'Callisto_pages.zmf': ZMF2Parser.parse_pages_doc,
	}
	if fname == 'Header':
		add_pgiter(page, 'Header', 'zmf', 'zmf2_header', data, parent)
	elif file_map.has_key(fname):
		if data != None:
			parser = ZMF2Parser(data, page, parent, file_map[fname])
			parser.parse()
开发者ID:cherry-wb,项目名称:re-lab,代码行数:13,代码来源:zmf.py



注:本文中的utils.add_pgiter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.allclose_with_out函数代码示例发布时间:2022-05-26
下一篇:
Python utils.add_iter函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap