From 2fe0d000a531e03d4e0b5d0be0a6f380befb3cac Mon Sep 17 00:00:00 2001 From: jevans Date: Mon, 17 Jun 2013 20:35:20 -0400 Subject: [PATCH 1/3] File should have been added as a part of fdf73da to close #20 --- glymur/data/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 glymur/data/__init__.py diff --git a/glymur/data/__init__.py b/glymur/data/__init__.py new file mode 100644 index 0000000..ff39c0e --- /dev/null +++ b/glymur/data/__init__.py @@ -0,0 +1,19 @@ +"""Shipping JPEG 2000 files. + +There is only one JP2 file at the moment, "nemo.jp2", converted from the +original JPEG photo of the aftermath of NEMO, the nor'easter that shutdown +Boston in February of 2013. +""" +import pkg_resources + + +def nemo(): + """Shortcut for specifying path to nemo.jp2. + + Returns + ------- + file : str + Platform-independent path to nemo.jp2. + """ + file = pkg_resources.resource_filename(__name__, "nemo.jp2") + return file From 173216cd6e636323dcd80f5378dc183927113b1b Mon Sep 17 00:00:00 2001 From: jevans Date: Mon, 17 Jun 2013 20:36:16 -0400 Subject: [PATCH 2/3] Pep8 work. --- glymur/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glymur/__init__.py b/glymur/__init__.py index 6a7574e..473bb65 100644 --- a/glymur/__init__.py +++ b/glymur/__init__.py @@ -1,6 +1,7 @@ """glymur - read, write, and interrogate JPEG 2000 files """ + def _glymurrc_fname(): """Return the path to the configuration file. @@ -61,7 +62,7 @@ def _config(): def _get_configdir(): """Return string representing the configuration directory. - Default is $HOME/.config/glymur. You can override this with the + Default is $HOME/.config/glymur. You can override this with the XDG_CONFIG_HOME environment variable. """ From 1404be4bf126a403d801c2470c112624c5b36fc8 Mon Sep 17 00:00:00 2001 From: jevans Date: Mon, 17 Jun 2013 20:36:22 -0400 Subject: [PATCH 3/3] Closes #49 --- glymur/codestream.py | 2 +- glymur/jp2box.py | 10 +++++----- glymur/jp2k.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/glymur/codestream.py b/glymur/codestream.py index f433eca..b7598cf 100644 --- a/glymur/codestream.py +++ b/glymur/codestream.py @@ -226,7 +226,7 @@ class Codestream: def __str__(self): msg = 'Codestream:\n' for segment in self.segment: - strs = segment.__str__() + strs = str(segment) # Add indentation strs = [(' ' + x + '\n') for x in strs.split('\n')] diff --git a/glymur/jp2box.py b/glymur/jp2box.py index 0ee95c2..bb313df 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -532,7 +532,7 @@ class ContiguousCodestreamBox(Jp2kBox): msg = Jp2kBox.__str__(self) msg += '\n Main header:' for segment in self.main_header.segment: - segstr = segment.__str__() + segstr = str(segment) # Add indentation. strs = [('\n ' + x) for x in segstr.split('\n')] @@ -760,7 +760,7 @@ class AssociationBox(Jp2kBox): def __str__(self): msg = Jp2kBox.__str__(self) for box in self.box: - boxstr = box.__str__() + boxstr = str(box) # Add indentation. strs = [('\n ' + x) for x in boxstr.split('\n')] @@ -824,7 +824,7 @@ class JP2HeaderBox(Jp2kBox): def __str__(self): msg = Jp2kBox.__str__(self) for box in self.box: - boxstr = box.__str__() + boxstr = str(box) # Add indentation. strs = [('\n ' + x) for x in boxstr.split('\n')] @@ -1177,7 +1177,7 @@ class ResolutionBox(Jp2kBox): def __str__(self): msg = Jp2kBox.__str__(self) for box in self.box: - boxstr = box.__str__() + boxstr = str(box) # Add indentation. strs = [('\n ' + x) for x in boxstr.split('\n')] @@ -1554,7 +1554,7 @@ class UUIDInfoBox(Jp2kBox): msg = Jp2kBox.__str__(self) for box in self.box: - box_str = box.__str__() + box_str = str(box) # Add indentation. lst = [('\n ' + x) for x in box_str.split('\n')] diff --git a/glymur/jp2k.py b/glymur/jp2k.py index af08c2b..b09271e 100644 --- a/glymur/jp2k.py +++ b/glymur/jp2k.py @@ -87,10 +87,10 @@ class Jp2k(Jp2kBox): metadata = ['File: ' + os.path.basename(self.filename)] if len(self.box) > 0: for box in self.box: - metadata.append(box.__str__()) + metadata.append(str(box)) else: c = self.get_codestream() - metadata.append(c.__str__()) + metadata.append(str(c)) return '\n'.join(metadata) def _parse(self):