Mercurial > hg > auditok
changeset 168:1fa7fa2857d4
Set deprecation warning for old position setters and getters in Rewindable
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Wed, 06 Mar 2019 21:01:44 +0100 |
parents | d45f4caca5f2 |
children | 54289c20c921 |
files | auditok/io.py |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/auditok/io.py Tue Mar 05 20:44:03 2019 +0100 +++ b/auditok/io.py Wed Mar 06 21:01:44 2019 +0100 @@ -26,6 +26,7 @@ import os import sys import wave +import warnings import audioop from array import array from functools import partial @@ -361,10 +362,18 @@ def get_position(self): """ Return the total number of already read samples """ + warnings.warn( + "'get_position' is deprecated, use 'position' property instead", + DeprecationWarning + ) return self.position def get_time_position(self): """ Return the total duration in seconds of already read data """ + warnings.warn( + "'get_time_position' is deprecated, use 'position_s' or 'position_ms' properties instead", + DeprecationWarning + ) return self.position_s def set_position(self, position): @@ -375,6 +384,10 @@ `position` : int number of samples to skip from the start of the stream """ + warnings.warn( + "'set_position' is deprecated, set 'position' property instead", + DeprecationWarning + ) self.position = position def set_time_position(self, time_position): @@ -385,6 +398,10 @@ `time_position` : float seconds to skip from the start of the stream """ + warnings.warn( + "'set_time_position' is deprecated, set 'position_s' or 'position_ms' properties instead", + DeprecationWarning + ) self.position_s = time_position