pep8 work, closes #307
This commit is contained in:
parent
13cc6aa7e5
commit
6f697526f2
30 changed files with 190 additions and 362 deletions
|
|
@ -1,9 +1,6 @@
|
|||
"""
|
||||
Configure glymur to use installed libraries if possible.
|
||||
"""
|
||||
# configparser is new in python3 (pylint/python-2.7)
|
||||
# pylint: disable=F0401
|
||||
|
||||
import ctypes
|
||||
from ctypes.util import find_library
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
Wraps individual functions in openjp2 library.
|
||||
"""
|
||||
|
||||
# pylint: disable=C0302,R0903,W0201
|
||||
|
||||
import ctypes
|
||||
import re
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"""Wraps library calls to openjpeg.
|
||||
"""
|
||||
|
||||
# pylint: disable=R0903
|
||||
|
||||
import ctypes
|
||||
import sys
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
"""
|
||||
Tests for libopenjp2 wrapping functions.
|
||||
"""
|
||||
# R0904: Seems like pylint is fooled in this situation
|
||||
# W0142: using kwargs is ok in this context
|
||||
# pylint: disable=R0904,W0142
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
|
@ -21,8 +16,8 @@ from glymur.lib import openjp2
|
|||
@unittest.skipIf(openjp2.OPENJP2 is None,
|
||||
"Missing openjp2 library.")
|
||||
@unittest.skipIf(re.match(r'''(1|2.0)''',
|
||||
glymur.version.openjpeg_version) is not None,
|
||||
"Not to be run until 2.1.0")
|
||||
glymur.version.openjpeg_version) is not None,
|
||||
"Not to be run until 2.1.0")
|
||||
class TestOpenJP2(unittest.TestCase):
|
||||
"""Test openjp2 library functionality.
|
||||
|
||||
|
|
@ -152,6 +147,7 @@ class TestOpenJP2(unittest.TestCase):
|
|||
xtx5_setup(tfile.name)
|
||||
self.assertTrue(True)
|
||||
|
||||
|
||||
def tile_encoder(**kwargs):
|
||||
"""Fixture used by many tests."""
|
||||
num_tiles = ((kwargs['image_width'] / kwargs['tile_width']) *
|
||||
|
|
@ -215,7 +211,7 @@ def tile_encoder(**kwargs):
|
|||
openjp2.setup_encoder(codec, l_param, l_image)
|
||||
|
||||
stream = openjp2.stream_create_default_file_stream(kwargs['filename'],
|
||||
False)
|
||||
False)
|
||||
openjp2.start_compress(codec, l_image, stream)
|
||||
|
||||
for j in np.arange(num_tiles):
|
||||
|
|
@ -226,13 +222,14 @@ def tile_encoder(**kwargs):
|
|||
openjp2.destroy_codec(codec)
|
||||
openjp2.image_destroy(l_image)
|
||||
|
||||
|
||||
def tile_decoder(**kwargs):
|
||||
"""Fixture called with various configurations by many tests.
|
||||
|
||||
Reads a tile. That's all it does.
|
||||
"""
|
||||
stream = openjp2.stream_create_default_file_stream(kwargs['filename'],
|
||||
True)
|
||||
True)
|
||||
dparam = openjp2.set_default_decoder_parameters()
|
||||
|
||||
dparam.decod_format = kwargs['codec_format']
|
||||
|
|
@ -270,6 +267,7 @@ def tile_decoder(**kwargs):
|
|||
openjp2.stream_destroy(stream)
|
||||
openjp2.image_destroy(image)
|
||||
|
||||
|
||||
def ttx0_setup(filename):
|
||||
"""Runs tests tte0, tte0."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -283,6 +281,7 @@ def ttx0_setup(filename):
|
|||
'tile_width': 100}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx2_setup(filename):
|
||||
"""Runs tests rta2, tte2, ttd2."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -296,6 +295,7 @@ def xtx2_setup(filename):
|
|||
'tile_width': 128}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx3_setup(filename):
|
||||
"""Runs tests tte3, rta3."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -309,6 +309,7 @@ def xtx3_setup(filename):
|
|||
'tile_width': 128}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx4_setup(filename):
|
||||
"""Runs tests rta4, tte4."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -322,6 +323,7 @@ def xtx4_setup(filename):
|
|||
'tile_width': 128}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx5_setup(filename):
|
||||
"""Runs tests rta5, tte5."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -334,6 +336,3 @@ def xtx5_setup(filename):
|
|||
'tile_height': 256,
|
||||
'tile_width': 256}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"""
|
||||
Tests for OpenJPEG module.
|
||||
"""
|
||||
# pylint: disable=E1101,R0904
|
||||
|
||||
import ctypes
|
||||
import re
|
||||
import sys
|
||||
|
|
@ -10,6 +8,7 @@ import unittest
|
|||
|
||||
import glymur
|
||||
|
||||
|
||||
@unittest.skipIf(glymur.lib.openjpeg.OPENJPEG is None,
|
||||
"Missing openjpeg library.")
|
||||
class TestOpenJPEG(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ else:
|
|||
import glymur
|
||||
from . import fixtures
|
||||
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03000000, "do not care about 2.7 here")
|
||||
@unittest.skipIf(re.match('0|1|2.0', glymur.version.openjpeg_version),
|
||||
"Requires openjpeg 2.1.0 or higher")
|
||||
|
|
@ -72,6 +73,3 @@ class TestPrintingOpenjp2(unittest.TestCase):
|
|||
|
||||
expected = fixtures.default_image_type
|
||||
self.assertRegex(actual, expected)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue