Update kaitaistruct version to 0.6

This commit is contained in:
Sachin Kelkar 2017-02-08 21:16:17 +05:30
parent 28c0596742
commit 5dd54ef012
3 changed files with 30 additions and 30 deletions

View File

@ -69,18 +69,18 @@ class Gif(KaitaiStruct):
@property
def has_color_table(self):
if hasattr(self, '_m_has_color_table'):
return self._m_has_color_table
return self._m_has_color_table if hasattr(self, '_m_has_color_table') else None
self._m_has_color_table = (self.flags & 128) != 0
return self._m_has_color_table
return self._m_has_color_table if hasattr(self, '_m_has_color_table') else None
@property
def color_table_size(self):
if hasattr(self, '_m_color_table_size'):
return self._m_color_table_size
return self._m_color_table_size if hasattr(self, '_m_color_table_size') else None
self._m_color_table_size = (2 << (self.flags & 7))
return self._m_color_table_size
return self._m_color_table_size if hasattr(self, '_m_color_table_size') else None
class LocalImageDescriptor(KaitaiStruct):
@ -103,34 +103,34 @@ class Gif(KaitaiStruct):
@property
def has_color_table(self):
if hasattr(self, '_m_has_color_table'):
return self._m_has_color_table
return self._m_has_color_table if hasattr(self, '_m_has_color_table') else None
self._m_has_color_table = (self.flags & 128) != 0
return self._m_has_color_table
return self._m_has_color_table if hasattr(self, '_m_has_color_table') else None
@property
def has_interlace(self):
if hasattr(self, '_m_has_interlace'):
return self._m_has_interlace
return self._m_has_interlace if hasattr(self, '_m_has_interlace') else None
self._m_has_interlace = (self.flags & 64) != 0
return self._m_has_interlace
return self._m_has_interlace if hasattr(self, '_m_has_interlace') else None
@property
def has_sorted_color_table(self):
if hasattr(self, '_m_has_sorted_color_table'):
return self._m_has_sorted_color_table
return self._m_has_sorted_color_table if hasattr(self, '_m_has_sorted_color_table') else None
self._m_has_sorted_color_table = (self.flags & 32) != 0
return self._m_has_sorted_color_table
return self._m_has_sorted_color_table if hasattr(self, '_m_has_sorted_color_table') else None
@property
def color_table_size(self):
if hasattr(self, '_m_color_table_size'):
return self._m_color_table_size
return self._m_color_table_size if hasattr(self, '_m_color_table_size') else None
self._m_color_table_size = (2 << (self.flags & 7))
return self._m_color_table_size
return self._m_color_table_size if hasattr(self, '_m_color_table_size') else None
class Block(KaitaiStruct):
@ -162,7 +162,7 @@ class Gif(KaitaiStruct):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self.magic = self._io.ensure_fixed_contents(3, struct.pack('3b', 71, 73, 70))
self.magic = self._io.ensure_fixed_contents(struct.pack('3b', 71, 73, 70))
self.version = self._io.read_bytes(3)
@ -171,27 +171,27 @@ class Gif(KaitaiStruct):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self.block_size = self._io.ensure_fixed_contents(1, struct.pack('1b', 4))
self.block_size = self._io.ensure_fixed_contents(struct.pack('1b', 4))
self.flags = self._io.read_u1()
self.delay_time = self._io.read_u2le()
self.transparent_idx = self._io.read_u1()
self.terminator = self._io.ensure_fixed_contents(1, struct.pack('1b', 0))
self.terminator = self._io.ensure_fixed_contents(struct.pack('1b', 0))
@property
def transparent_color_flag(self):
if hasattr(self, '_m_transparent_color_flag'):
return self._m_transparent_color_flag
return self._m_transparent_color_flag if hasattr(self, '_m_transparent_color_flag') else None
self._m_transparent_color_flag = (self.flags & 1) != 0
return self._m_transparent_color_flag
return self._m_transparent_color_flag if hasattr(self, '_m_transparent_color_flag') else None
@property
def user_input_flag(self):
if hasattr(self, '_m_user_input_flag'):
return self._m_user_input_flag
return self._m_user_input_flag if hasattr(self, '_m_user_input_flag') else None
self._m_user_input_flag = (self.flags & 2) != 0
return self._m_user_input_flag
return self._m_user_input_flag if hasattr(self, '_m_user_input_flag') else None
class Subblock(KaitaiStruct):

View File

@ -25,9 +25,9 @@ class Png(KaitaiStruct):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self.magic = self._io.ensure_fixed_contents(8, struct.pack('8b', -119, 80, 78, 71, 13, 10, 26, 10))
self.ihdr_len = self._io.ensure_fixed_contents(4, struct.pack('4b', 0, 0, 0, 13))
self.ihdr_type = self._io.ensure_fixed_contents(4, struct.pack('4b', 73, 72, 68, 82))
self.magic = self._io.ensure_fixed_contents(struct.pack('8b', -119, 80, 78, 71, 13, 10, 26, 10))
self.ihdr_len = self._io.ensure_fixed_contents(struct.pack('4b', 0, 0, 0, 13))
self.ihdr_type = self._io.ensure_fixed_contents(struct.pack('4b', 73, 72, 68, 82))
self.ihdr = self._root.IhdrChunk(self._io, self, self._root)
self.ihdr_crc = self._io.read_bytes(4)
self.chunks = []
@ -117,18 +117,18 @@ class Png(KaitaiStruct):
@property
def x(self):
if hasattr(self, '_m_x'):
return self._m_x
return self._m_x if hasattr(self, '_m_x') else None
self._m_x = (self.x_int / 100000.0)
return self._m_x
return self._m_x if hasattr(self, '_m_x') else None
@property
def y(self):
if hasattr(self, '_m_y'):
return self._m_y
return self._m_y if hasattr(self, '_m_y') else None
self._m_y = (self.y_int / 100000.0)
return self._m_y
return self._m_y if hasattr(self, '_m_y') else None
class BkgdGreyscale(KaitaiStruct):
@ -186,7 +186,7 @@ class Png(KaitaiStruct):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self.render_intent = self._root.Intent(self._io.read_u1())
self.render_intent = self._root.SrgbChunk.Intent(self._io.read_u1())
class CompressedTextChunk(KaitaiStruct):
@ -220,10 +220,10 @@ class Png(KaitaiStruct):
@property
def gamma_ratio(self):
if hasattr(self, '_m_gamma_ratio'):
return self._m_gamma_ratio
return self._m_gamma_ratio if hasattr(self, '_m_gamma_ratio') else None
self._m_gamma_ratio = (100000.0 / self.gamma_int)
return self._m_gamma_ratio
return self._m_gamma_ratio if hasattr(self, '_m_gamma_ratio') else None
class BkgdChunk(KaitaiStruct):

View File

@ -71,7 +71,7 @@ setup(
"html2text>=2016.1.8, <=2016.9.19",
"hyperframe>=4.0.1, <5",
"jsbeautifier>=1.6.3, <1.7",
"kaitaistruct>=0.5, <0.6",
"kaitaistruct>=0.6, <0.7",
"Pillow>=3.2, <4.1",
"passlib>=1.6.5, <1.8",
"pyasn1>=0.1.9, <0.2",