# HG changeset patch # User Amine Sehili # Date 1551902504 -3600 # Node ID 1fa7fa2857d42d19be479aa5c3446642ce2363f7 # Parent d45f4caca5f295dca60ba190bbd4ee4bf15debeb Set deprecation warning for old position setters and getters in Rewindable diff -r d45f4caca5f2 -r 1fa7fa2857d4 auditok/io.py --- 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