changeset 385:d8aab27a2ab2

Add missing imports, and remove side-effects in asserts.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 20 Oct 2012 20:44:11 +0200
parents 690b5faaa0e6
children dc6ed7b1c6de
files pytouhou/formats/fmt.py pytouhou/formats/t6rp.py pytouhou/ui/music.py pytouhou/ui/shader.py
diffstat 4 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/formats/fmt.py
+++ b/pytouhou/formats/fmt.py
@@ -61,7 +61,8 @@ class FMT(list):
             assert track.wFormatTag == 1 # We don’t support non-PCM formats
             assert track.dwAvgBytesPerSec == track.dwSamplesPerSec * track.wBlockAlign
             assert track.wBlockAlign == track.wChannels * track.wBitsPerSample // 8
-            assert b'\00\00\00\00' == file.read(4)
+            zero = file.read(4)
+            assert b'\00\00\00\00' == zero
 
             self.append(track)
 
--- a/pytouhou/formats/t6rp.py
+++ b/pytouhou/formats/t6rp.py
@@ -25,6 +25,7 @@ from io import BytesIO
 from time import strftime
 
 from pytouhou.utils.helpers import read_string, get_logger
+from pytouhou.formats import ChecksumError
 
 logger = get_logger(__name__)
 
--- a/pytouhou/ui/music.py
+++ b/pytouhou/ui/music.py
@@ -71,7 +71,8 @@ class ZwavSource(InfiniteWaveSource):
 
         self._file = file
 
-        assert b'ZWAV' == self._file.read(4)
+        magic = self._file.read(4)
+        assert b'ZWAV' == magic
 
         self.audio_format = AudioFormat(
             channels=format.wChannels,
--- a/pytouhou/ui/shader.py
+++ b/pytouhou/ui/shader.py
@@ -12,10 +12,11 @@ from pyglet.gl import (glCreateProgram, 
                        GL_FRAGMENT_SHADER, glShaderSource, glCompileShader,
                        glGetShaderiv, GL_COMPILE_STATUS, GL_INFO_LOG_LENGTH,
                        glGetShaderInfoLog, glAttachShader, glLinkProgram,
-                       glGetProgramiv, GL_LINK_STATUS, glUseProgram,
-                       glGetUniformLocation, glUniform1f, glUniform2f,
-                       glUniform3f, glUniform4f, glUniform1i, glUniform2i,
-                       glUniform3i, glUniform4i, glUniformMatrix4fv)
+                       glGetProgramiv, glGetProgramInfoLog, GL_LINK_STATUS,
+                       glUseProgram, glGetUniformLocation, glUniform1f,
+                       glUniform2f, glUniform3f, glUniform4f, glUniform1i,
+                       glUniform2i, glUniform3i, glUniform4i,
+                       glUniformMatrix4fv)
 
 from ctypes import (c_char, c_char_p, c_int, POINTER, byref, cast,
                     create_string_buffer)