summaryrefslogtreecommitdiff
path: root/bubbob/macbinary.py
diff options
context:
space:
mode:
authorDiego Roversi <diegor@tiscali.it>2019-09-08 22:05:57 +0200
committerDiego Roversi <diegor@tiscali.it>2019-09-08 22:05:57 +0200
commitc23b138ed72d794521b19ff7d8076b32b0b7bf46 (patch)
treec8e82a4ca4da05ba1ad28d4ff64a157bc1eb7952 /bubbob/macbinary.py
parent1d9925c287b318ec21343e2682b51ab6a36ae8db (diff)
2to3
Diffstat (limited to 'bubbob/macbinary.py')
-rw-r--r--bubbob/macbinary.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/bubbob/macbinary.py b/bubbob/macbinary.py
index 616bce0..a485290 100644
--- a/bubbob/macbinary.py
+++ b/bubbob/macbinary.py
@@ -43,16 +43,16 @@ class TypeList:
return self.resources()[id]
def keys(self):
- return self.resources().keys()
+ return list(self.resources().keys())
def values(self):
- return self.resources().values()
+ return list(self.resources().values())
def items(self):
- return self.resources().items()
+ return list(self.resources().items())
def namedict(self):
- return dict([(r.name, r) for r in self.resources().values() if r.name is not None])
+ return dict([(r.name, r) for r in list(self.resources().values()) if r.name is not None])
class MacBinary:
@@ -93,22 +93,22 @@ class MacBinary:
return self.dtypes
def keys(self):
- return self.dtypes.keys()
+ return list(self.dtypes.keys())
def values(self):
- return self.dtypes.values()
+ return list(self.dtypes.values())
def items(self):
- return self.dtypes.items()
+ return list(self.dtypes.items())
class Subfile:
def __init__(self, f, start, length):
if start < 0:
- raise ValueError, 'negative position'
+ raise ValueError('negative position')
if isinstance(f, Subfile):
if start + length > f.length:
- raise ValueError, 'subfile out of bounds'
+ raise ValueError('subfile out of bounds')
f, start = f.f, f.start+start
self.f = f
self.start = start
@@ -124,7 +124,7 @@ class Subfile:
return self.f.read(size)
def seek(self, npos):
if npos < 0:
- raise ValueError, 'negative position'
+ raise ValueError('negative position')
self.position = npos
@@ -186,7 +186,7 @@ class ppatResource(Resource):
f = self.subfile()
pattype, patmap, patdata = struct.unpack(">Hll", f.read(10))
if pattype != 1:
- raise ValueError, 'Pattern type not supported'
+ raise ValueError('Pattern type not supported')
f.seek(patmap)
(rowBytes, h, w, packType, packSize,
pixelType, pixelSize, cmpCount, cmpSize, pmTable) = (
@@ -194,9 +194,9 @@ class ppatResource(Resource):
isBitmap = (rowBytes & 0x8000) != 0
rowBytes &= 0x3FFF
if packType != 0:
- raise ValueError, 'packed image not supported'
+ raise ValueError('packed image not supported')
if pixelType != 0 or cmpCount != 1:
- raise ValueError, 'direct RGB image not supported'
+ raise ValueError('direct RGB image not supported')
assert cmpSize == pixelSize and pixelSize in [1,2,4,8]
f.seek(pmTable)
colormap = loadcolormap(f)