Pep8 work. #90
This commit is contained in:
parent
429d0f8f1f
commit
8120c21299
7 changed files with 18 additions and 17 deletions
|
|
@ -187,8 +187,9 @@ class Jp2k(Jp2kBox):
|
||||||
msg += "profile if the file type box brand is 'jp2 '."
|
msg += "profile if the file type box brand is 'jp2 '."
|
||||||
warnings.warn(msg)
|
warnings.warn(msg)
|
||||||
|
|
||||||
def _validate_write_parameters(self, img_array, code_block_size, precinct_sizes, cratios,
|
def _validate_write_parameters(self, img_array, code_block_size,
|
||||||
psnr, mct, colorspace, codec_fmt):
|
precinct_sizes, cratios, psnr, mct,
|
||||||
|
colorspace, codec_fmt):
|
||||||
"""Check that the input parameters to the write function are valid.
|
"""Check that the input parameters to the write function are valid.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
|
@ -274,7 +275,6 @@ class Jp2k(Jp2kBox):
|
||||||
msg = "Only uint8 and uint16 images are currently supported."
|
msg = "Only uint8 and uint16 images are currently supported."
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable-msg=W0221
|
# pylint: disable-msg=W0221
|
||||||
def write(self, img_array, cratios=None, eph=False, psnr=None, numres=None,
|
def write(self, img_array, cratios=None, eph=False, psnr=None, numres=None,
|
||||||
cbsize=None, psizes=None, grid_offset=None, sop=False,
|
cbsize=None, psizes=None, grid_offset=None, sop=False,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import ctypes.util
|
||||||
libc_path = ctypes.util.find_library('c')
|
libc_path = ctypes.util.find_library('c')
|
||||||
C_LIB = ctypes.CDLL(libc_path)
|
C_LIB = ctypes.CDLL(libc_path)
|
||||||
|
|
||||||
|
|
||||||
def fopen(filename, mode):
|
def fopen(filename, mode):
|
||||||
"""Opens the file with the specified mode.
|
"""Opens the file with the specified mode.
|
||||||
|
|
||||||
|
|
@ -29,6 +30,7 @@ def fopen(filename, mode):
|
||||||
ctypes.c_char_p(mode.encode()))
|
ctypes.c_char_p(mode.encode()))
|
||||||
return fptr
|
return fptr
|
||||||
|
|
||||||
|
|
||||||
def fclose(fptr):
|
def fclose(fptr):
|
||||||
"""Closes a file stream.
|
"""Closes a file stream.
|
||||||
|
|
||||||
|
|
@ -42,4 +44,3 @@ def fclose(fptr):
|
||||||
status = C_LIB.fclose(fptr)
|
status = C_LIB.fclose(fptr)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
raise IOError("Unable to close file.")
|
raise IOError("Unable to close file.")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1384,6 +1384,7 @@ def set_error_message(msg):
|
||||||
global ERROR_MSG_LST
|
global ERROR_MSG_LST
|
||||||
ERROR_MSG_LST.append(msg)
|
ERROR_MSG_LST.append(msg)
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
"""Wrapper for opj_version library routine."""
|
"""Wrapper for opj_version library routine."""
|
||||||
OPENJP2.opj_version.restype = ctypes.c_char_p
|
OPENJP2.opj_version.restype = ctypes.c_char_p
|
||||||
|
|
@ -1392,4 +1393,3 @@ def version():
|
||||||
return library_version.decode('utf-8')
|
return library_version.decode('utf-8')
|
||||||
else:
|
else:
|
||||||
return library_version
|
return library_version
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,12 @@ import numpy as np
|
||||||
|
|
||||||
import glymur
|
import glymur
|
||||||
|
|
||||||
OPENJP2_IS_V2_OFFICIAL=False
|
OPENJP2_IS_V2_OFFICIAL = False
|
||||||
if glymur.lib.openjp2.OPENJP2 is not None:
|
if glymur.lib.openjp2.OPENJP2 is not None:
|
||||||
if not hasattr(glymur.lib.openjp2.OPENJP2, 'opj_stream_create_default_file_stream_v3'):
|
if not hasattr(glymur.lib.openjp2.OPENJP2,
|
||||||
OPENJP2_IS_V2_OFFICIAL=True
|
'opj_stream_create_default_file_stream_v3'):
|
||||||
|
OPENJP2_IS_V2_OFFICIAL = True
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
||||||
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
|
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,11 @@ import numpy as np
|
||||||
|
|
||||||
import glymur
|
import glymur
|
||||||
|
|
||||||
OPENJP2_IS_V2_OFFICIAL=False
|
OPENJP2_IS_V2_OFFICIAL = False
|
||||||
if glymur.lib.openjp2.OPENJP2 is not None:
|
if glymur.lib.openjp2.OPENJP2 is not None:
|
||||||
if not hasattr(glymur.lib.openjp2.OPENJP2, 'opj_stream_create_default_file_stream_v3'):
|
if not hasattr(glymur.lib.openjp2.OPENJP2,
|
||||||
OPENJP2_IS_V2_OFFICIAL=True
|
'opj_stream_create_default_file_stream_v3'):
|
||||||
|
OPENJP2_IS_V2_OFFICIAL = True
|
||||||
|
|
||||||
|
|
||||||
def mse(amat, bmat):
|
def mse(amat, bmat):
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,7 @@ import numpy as np
|
||||||
from glymur import Jp2k
|
from glymur import Jp2k
|
||||||
import glymur
|
import glymur
|
||||||
|
|
||||||
OPENJP2_IS_V2_OFFICIAL=False
|
from .fixtures import OPENJP2_IS_V2_OFFICIAL
|
||||||
if glymur.lib.openjp2.OPENJP2 is not None:
|
|
||||||
if not hasattr(glymur.lib.openjp2.OPENJP2, 'opj_stream_create_default_file_stream_v3'):
|
|
||||||
OPENJP2_IS_V2_OFFICIAL=True
|
|
||||||
|
|
||||||
from .fixtures import *
|
from .fixtures import *
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue