Pep8 work. #90

This commit is contained in:
John Evans 2013-07-29 11:40:47 -04:00
commit 8120c21299
7 changed files with 18 additions and 17 deletions

View file

@ -187,8 +187,9 @@ class Jp2k(Jp2kBox):
msg += "profile if the file type box brand is 'jp2 '."
warnings.warn(msg)
def _validate_write_parameters(self, img_array, code_block_size, precinct_sizes, cratios,
psnr, mct, colorspace, codec_fmt):
def _validate_write_parameters(self, img_array, code_block_size,
precinct_sizes, cratios, psnr, mct,
colorspace, codec_fmt):
"""Check that the input parameters to the write function are valid.
Parameters
@ -250,7 +251,7 @@ class Jp2k(Jp2kBox):
raise IOError(msg)
if _OPENJP2_IS_OFFICIAL_V2:
if (((img_array.ndim != 2) and
if (((img_array.ndim != 2) and
(img_array.shape[2] != 1 and img_array.shape[2] != 3))):
msg = "Writing images is restricted to single-channel "
msg += "greyscale images or three-channel RGB images when "
@ -274,7 +275,6 @@ class Jp2k(Jp2kBox):
msg = "Only uint8 and uint16 images are currently supported."
raise RuntimeError(msg)
# pylint: disable-msg=W0221
def write(self, img_array, cratios=None, eph=False, psnr=None, numres=None,
cbsize=None, psizes=None, grid_offset=None, sop=False,

View file

@ -8,6 +8,7 @@ import ctypes.util
libc_path = ctypes.util.find_library('c')
C_LIB = ctypes.CDLL(libc_path)
def fopen(filename, mode):
"""Opens the file with the specified mode.
@ -29,6 +30,7 @@ def fopen(filename, mode):
ctypes.c_char_p(mode.encode()))
return fptr
def fclose(fptr):
"""Closes a file stream.
@ -42,4 +44,3 @@ def fclose(fptr):
status = C_LIB.fclose(fptr)
if status != 0:
raise IOError("Unable to close file.")

View file

@ -145,7 +145,7 @@ def get_configdir():
if 'HOME' in os.environ and os.name != 'nt':
# HOME is set by WinPython to something unusual, so we don't
# necessarily want that.
# necessarily want that.
return os.path.join(os.environ['HOME'], '.config', 'glymur')
# Last stand. Should handle windows... others?

View file

@ -1384,6 +1384,7 @@ def set_error_message(msg):
global ERROR_MSG_LST
ERROR_MSG_LST.append(msg)
def version():
"""Wrapper for opj_version library routine."""
OPENJP2.opj_version.restype = ctypes.c_char_p
@ -1392,4 +1393,3 @@ def version():
return library_version.decode('utf-8')
else:
return library_version

View file

@ -16,10 +16,12 @@ import numpy as np
import glymur
OPENJP2_IS_V2_OFFICIAL=False
OPENJP2_IS_V2_OFFICIAL = False
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
if not hasattr(glymur.lib.openjp2.OPENJP2,
'opj_stream_create_default_file_stream_v3'):
OPENJP2_IS_V2_OFFICIAL = True
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,

View file

@ -5,10 +5,11 @@ import numpy as np
import glymur
OPENJP2_IS_V2_OFFICIAL=False
OPENJP2_IS_V2_OFFICIAL = False
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
if not hasattr(glymur.lib.openjp2.OPENJP2,
'opj_stream_create_default_file_stream_v3'):
OPENJP2_IS_V2_OFFICIAL = True
def mse(amat, bmat):

View file

@ -30,10 +30,7 @@ import numpy as np
from glymur import Jp2k
import glymur
OPENJP2_IS_V2_OFFICIAL=False
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 OPENJP2_IS_V2_OFFICIAL
from .fixtures import *