comparison pytouhou/formats/pbg3.py @ 97:ac2e5e1c2c3c

Refactor \o/
author Thibaut Girka <thib@sitedethib.com>
date Sun, 04 Sep 2011 23:50:00 +0200
parents 3da4de9decd0
children 88361534c77e
comparison
equal deleted inserted replaced
96:54929d495654 97:ac2e5e1c2c3c
39 39
40 class PBG3(object): 40 class PBG3(object):
41 def __init__(self, entries, bitstream=None): 41 def __init__(self, entries, bitstream=None):
42 self.entries = entries 42 self.entries = entries
43 self.bitstream = bitstream #TODO 43 self.bitstream = bitstream #TODO
44
45
46 def __enter__(self):
47 return self
48
49
50 def __exit__(self, type, value, traceback):
51 return self.bitstream.__exit__(type, value, traceback)
44 52
45 53
46 @classmethod 54 @classmethod
47 def read(cls, file): 55 def read(cls, file):
48 magic = file.read(4) 56 magic = file.read(4)