Pylint work. #90
This commit is contained in:
parent
8120c21299
commit
372bfc2943
3 changed files with 5 additions and 78 deletions
|
|
@ -636,79 +636,6 @@ class CompositingLayerHeaderBox(Jp2kBox):
|
|||
return box
|
||||
|
||||
|
||||
class JP2HeaderBox(Jp2kBox):
|
||||
"""Container for JP2 header box information.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
box_id : str
|
||||
4-character identifier for the box.
|
||||
length : int
|
||||
length of the box in bytes.
|
||||
offset : int
|
||||
offset of the box from the start of the file.
|
||||
longname : str
|
||||
more verbose description of the box.
|
||||
box : list
|
||||
List of boxes contained in this superbox.
|
||||
"""
|
||||
def __init__(self, length=0, offset=-1):
|
||||
Jp2kBox.__init__(self, box_id='jp2h', longname='JP2 Header')
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
self.box = []
|
||||
|
||||
def __str__(self):
|
||||
msg = Jp2kBox.__str__(self)
|
||||
for box in self.box:
|
||||
boxstr = str(box)
|
||||
|
||||
# Add indentation.
|
||||
strs = [('\n ' + x) for x in boxstr.split('\n')]
|
||||
msg += ''.join(strs)
|
||||
return msg
|
||||
|
||||
def write(self, fptr):
|
||||
"""Write a JP2 Header box to file.
|
||||
"""
|
||||
# Write the contained boxes, then come back and write the length.
|
||||
orig_pos = fptr.tell()
|
||||
fptr.write(struct.pack('>I', 0))
|
||||
fptr.write('jp2h'.encode())
|
||||
for box in self.box:
|
||||
box.write(fptr)
|
||||
|
||||
end_pos = fptr.tell()
|
||||
fptr.seek(orig_pos)
|
||||
fptr.write(struct.pack('>I', end_pos - orig_pos))
|
||||
fptr.seek(end_pos)
|
||||
|
||||
@staticmethod
|
||||
def parse(fptr, offset, length):
|
||||
"""Parse JPEG 2000 header box.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
fptr : file
|
||||
Open file object.
|
||||
offset : int
|
||||
Start position of box in bytes.
|
||||
length : int
|
||||
Length of the box in bytes.
|
||||
|
||||
Returns
|
||||
-------
|
||||
JP2HeaderBox instance
|
||||
"""
|
||||
box = JP2HeaderBox(length=length, offset=offset)
|
||||
|
||||
# The JP2 header box is a superbox, so go ahead and parse its child
|
||||
# boxes.
|
||||
box.box = box.parse_superbox(fptr)
|
||||
|
||||
return box
|
||||
|
||||
|
||||
class ComponentMappingBox(Jp2kBox):
|
||||
"""Container for channel identification information.
|
||||
|
||||
|
|
|
|||
|
|
@ -188,8 +188,8 @@ class Jp2k(Jp2kBox):
|
|||
warnings.warn(msg)
|
||||
|
||||
def _validate_write_parameters(self, img_array, code_block_size,
|
||||
precinct_sizes, cratios, psnr, mct,
|
||||
colorspace, codec_fmt):
|
||||
precinct_sizes, cratios, psnr, colorspace,
|
||||
codec_fmt):
|
||||
"""Check that the input parameters to the write function are valid.
|
||||
|
||||
Parameters
|
||||
|
|
@ -362,7 +362,7 @@ class Jp2k(Jp2kBox):
|
|||
codec_fmt = _opj2.CODEC_J2K
|
||||
|
||||
self._validate_write_parameters(img_array, cbsize, psizes, cratios,
|
||||
psnr, mct, colorspace, codec_fmt)
|
||||
psnr, colorspace, codec_fmt)
|
||||
|
||||
cparams = _opj2.set_default_encoder_parameters()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ Wraps fopen and fclose functions in libc.
|
|||
import ctypes
|
||||
import ctypes.util
|
||||
|
||||
libc_path = ctypes.util.find_library('c')
|
||||
C_LIB = ctypes.CDLL(libc_path)
|
||||
LIBC_PATH = ctypes.util.find_library('c')
|
||||
C_LIB = ctypes.CDLL(LIBC_PATH)
|
||||
|
||||
|
||||
def fopen(filename, mode):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue