pep8 work.

This commit is contained in:
John Evans 2013-07-10 19:34:33 -04:00
commit 3f8495a3bb
9 changed files with 28 additions and 22 deletions

View file

@ -124,6 +124,7 @@ def load_openjp2(libopenjp2_path):
return openjp2_lib return openjp2_lib
def glymur_config(): def glymur_config():
"""Try to ascertain locations of openjp2, openjpeg libraries. """Try to ascertain locations of openjp2, openjpeg libraries.
""" """

View file

@ -4,6 +4,7 @@ import unittest
import glymur import glymur
@unittest.skipIf(glymur.lib._openjpeg.OPENJPEG is None, @unittest.skipIf(glymur.lib._openjpeg.OPENJPEG is None,
"Missing openjpeg library.") "Missing openjpeg library.")
class TestOpenJPEG(unittest.TestCase): class TestOpenJPEG(unittest.TestCase):
@ -36,4 +37,3 @@ class TestOpenJPEG(unittest.TestCase):
self.assertEqual(dp.jpwl_max_tiles, 0) self.assertEqual(dp.jpwl_max_tiles, 0)
self.assertEqual(dp.cp_limit_decoding, 0) self.assertEqual(dp.cp_limit_decoding, 0)
self.assertEqual(dp.flags, 0) self.assertEqual(dp.flags, 0)

View file

@ -3,6 +3,7 @@ import sys
import numpy as np import numpy as np
def mse(amat, bmat): def mse(amat, bmat):
"""Mean Square Error""" """Mean Square Error"""
diff = amat.astype(np.double) - bmat.astype(np.double) diff = amat.astype(np.double) - bmat.astype(np.double)
@ -88,5 +89,3 @@ def read_pgx(pgx_file):
data = np.fromfile(file=fptr, dtype=dtype).reshape(shape) data = np.fromfile(file=fptr, dtype=dtype).reshape(shape)
return(data.byteswap(swapbytes)) return(data.byteswap(swapbytes))

View file

@ -98,9 +98,12 @@ class TestCallbacks15(unittest.TestCase):
actual = sys.stdout.getvalue().strip() actual = sys.stdout.getvalue().strip()
regex = re.compile(r"""\[INFO\]\stile\s1\sof\s1\s+ regex = re.compile(r"""\[INFO\]\stile\s1\sof\s1\s+
\[INFO\]\s-\stiers-1\stook\s[0-9]+\.[0-9]+\ss\s+ \[INFO\]\s-\stiers-1\stook\s
\[INFO\]\s-\sdwt\stook\s(-){0,1}[0-9]+\.[0-9]+\ss\s+ [0-9]+\.[0-9]+\ss\s+
\[INFO\]\s-\stile\sdecoded\sin\s[0-9]+\.[0-9]+\ss""", \[INFO\]\s-\sdwt\stook\s
(-){0,1}[0-9]+\.[0-9]+\ss\s+
\[INFO\]\s-\stile\sdecoded\sin\s
[0-9]+\.[0-9]+\ss""",
re.VERBOSE) re.VERBOSE)
if sys.hexversion <= 0x03020000: if sys.hexversion <= 0x03020000:
self.assertRegexpMatches(actual, regex) self.assertRegexpMatches(actual, regex)
@ -108,6 +111,5 @@ class TestCallbacks15(unittest.TestCase):
self.assertRegex(actual, regex) self.assertRegex(actual, regex)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View file

@ -102,7 +102,6 @@ class TestJp2kBadXmlFile(unittest.TestCase):
self.assertIsNone(jp2k.box[3].xml) self.assertIsNone(jp2k.box[3].xml)
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None, @unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
"Missing openjp2 library.") "Missing openjp2 library.")
class TestJp2k(unittest.TestCase): class TestJp2k(unittest.TestCase):
@ -634,10 +633,10 @@ class TestJp2k(unittest.TestCase):
Invalid\svalues\sfor\scomp\s=\s0\s+ Invalid\svalues\sfor\scomp\s=\s0\s+
:\sdx=1\sdy=0''', re.VERBOSE) :\sdx=1\sdy=0''', re.VERBOSE)
if sys.hexversion < 0x03020000: if sys.hexversion < 0x03020000:
with self.assertRaisesRegexp((IOError, OSError), regexp) as ce: with self.assertRaisesRegexp((IOError, OSError), regexp):
d = j.read(rlevel=1) d = j.read(rlevel=1)
else: else:
with self.assertRaisesRegex((IOError, OSError), regexp) as ce: with self.assertRaisesRegex((IOError, OSError), regexp):
d = j.read(rlevel=1) d = j.read(rlevel=1)
def test_xmp_attribute(self): def test_xmp_attribute(self):

View file

@ -4216,7 +4216,8 @@ class TestSuiteDump(unittest.TestCase):
# Jp2 Header # Jp2 Header
# Colour specification # Colour specification
self.assertEqual(jp2.box[3].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # enumerated self.assertEqual(jp2.box[3].box[1].method,
glymur.core.RESTRICTED_ICC_PROFILE) # enumerated
self.assertEqual(jp2.box[3].box[1].precedence, 0) self.assertEqual(jp2.box[3].box[1].precedence, 0)
self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact
self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 546) self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 546)
@ -4313,7 +4314,8 @@ class TestSuiteDump(unittest.TestCase):
# Jp2 Header # Jp2 Header
# Colour specification # Colour specification
self.assertEqual(jp2.box[3].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) self.assertEqual(jp2.box[3].box[1].method,
glymur.core.RESTRICTED_ICC_PROFILE)
self.assertEqual(jp2.box[3].box[1].precedence, 0) self.assertEqual(jp2.box[3].box[1].precedence, 0)
self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact
self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 13332) self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 13332)
@ -4363,7 +4365,8 @@ class TestSuiteDump(unittest.TestCase):
# Jp2 Header # Jp2 Header
# Colour specification # Colour specification
self.assertEqual(jp2.box[2].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # enumerated self.assertEqual(jp2.box[2].box[1].method,
glymur.core.RESTRICTED_ICC_PROFILE) # enumerated
self.assertEqual(jp2.box[2].box[1].precedence, 0) self.assertEqual(jp2.box[2].box[1].precedence, 0)
self.assertEqual(jp2.box[2].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[2].box[1].approximation, 1) # JPX exact
self.assertEqual(jp2.box[2].box[1].icc_profile['Size'], 414) self.assertEqual(jp2.box[2].box[1].icc_profile['Size'], 414)
@ -7080,7 +7083,8 @@ class TestSuiteDump(unittest.TestCase):
# Jp2 Header # Jp2 Header
# Colour specification # Colour specification
self.assertEqual(jp2.box[2].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # res icc self.assertEqual(jp2.box[2].box[1].method,
glymur.core.RESTRICTED_ICC_PROFILE)
self.assertEqual(jp2.box[2].box[1].precedence, 0) self.assertEqual(jp2.box[2].box[1].precedence, 0)
self.assertEqual(jp2.box[2].box[1].approximation, 0) # JP2 self.assertEqual(jp2.box[2].box[1].approximation, 0) # JP2
self.assertIsNone(jp2.box[2].box[1].icc_profile) self.assertIsNone(jp2.box[2].box[1].icc_profile)

View file

@ -22,8 +22,9 @@
| | | | gracefully. | | | | | gracefully. |
+------------+------------+------------+--------------------------------------+ +------------+------------+------------+--------------------------------------+
| Fedora 18 | | X | Ships with 1.5.1. 167 of 445 tests | | Fedora 18 | | X | Ships with 1.5.1. 167 of 445 tests |
| | | | should pass (no OPJ_DATA_ROOT). | | | | | should pass. |
+------------+------------+------------+--------------------------------------+ +------------+------------+------------+--------------------------------------+
Pylint on entire package should be at least 0.95. Pylint on entire package should be at least 0.95.
pep8 should be pass cleanly. pep8 should be pass cleanly.
Coverage should exceed 95%.