|
18 | 18 | getcomptype() -- returns compression type ('NONE' for linear samples) |
19 | 19 | getcompname() -- returns human-readable version of |
20 | 20 | compression type ('not compressed' linear samples) |
21 | | - getparams() -- returns a tuple consisting of all of the |
| 21 | + getparams() -- returns a namedtuple consisting of all of the |
22 | 22 | above in the above order |
23 | 23 | getmarkers() -- returns None (for compatibility with the |
24 | 24 | aifc module) |
@@ -90,6 +90,10 @@ class Error(Exception): |
90 | 90 | big_endian = 0 |
91 | 91 |
|
92 | 92 | from chunk import Chunk |
| 93 | +from collections import namedtuple |
| 94 | + |
| 95 | +_result = namedtuple('params', |
| 96 | + 'nchannels sampwidth framerate nframes comptype compname') |
93 | 97 |
|
94 | 98 | class Wave_read: |
95 | 99 | """Variables used in this class: |
@@ -206,9 +210,9 @@ def getcompname(self): |
206 | 210 | return self._compname |
207 | 211 |
|
208 | 212 | def getparams(self): |
209 | | - return self.getnchannels(), self.getsampwidth(), \ |
210 | | - self.getframerate(), self.getnframes(), \ |
211 | | - self.getcomptype(), self.getcompname() |
| 213 | + return _result(self.getnchannels(), self.getsampwidth(), |
| 214 | + self.getframerate(), self.getnframes(), |
| 215 | + self.getcomptype(), self.getcompname()) |
212 | 216 |
|
213 | 217 | def getmarkers(self): |
214 | 218 | return None |
@@ -398,8 +402,8 @@ def setparams(self, params): |
398 | 402 | def getparams(self): |
399 | 403 | if not self._nchannels or not self._sampwidth or not self._framerate: |
400 | 404 | raise Error('not all parameters set') |
401 | | - return self._nchannels, self._sampwidth, self._framerate, \ |
402 | | - self._nframes, self._comptype, self._compname |
| 405 | + return _result(self._nchannels, self._sampwidth, self._framerate, |
| 406 | + self._nframes, self._comptype, self._compname) |
403 | 407 |
|
404 | 408 | def setmark(self, id, pos, name): |
405 | 409 | raise Error('setmark() not supported') |
|
0 commit comments