Pylint work, #99

This commit is contained in:
John Evans 2013-08-10 14:39:25 -04:00
commit fbc9bbcf14
3 changed files with 673 additions and 582 deletions

View file

@ -807,6 +807,8 @@ class COCsegment(Segment):
Coding style for this component. Coding style for this component.
spcoc : byte array spcoc : byte array
Coding style parameters for this component. Coding style parameters for this component.
precinct_size : list of tuples
Dimensions of precinct.
References References
---------- ----------
@ -820,13 +822,13 @@ class COCsegment(Segment):
self.scoc = scoc self.scoc = scoc
self.spcoc = spcoc self.spcoc = spcoc
self._code_block_size = (4 * math.pow(2, self.spcoc[2]), self.code_block_size = (4 * math.pow(2, self.spcoc[2]),
4 * math.pow(2, self.spcoc[1])) 4 * math.pow(2, self.spcoc[1]))
if len(self.spcoc) > 5: if len(self.spcoc) > 5:
self._precinct_size = _parse_precinct_size(self.spcoc[5:]) self.precinct_size = _parse_precinct_size(self.spcoc[5:])
else: else:
self._precinct_size = None self.precinct_size = None
self.length = length self.length = length
self.offset = offset self.offset = offset
@ -847,16 +849,16 @@ class COCsegment(Segment):
msg += '\n Code block height, width: ({1} x {2})' msg += '\n Code block height, width: ({1} x {2})'
msg += '\n Wavelet transform: {3}' msg += '\n Wavelet transform: {3}'
msg = msg.format(self.spcoc[0] + 1, msg = msg.format(self.spcoc[0] + 1,
int(self._code_block_size[0]), int(self.code_block_size[0]),
int(self._code_block_size[1]), int(self.code_block_size[1]),
_WAVELET_TRANSFORM_DISPLAY[self.spcoc[4]]) _WAVELET_TRANSFORM_DISPLAY[self.spcoc[4]])
msg += '\n ' msg += '\n '
msg += _context_string(self.spcoc[3]) msg += _context_string(self.spcoc[3])
if self._precinct_size is not None: if self.precinct_size is not None:
msg += '\n Precinct size: ' msg += '\n Precinct size: '
for pps in self._precinct_size: for pps in self.precinct_size:
msg += '(%d, %d)'.format(pps) msg += '(%d, %d)'.format(pps)
return msg return msg
@ -876,10 +878,16 @@ class CODsegment(Segment):
two bytes constituting the marker. two bytes constituting the marker.
scod : int scod : int
Default coding style. Default coding style.
layers : int
Quality layers.
code_block_size : tuple
Size of code block.
spcod : bytes spcod : bytes
Coding style parameters, including quality layers, multicomponent Encoded coding style parameters, including quality layers,
transform usage, decomposition levels, code block size, style of code- multi component transform usage, decomposition levels, code block size,
block passes, and which wavelet transform is used. style of code-block passes, and which wavelet transform is used.
precinct_size : list of tuples
Dimensions of precinct.
References References
---------- ----------
@ -895,7 +903,7 @@ class CODsegment(Segment):
self.offset = offset self.offset = offset
params = struct.unpack('>BHBBBBBB', self.spcod[0:9]) params = struct.unpack('>BHBBBBBB', self.spcod[0:9])
self._layers = params[1] self.layers = params[1]
self._numresolutions = params[3] self._numresolutions = params[3]
if params[3] > opj2.J2K_MAXRLVLS: if params[3] > opj2.J2K_MAXRLVLS:
@ -906,12 +914,12 @@ class CODsegment(Segment):
cblk_width = 4 * math.pow(2, params[4]) cblk_width = 4 * math.pow(2, params[4])
cblk_height = 4 * math.pow(2, params[5]) cblk_height = 4 * math.pow(2, params[5])
code_block_size = (cblk_height, cblk_width) code_block_size = (cblk_height, cblk_width)
self._code_block_size = code_block_size self.code_block_size = code_block_size
if len(self.spcod) > 9: if len(self.spcod) > 9:
self._precinct_size = _parse_precinct_size(self.spcod[9:]) self.precinct_size = _parse_precinct_size(self.spcod[9:])
else: else:
self._precinct_size = None self.precinct_size = None
def __str__(self): def __str__(self):
msg = Segment.__str__(self) msg = Segment.__str__(self)
@ -944,18 +952,18 @@ class CODsegment(Segment):
msg += '\n '.join(lines) msg += '\n '.join(lines)
msg = msg.format(_PROGRESSION_ORDER_DISPLAY[self.spcod[0]], msg = msg.format(_PROGRESSION_ORDER_DISPLAY[self.spcod[0]],
self._layers, self.layers,
mct, mct,
self.spcod[4] + 1, self.spcod[4] + 1,
int(self._code_block_size[0]), int(self.code_block_size[0]),
int(self._code_block_size[1]), int(self.code_block_size[1]),
_WAVELET_TRANSFORM_DISPLAY[self.spcod[8]]) _WAVELET_TRANSFORM_DISPLAY[self.spcod[8]])
msg += '\n Precinct size: ' msg += '\n Precinct size: '
if self._precinct_size is None: if self.precinct_size is None:
msg += 'default, 2^15 x 2^15' msg += 'default, 2^15 x 2^15'
else: else:
for pps in self._precinct_size: for pps in self.precinct_size:
msg += '({0}, {1})'.format(pps[0], pps[1]) msg += '({0}, {1})'.format(pps[0], pps[1])
msg += '\n ' msg += '\n '
@ -1411,7 +1419,11 @@ class SIZsegment(Segment):
xtosiz, ytosiz : int xtosiz, ytosiz : int
Horizontal and vertical offsets of tile from origin of reference grid. Horizontal and vertical offsets of tile from origin of reference grid.
ssiz : iterable bytes ssiz : iterable bytes
Precision (depth) in bits and sign of each component. Encoded precision (depth) in bits and sign of each component.
bitdepth : iterable bytes
Precision (depth) in bits of each component.
signed : iterable bool
Signedness of each component.
xrsiz, yrsiz : int xrsiz, yrsiz : int
Horizontal and vertical sample separations with respect to reference Horizontal and vertical sample separations with respect to reference
grid. grid.
@ -1459,8 +1471,8 @@ class SIZsegment(Segment):
self.xrsiz = data[1::3] self.xrsiz = data[1::3]
self.yrsiz = data[2::3] self.yrsiz = data[2::3]
self._bitdepth = tuple(((x & 0x7f) + 1) for x in self.ssiz) self.bitdepth = tuple(((x & 0x7f) + 1) for x in self.ssiz)
self._signed = tuple(((x & 0xb0) > 0) for x in self.ssiz) self.signed = tuple(((x & 0xb0) > 0) for x in self.ssiz)
self.length = length self.length = length
self.offset = offset self.offset = offset
@ -1483,8 +1495,8 @@ class SIZsegment(Segment):
self.yosiz, self.xosiz, self.yosiz, self.xosiz,
self.ytsiz, self.xtsiz, self.ytsiz, self.xtsiz,
self.ytosiz, self.xtosiz, self.ytosiz, self.xtosiz,
self._bitdepth, self.bitdepth,
self._signed, self.signed,
tuple(zip(self.yrsiz, self.xrsiz))) tuple(zip(self.yrsiz, self.xrsiz)))
return msg return msg

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff