From b5331ce36e9d99e9ba482d26dccbded4bed71229 Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 17 Jul 2013 06:26:33 -0400 Subject: [PATCH] Removed _file_size attribute, it's unneeded. --- glymur/jp2box.py | 6 ++---- glymur/jp2k.py | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/glymur/jp2box.py b/glymur/jp2box.py index df9a3a0..fe9ee00 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -16,6 +16,7 @@ References import copy import datetime import math +import os import pprint import struct import sys @@ -73,9 +74,6 @@ class Jp2kBox(object): self.offset = offset self.longname = longname - # should never be used except maybe for last box in file. - self._file_size = -1 - def __str__(self): msg = "{0} Box ({1})".format(self.longname, self.box_id) msg += " @ ({0}, {1})".format(self.offset, self.length) @@ -118,7 +116,7 @@ class Jp2kBox(object): if box_length == 0: # The length of the box is presumed to last until the end of # the file. Compute the effective length of the box. - num_bytes = self._file_size - fptr.tell() + 8 + num_bytes = os.path.getsize(fptr.name) - fptr.tell() + 8 elif box_length == 1: # The length of the box is in the XL field, a 64-bit value. diff --git a/glymur/jp2k.py b/glymur/jp2k.py index 733a888..23aed62 100644 --- a/glymur/jp2k.py +++ b/glymur/jp2k.py @@ -101,7 +101,6 @@ class Jp2k(Jp2kBox): self.mode = mode self.box = [] self._codec_format = None - self._file_size = 0 # Parse the file for JP2/JPX contents only if we are reading it. if mode == 'rb': @@ -126,7 +125,6 @@ class Jp2k(Jp2kBox): The file was not JPEG 2000. """ self.length = os.path.getsize(self.filename) - self._file_size = os.path.getsize(self.filename) with open(self.filename, 'rb') as fptr: