@@ -728,46 +728,6 @@ def __getattr__(self, name):
728
728
def __len__ (self ):
729
729
return self ._info .frames
730
730
731
- def __getitem__ (self , frame ):
732
- # access the file as if it where a Numpy array. The data is
733
- # returned as numpy array.
734
- from warnings import warn
735
- warn ('indexing has been deprecated and will be removed in the future' ,
736
- Warning )
737
- second_frame = None
738
- if isinstance (frame , tuple ):
739
- if len (frame ) > 2 :
740
- raise AttributeError (
741
- "SoundFile can only be accessed in one or two dimensions" )
742
- frame , second_frame = frame
743
- start , stop = self ._get_slice_bounds (frame )
744
- curr = self .seek (0 , SEEK_CUR )
745
- self .seek (start , SEEK_SET )
746
- data = self .read (stop - start )
747
- self .seek (curr , SEEK_SET )
748
- if second_frame :
749
- return data [(slice (None ), second_frame )]
750
- else :
751
- return data
752
-
753
- def __setitem__ (self , frame , data ):
754
- # access the file as if it where a one-dimensional Numpy
755
- # array. Data must be in the form (frames x channels).
756
- # Both open slice bounds and negative values are allowed.
757
- from warnings import warn
758
- warn ('indexing has been deprecated and will be removed in the future' ,
759
- Warning )
760
- start , stop = self ._get_slice_bounds (frame )
761
- if stop - start != len (data ):
762
- raise IndexError (
763
- "Could not fit data of length %i into slice of length %i" %
764
- (len (data ), stop - start ))
765
- curr = self .seek (0 , SEEK_CUR )
766
- self .seek (start , SEEK_SET )
767
- self .write (data )
768
- self .seek (curr , SEEK_SET )
769
- return data
770
-
771
731
def seekable (self ):
772
732
"""Return True if the file supports seeking."""
773
733
return self ._info .seekable == _snd .SF_TRUE
0 commit comments