How to use the munch.IT214ContinueException function in munch

To help you get started, we’ve selected a few munch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iamgreaser / it2everything / munch.py View on Github external
self.running_count = 0
		
		self.is16 = is16
		self.fetch_a = 4 if is16 else 3
		self.spread_b = 16 if is16 else 8
		self.lower_b = -8 if is16 else -4
		self.upper_b = 7 if is16 else 3
		self.width = self.widthtop = 17 if is16 else 9
		self.unpack_mask = 0xFFFF if is16 else 0xFF
		self.maxgrablen = 0x4000 if is16 else 0x8000
		
		self.unpacked_data = []
		
		try:
			self.unpack()
		except IT214ContinueException, e:
			print "WARNING: IT214ContinueException occurred:", e
			print "This might actually be a bug."
			return # it's OK dear
		except IT214Exception, e:
			print "WARNING! WARNING! SAMPLE DATA DECOMPRESSED BADLY!"
			print "IT214Exception:", e
			print "old running count:", self.running_count
			while self.running_count < self.base_length:
				self.unpacked_data.append(self.unpacked_root)
				self.running_count += 1
			self.running_count = self.base_length
			return