diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-07-25 20:12:01 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-07-25 20:12:01 (GMT) |
commit | 4d35e75ca069b51ffdac7b34dad4ffb77e72a598 (patch) | |
tree | 0b5cbaf639fc047ed4fd464371fcef2f8ccdcf13 /Lib/aifc.py | |
parent | 840c310a2577459dd9f6ac9f5f9b136d7f4829f8 (diff) | |
download | cpython-4d35e75ca069b51ffdac7b34dad4ffb77e72a598.zip cpython-4d35e75ca069b51ffdac7b34dad4ffb77e72a598.tar.gz cpython-4d35e75ca069b51ffdac7b34dad4ffb77e72a598.tar.bz2 |
#17818: aifc.getparams now returns a namedtuple.
Patch by Claudiu Popa.
Diffstat (limited to 'Lib/aifc.py')
-rw-r--r-- | Lib/aifc.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py index 67ea5da..ae5fd6d 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -69,7 +69,7 @@ This returns an instance of a class with the following public methods: getcomptype() -- returns compression type ('NONE' for AIFF files) getcompname() -- returns human-readable version of compression type ('not compressed' for AIFF files) - getparams() -- returns a tuple consisting of all of the + getparams() -- returns a namedtuple consisting of all of the above in the above order getmarkers() -- get the list of marks in the audio file or None if there are no marks @@ -252,6 +252,11 @@ def _write_float(f, x): _write_ulong(f, lomant) from chunk import Chunk +from collections import namedtuple + +_aifc_params = namedtuple('_aifc_params', + 'nchannels sampwidth framerate nframes comptype compname') + class Aifc_read: # Variables used in this class: @@ -378,9 +383,9 @@ class Aifc_read: ## return self._version def getparams(self): - return self.getnchannels(), self.getsampwidth(), \ - self.getframerate(), self.getnframes(), \ - self.getcomptype(), self.getcompname() + return _aifc_params(self.getnchannels(), self.getsampwidth(), + self.getframerate(), self.getnframes(), + self.getcomptype(), self.getcompname()) def getmarkers(self): if len(self._markers) == 0: @@ -658,8 +663,8 @@ class Aifc_write: def getparams(self): if not self._nchannels or not self._sampwidth or not self._framerate: raise Error('not all parameters set') - return self._nchannels, self._sampwidth, self._framerate, \ - self._nframes, self._comptype, self._compname + return _aifc_params(self._nchannels, self._sampwidth, self._framerate, + self._nframes, self._comptype, self._compname) def setmark(self, id, pos, name): if id <= 0: |