# HG changeset patch # User Amine Sehili # Date 1572103124 -3600 # Node ID 8220dfaa03c6eebeb0deb25fb60995929cf28e36 # Parent f7cbf707a34ed11aafada3e79191b0ce7a69509b Remove deprecated methods in AudioSource diff -r f7cbf707a34e -r 8220dfaa03c6 auditok/io.py --- a/auditok/io.py Fri Oct 25 20:56:12 2019 +0100 +++ b/auditok/io.py Sat Oct 26 16:18:44 2019 +0100 @@ -195,15 +195,6 @@ - 'left_samples' if `size` > 'left_samples' """ - def get_sampling_rate(self): - """ Return the number of samples per second of audio stream """ - warnings.warn( - "'get_sampling_rate' is deprecated, use 'sampling_rate' " - "property instead", - DeprecationWarning, - ) - return self.sampling_rate - @property def sampling_rate(self): """ Number of samples per second of audio stream """ @@ -214,15 +205,6 @@ """ Number of samples per second of audio stream """ return self._sampling_rate - def get_sample_width(self): - """ Return the number of bytes used to represent one audio sample """ - warnings.warn( - "'get_sample_width' is deprecated, use 'sample_width' " - "property instead", - DeprecationWarning, - ) - return self.sample_width - @property def sample_width(self): """ Number of bytes used to represent one audio sample """ @@ -233,14 +215,6 @@ """ Number of bytes used to represent one audio sample """ return self._sample_width - def get_channels(self): - """ Return the number of channels of this audio source """ - warnings.warn( - "'get_channels' is deprecated, use 'channels' " "property instead", - DeprecationWarning, - ) - return self.channels - @property def channels(self): """ Number of channels of this audio source """ diff -r f7cbf707a34e -r 8220dfaa03c6 tests/test_AudioReader.py --- a/tests/test_AudioReader.py Fri Oct 25 20:56:12 2019 +0100 +++ b/tests/test_AudioReader.py Sat Oct 26 16:18:44 2019 +0100 @@ -594,7 +594,7 @@ "Wrong sampling rate, expected: 16000, found: {0}".format(srate), ) - def test_ADS_BAS_get_sample_width(self): + def test_ADS_BAS_sample_width(self): swidth = self.ads.sample_width self.assertEqual( swidth, @@ -602,7 +602,7 @@ "Wrong sample width, expected: 2, found: {0}".format(swidth), ) - def test_ADS_BAS_get_channels(self): + def test_ADS_BAS_channels(self): channels = self.ads.channels self.assertEqual( channels, diff -r f7cbf707a34e -r 8220dfaa03c6 tests/test_AudioSource.py --- a/tests/test_AudioSource.py Fri Oct 25 20:56:12 2019 +0100 +++ b/tests/test_AudioSource.py Sat Oct 26 16:18:44 2019 +0100 @@ -189,24 +189,24 @@ msg="wrong block, expected: {}, found: {} ".format(None, block), ) - def test_sr10_sw1_ch1_get_sampling_rate(self): - srate = self.audio_source.get_sampling_rate() + def test_sr10_sw1_ch1_sampling_rate(self): + srate = self.audio_source.sampling_rate self.assertEqual( srate, 10, msg="wrong sampling rate, expected: 10, found: {0} ".format(srate), ) - def test_sr10_sw1_ch1_get_sample_width(self): - swidth = self.audio_source.get_sample_width() + def test_sr10_sw1_ch1_sample_width(self): + swidth = self.audio_source.sample_width self.assertEqual( swidth, 1, msg="wrong sample width, expected: 1, found: {0} ".format(swidth), ) - def test_sr10_sw1_ch1_get_channels(self): - channels = self.audio_source.get_channels() + def test_sr10_sw1_ch1_channels(self): + channels = self.audio_source.channels self.assertEqual( channels, 1, @@ -527,25 +527,25 @@ msg="wrong block, expected: {0}, found: {1} ".format(None, block), ) - def test_sr16_sw2_ch1_get_sampling_rate(self): - srate = self.audio_source.get_sampling_rate() + def test_sr16_sw2_ch1_sampling_rate(self): + srate = self.audio_source.sampling_rate self.assertEqual( srate, 16, msg="wrong sampling rate, expected: 10, found: {0} ".format(srate), ) - def test_sr16_sw2_ch1_get_sample_width(self): - swidth = self.audio_source.get_sample_width() + def test_sr16_sw2_ch1_sample_width(self): + swidth = self.audio_source.sample_width self.assertEqual( swidth, 2, msg="wrong sample width, expected: 1, found: {0} ".format(swidth), ) - def test_sr16_sw2_ch1_get_channels(self): + def test_sr16_sw2_ch1_channels(self): - channels = self.audio_source.get_channels() + channels = self.audio_source.channels self.assertEqual( channels, 1, @@ -808,24 +808,24 @@ msg="wrong block, expected: {0}, found: {1} ".format(None, block), ) - def test_sr11_sw4_ch1_get_sampling_rate(self): - srate = self.audio_source.get_sampling_rate() + def test_sr11_sw4_ch1_sampling_rate(self): + srate = self.audio_source.sampling_rate self.assertEqual( srate, 11, msg="wrong sampling rate, expected: 10, found: {0} ".format(srate), ) - def test_sr11_sw4_ch1_get_sample_width(self): - swidth = self.audio_source.get_sample_width() + def test_sr11_sw4_ch1_sample_width(self): + swidth = self.audio_source.sample_width self.assertEqual( swidth, 4, msg="wrong sample width, expected: 1, found: {0} ".format(swidth), ) - def test_sr11_sw4_ch1_get_channels(self): - channels = self.audio_source.get_channels() + def test_sr11_sw4_ch1_channels(self): + channels = self.audio_source.channels self.assertEqual( channels, 1,